Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception after batch launch => IllegalStateException: Failed to execute ApplicationRunner #19

Closed
BugHunterPhilosopher opened this issue Oct 5, 2020 · 7 comments
Labels
bug Something isn't working

Comments

@BugHunterPhilosopher
Copy link

BugHunterPhilosopher commented Oct 5, 2020

Good evening,

I discovered your project this afternoon, so first: thanks a lot for this neat piece of code.

I have a first version of my code working, but * after * the batch has run, I have this stacktrace:

2020-10-05 17:50:47.476 ERROR 11864 --- [           main] o.s.boot.SpringApplication               : Application run failed

java.lang.IllegalStateException: Failed to execute ApplicationRunner
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:789) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
	at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:776) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:322) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
	at blah.main(BlahApplication.java:26) ~[classes/:na]
Caused by: java.lang.NullPointerException: null
	at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:104) ~[spring-batch-core-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) ~[spring-aop-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) ~[spring-aop-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration$PassthruAdvice.invoke(SimpleBatchConfiguration.java:127) ~[spring-batch-core-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) ~[spring-aop-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at com.sun.proxy.$Proxy78.run(Unknown Source) ~[na:na]
	at org.springframework.boot.autoconfigure.batch.JobLauncherApplicationRunner.execute(JobLauncherApplicationRunner.java:199) ~[spring-boot-autoconfigure-2.3.4.RELEASE.jar:2.3.4.RELEASE]
	at org.springframework.boot.autoconfigure.batch.JobLauncherApplicationRunner.executeLocalJobs(JobLauncherApplicationRunner.java:173) ~[spring-boot-autoconfigure-2.3.4.RELEASE.jar:2.3.4.RELEASE]
	at org.springframework.boot.autoconfigure.batch.JobLauncherApplicationRunner.launchJobFromProperties(JobLauncherApplicationRunner.java:160) ~[spring-boot-autoconfigure-2.3.4.RELEASE.jar:2.3.4.RELEASE]
	at org.springframework.boot.autoconfigure.batch.JobLauncherApplicationRunner.run(JobLauncherApplicationRunner.java:155) ~[spring-boot-autoconfigure-2.3.4.RELEASE.jar:2.3.4.RELEASE]
	at org.springframework.boot.autoconfigure.batch.JobLauncherApplicationRunner.run(JobLauncherApplicationRunner.java:150) ~[spring-boot-autoconfigure-2.3.4.RELEASE.jar:2.3.4.RELEASE]
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:786) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
	... 5 common frames omitted

Do you have any idea why this occurs, please? You'll find attached my main files.

Thanks in advance & Regards

neo4japp.zip

@valb3r
Copy link
Owner

valb3r commented Oct 6, 2020

Hello @BugHunterPhilosopher
The reason it happens is that
https://github.com/valb3r/springbatch-neo4j-adapter/blob/master/neo4j-adapter/src/main/java/com/github/valb3r/springbatch/adapters/neo4j/config/Neo4jBatchConfigurer.java
does not autowire repository to SimpleJobLauncher here:

 @Override
    public JobLauncher getJobLauncher() {
        return new SimpleJobLauncher();
    }

The idea was to avoid launching jobs from SimpleJobLauncher and using job.execute for production this is of course is a bug, but you can disable this behavior by application property:

spring:
  batch:
    job:
      enabled: false

@valb3r
Copy link
Owner

valb3r commented Oct 6, 2020

Here is the example project with the correct setup:

example.zip

@valb3r
Copy link
Owner

valb3r commented Oct 8, 2020

Done, to be released

@BugHunterPhilosopher
Copy link
Author

Thanks a lot, I'll try this. Sorry for the delay.

@BugHunterPhilosopher
Copy link
Author

Could you please cut a 1.0.4 release?

@valb3r valb3r added this to To do in Adapter v1.0 via automation Oct 8, 2020
@valb3r valb3r added the bug Something isn't working label Oct 8, 2020
@valb3r valb3r moved this from To do to Done in Adapter v1.0 Oct 8, 2020
@valb3r
Copy link
Owner

valb3r commented Oct 8, 2020

@BugHunterPhilosopher Done, release 0.1.4 is available in BinTray

@valb3r valb3r closed this as completed Oct 8, 2020
@BugHunterPhilosopher
Copy link
Author

Thanks a ton! I've just checked my batch with the 0.1.4 release and it all works. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Adapter v1.0
  
Done
Development

No branches or pull requests

2 participants