Hello.
I'm trying to run my first Spring project and I'm getting the error below. I'm tearing my hair out at this stage. I cannot fix it. Any suggestion would be great. Thank You.
Exception in thread "main" java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.runCommandLineRunners(SpringApplication.java:675)
at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:690)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:957)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:946)
at ie.cit.caf.GroupProjectApplication.main(GroupProjectApplication.java:82)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
at ie.cit.caf.GroupProjectApplication.run(GroupProjectApplication.java:132)
at org.springframework.boot.SpringApplication.runCommandLineRunners(SpringApplication.java:672)
... 5 more
The secret of interpreting stack traces is to look at the "Caused by" section - and find the last bit where it leaves 'your' code.
In this case, the issue seems to be in GroupProjectApplication.java - in the run method.
What is happening on line 132 of this class ?
What does that code look like?
Does it reference an Array or similar via an index/number?
Does whatever you are referencing have values in it?
Hopefully that should point you in the right direction.
In order to be of any further help, we will need to see the mentioned class/method.
At line No 132 you are trying to get Element from String Array , ,May be you are not passing any args for your main class ,you must pass command line parameter .