Intershop studio 4.20.0 - compileJava - ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory

307 views Asked by At

I am having troubles compiling java after upgrading to Intershop studio 4.20.0. The message that I get is

javax.xml.bind.JAXBException
- with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory]
    at     com.intershop.beehive.pipeline.internal.definition.PipelineNodeDefinitionSerializer.serialize(PipelineNodeDefinitionSerializer.java:38)
    ... 42 more
Caused by: java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory

After Googling this message I found it is related to building with Java 11 and I see that studio uses plugin JRE v11 specified in IntershopStudio.ini.

I have tried setting explicit JDK path in my user folder gradle.properties (didn't help) then in Window -> Preferences -> Gradle -> Arguments which also didn't help. Compile error and JDK configuration

I have also tried setting JDK in IntershopStudio.ini but it won't start because it requires at least version 11.

Please not that Gradle tasks work when run from command-line, that is why I believe it is studio specific.

Please advise on how to resolve this problem.

2

There are 2 answers

0
Goran Petanjek On BEST ANSWER

I don't know root cause for this (also happens to me). But you can use workaround by setting system property 'javax.xml.bind.context.factory' to 'com.sun.xml.internal.bind.v2.ContextFactory'. This can be done in multiple ways but I found that setting it in gradle.properties is easiest, so just append following line to your gradle.properties file:

systemProp.javax.xml.bind.context.factory=com.sun.xml.internal.bind.v2.ContextFactory

After this gradle builds from Studio should be working again.

0
Vankog On

First, make sure to set a proper JDK 11 for the JVM in the IntershopStudio.ini. The embedded JDK is not suitable for many use cases.

Second, make sure to open the studio via the developer shell (gradle_environment.bat|sh), which provides your correct JAVA_HOME for building (if you deployed a server). Alternatively, set gradle_environment.bat|sh or the server installation in the Intershop preferences of the studio.

Third, make sure your JDK runtime preferences are defaulting to JDK 8 (usually Server JDK). (should be bold)

Lastly, making sure that your gradle settings use the wrapper should suffice.