Getting error with ExpressionEvaluatorFactoryHolder docker #276
-
Hello I work with jxls for generating excel from template. It work well on my machine until it get deploy to docker it alway got error "[onPool-worker-2] k.g.n.e.handler.GlobalErrorAttributes : java.lang.NullPointerException: Cannot invoke "org.jxls.expression.ExpressionEvaluatorFactory.createExpressionEvaluator(String)" because the return value of "org.jxls.util.JxlsHelper$ExpressionEvaluatorFactoryHolder.access$100()" is null" is there any additional configuration I need to add to make this work? Thanks you. |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 23 replies
-
I guess I have never tried it with Docker. There is a special service loading mechanism. Please check if the file org.jxls.expression.ExpressionEvaluatorFactory is in the Docker container. It should be in the jxls jar, folder META-INF/services. |
Beta Was this translation helpful? Give feedback.
-
We have the same issue when we package our app with spring-boot-maven-plugin. All is well if app is started directly in IntelliJ. However if we start the packaged app we get the error. jdk 17 If we use maven-assembly-plugin with descriptorRef jar-with-dependencies for packaging the app, the error does not occur. But we do not know why this solves the issue. |
Beta Was this translation helpful? Give feedback.
-
I guess this problem is Spring Boot specific. The jxls JAR files must be unpacked (=not inside a fat JAR). I don't know how this is done with Maven. |
Beta Was this translation helpful? Give feedback.
-
I noted the issue is when building .jar file not exactly docker.
do you think it could be because of this ? |
Beta Was this translation helpful? Give feedback.
-
The real issue is because of async I use reactive when the generating file outside reactive function and the issue is gone I tried with @async annotation with CompletableFuture also meet this issue. |
Beta Was this translation helpful? Give feedback.
-
For me the issue occurred in an async context with Spring's @async annotation and only when running the fat jar packaged with spring-boot-maven-plugin. I solved it by replacing this:
with that:
The I got the idea from here: https://stackoverflow.com/questions/1771679/difference-between-threads-context-class-loader-and-normal-classloader |
Beta Was this translation helpful? Give feedback.
-
When will this problem be fixed? When will the be release be? |
Beta Was this translation helpful? Give feedback.
When will this problem be fixed? When will the be release be?