-
Notifications
You must be signed in to change notification settings - Fork 22
CodegenException when using TomcatEmbeddedWebappClassLoader (fx. Spring Boot) #42
Comments
Can you check this? Is it only happening with those JDKs? |
That package does exist. I have tried to unpack the jar just to check it, and it is there. I just tried to force our build process to update the docker image it uses(openjdk:8-jdk), and that changed the JDK to this:
But to no avail. It fails with the same exception.
|
Okay. I just extracted the Jar built for production and ran that locally... And it fails... Weird. If I built it with maven locally on 1.8.0_121(mac) and run it locally, there is not issue. If built it with 1.8.0_161(linux) and I run that locally, then it fails. |
I upgraded my mac to JDK 1.8.0_161 and still I am unable to reproduce it when I build i locally. I then tried to login to our build server(JDK 1.8.0_161 linux), checked out the code, did a fresh build(mvn clean install) and copied the jar-file to my local machine and it fails. So weird... I'll try to setup a virtual linux locally and reproduce it there. |
Yes please do, I can't fathom where it would go wrong but can go right in some cases. |
I think I found the source of the issue: classpath. This is the start of the resolved classpath when I run the project via spring-boot:run from intellij:
And this is the start of the classpath when I run the final artifact locally from the commandline (java -jar meerkat.jar):
Weird classpath
|
It comes down to codegen/src/main/java/com/mysema/codegen/SimpleCompiler.java Lines 71 to 72 in 60b65f9
The first URL retrieved in my case is At line 71 it is being decoded to At line 72 the absolute path becomes |
I am unable to make it work. The classloader is a TomcatEmbeddedWebappClassLoader which resolves jars in the executable jar(Fx. My knowledge about JavaCompiler and the codegen project is to sparse. I have been unable to create a fix. |
Yes the issue is known, I'll continue with my fix |
Thanks for looking into it though, much appreciated! |
@Shredder121 I just created a PR to add the support for Codegen to generate code when running in a fat JAR. It should fix this bug and others related to this. |
This issue is indeed fixed by #43. |
#43 was never accepted even after this many years. Is there any solution in sight or is building a custom jar still the only viable solution in order to use this with spring boot? |
Any updates here? |
@michaelkrog do you how to build custom jar to make it work on ubuntu/macos? |
I am having an issue wen running my application with QueryDSL on OpenJDK.
I have 2 classes that I generate QueryDsl classes for. One(
Project
) is a MongoEntity class that I annotated with @QueryEntity and the other(Service
) is a POJO also with @QueryEntity.I use
com.querydsl.apt.QuerydslAnnotationProcessor
for generating the classes.When I compile and run it locally everything works fine. This is using the following JDK:
But when built for production using this JDK:
...and then run in a container with this JDK:
...then I get this exception for the
Service
class, but not theProject
class:The text was updated successfully, but these errors were encountered: