Home > Enterprise >  Error running a Java 8 batch with a jdk17
Error running a Java 8 batch with a jdk17

Time:11-19

I'm trying to run a java 8 batch with a jdk17, the project is built with a jre1.8.0_192 and I put the following options in the VM:

--add-modules=ALL-SYSTEM --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.math=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=jdk.attach/sun.tools.attach=ALL-UNNAMED -Djava.locale.providers=JRE,SPI

I get the following error at runtime:

java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "obj" is null at java.lang.reflect.Method.invoke(Method.java:561) ~[?:?] at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) ~[spring-aop-4.3.25.RELEASE.jar:4.3.25.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) ~[spring-aop-4.3.25.RELEASE.jar:4.3.25.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.25.RELEASE.jar:4.3.25.RELEASE] at org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration$PassthruAdvice.invoke(SimpleBatchConfiguration.java:127) ~[spring-batch-core-3.0.10.RELEASE.jar:3.0.10.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.25.RELEASE.jar:4.3.25.RELEASE] at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) ~[spring-aop-4.3.25.RELEASE.jar:4.3.25.RELEASE]

Any ideas ? Thanks

CodePudding user response:

Spring 4.3 is compatible with Java 6 to 8, higher versions aren't tested and thus not supported.

For list of Spring versions with the JDK compatibility see the Spring/JDK Compatibility Matrix.

To run with JDK17 you would need to upgrade to Spring 5.3.

  • Related