learn-katacoda icon indicating copy to clipboard operation
learn-katacoda copied to clipboard

Error in Spring Boot development on OpenShift

Open mefrom opened this issue 4 years ago • 2 comments
trafficstars

I am walking through ‘Spring Boot development on OpenShift’ at this site https://learn.openshift.com/developing-with-spring/

on ‘6. Run and Verify step where it is testing out the Fruit Repository. This is in Step 2 of 5 .

I am receiving these errors

ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /root/projects/rhoar-getting-started/spring/spring-rhoar-intro/src/test/java/com/example/ApplicationTest.java:[36,33] cannot find symbol symbol: method findById(int) location: variable fruitRepository of type com.example.service.FruitRepository [ERROR] /root/projects/rhoar-getting-started/spring/spring-rhoar-intro/src/test/java/com/example/ApplicationTest.java:[41,38] cannot find symbol symbol: method findById(int) location: variable fruitRepository of type com.example.service.FruitRepository [ERROR] /root/projects/rhoar-getting-started/spring/spring-rhoar-intro/src/test/java/com/example/ApplicationTest.java:[48,35] cannot find symbol symbol: method findById(int) location: variable fruitRepository of type com.example.service.FruitRepository [ERROR] /root/projects/rhoar-getting-started/spring/spring-rhoar-intro/src/test/java/com/example/ApplicationTest.java:[54,39] cannot find symbol symbol: method findById(int) location: variable fruitRepository of type com.example.service.FruitRepository [ERROR] /root/projects/rhoar-getting-started/spring/spring-rhoar-intro/src/test/java/com/example/ApplicationTest.java:[57,35] cannot find symbol symbol: method findById(int) location: variable fruitRepository of type com.example.service.FruitRepository [ERROR] /root/projects/rhoar-getting-started/spring/spring-rhoar-intro/src/test/java/com/example/ApplicationTest.java:[62,33] cannot find symbol symbol: method findById(int)

--

mefrom avatar Dec 18 '20 18:12 mefrom

Yes, I've got it also. It is caused because they use Spring Boot 1.5 and it doesn't have findById in Spring Data, only findOne (not Optional). If you rename method findById -> findOne and remove 'orElse' part it will work.

GAMST12 avatar Feb 16 '21 12:02 GAMST12

We have updated to newer Spring and verified all of the scenarios work as expected. Please re-test at your convenience.

jamesfalkner avatar Jul 08 '21 15:07 jamesfalkner