eclipse-efx / efxclipse-rt

Eclipse Public License 1.0
28 stars 29 forks source link

Make JAXB within org.eclipse.fx.core work with Java 11 #419

Open christian-baumann opened 3 years ago

christian-baumann commented 3 years ago
ShawnKleese commented 3 years ago

Is this the Reason for my ClassNotFoundException, when i want to use the 'PerspectiveSwitcherComponent'?

I have used the newest Nighly from http://download.eclipse.org/efxclipse/runtime-nightly/site but i'm getting this Exception?

Should this Error not removed with this PR ?

`!MESSAGE Unable to create class 'org.eclipse.fx.ui.workbench.fx.perspective.PerspectiveSwitcherComponent' from bundle '177' !STACK 0 org.eclipse.e4.core.di.InjectionException: org.eclipse.e4.core.di.InjectionException: java.lang.RuntimeException: javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.

tomsontom commented 3 years ago

My wild guess is that your target does not contain JAXB libs. You need to add them yourself.

ShawnKleese commented 3 years ago

I have added the dependencies to my target and my Launch-Config:

jaxb-api, com.sun.xml.bind.jaxb-core, com.sun.xml.bind.jaxb-impl

tomsontom commented 3 years ago

from orbit or from where did you get them - @christian-baumann correct me but i think in our customer projects we added:

from orbit

christian-baumann commented 3 years ago

In order to make JAXB work with Java 11 two things are necessary:

  1. As e(fx)clipse is still compiled with JDK 1.8 you have to make JAXB avaiable within your Application-Target. The easiest way is to use the Orbit P2 reposity: https://download.eclipse.org/tools/orbit/downloads/ You will need to bundles javax.xml.bind and com.sun.xml.bind.
  2. You have to configure the FQN of the JAXB ContextFactory by setting the system property javax.xml.bind.JAXBContext. This can be done by starting your application with the VM argument -Djavax.xml.bind.JAXBContext=com.sun.xml.bind.v2.ContextFactory. We cannot set this over a jaxb.properties file within e(fx)clipse as it still has to be compatible with Java 1.8 and, as you can see in your stack trace, the ContextFactory package has changed from com.sun.xml.internal.bind.v2 to com.sun.xml.bind.v2.
ShawnKleese commented 3 years ago

Thanks for your comments. I have tried to follow your recommendations, but the Problem is the same. Because we use in our app json and no xml and the only reason to i want to add is the PerspectiveSwitcherComponent i have decided to stop more wasting time and build my own PerspectiveSwitcher.