Search code examples
javagradleintershop

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


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.


Solution

  • 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.