Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Migrate RCP to Java11 using MOXy
Migrate RCP to Java11 using MOXy [message #1800703] Sun, 06 January 2019 09:38 Go to next message
Frank Benoit is currently offline Frank BenoitFriend
Messages: 179
Registered: July 2009
Senior Member
Hi

I try to migrate a Eclipse RCP application to run on Java 11 (before Java 8).
But with the xml unmarshalling, i have trouble.

I added some bundles to the target platform:
javax.activation (javax.activation-1.2.0.jar)
jaxb-api (jaxb-api-2.4.0-b180830.0359.jar)

In the dependencies I added:
Import-Package: com.sun.xml.bind;version="2.4.0",
javax.activation;version="1.2.0",
javax.xml.bind;version="[2.2.12,3.0.0)"

Then MOXy could not be seen on the classpath by javax.xml.bind.
So i changed the code to load MOXy directly:
JAXBContext.newInstance( castle.extdata.autosar.v4.ObjectFactory.class );
JAXBContextFactory.createContext( new Class[] { castle.extdata.autosar.v4.ObjectFactory.class }, null );

Now I get this new error:
[Exception [EclipseLink-25008] (Eclipse Persistence Services - 2.7.3.v20180807-4be1041): org.eclipse.persistence.exceptions.XMLMarshalException
Exception Description: A descriptor with default root element {http://autosar.org/schema/r4.0}AUTOSAR was not found in the project]

As the project was working before, i guess it is not really an issue with the generated objects or data, more likely with the configuration.

Can someone help?
Or is there a runnable RCP example, using MOXy unmarshalling objects, running with Java11?

thanks
Frank


Re: Migrate RCP to Java11 using MOXy [message #1800706 is a reply to message #1800703] Sun, 06 January 2019 15:40 Go to previous messageGo to next message
Frank Benoit is currently offline Frank BenoitFriend
Messages: 179
Registered: July 2009
Senior Member
Hi

I created a minimal example project with data file, see attachment.
Run the "Test2" button on the toolbar.

To have it working, i used
- targetplatform of Eclipse 4.10,
- EclipseLink 2.7.3
- OpenJDK 11.0.1,
- javax.activation-1.2.0.jar
- jaxb-api-2.4.0-b180830.0359.jar
- jaxb-osgi-2.4.0-b180830.0438.jar

The J11.product.launch configuration lists the applied bundles.
The libs/autosar-jaxbobjs.jar contains the generated classes from the schema.

The exception i get with this:
[Exception [EclipseLink-25008] (Eclipse Persistence Services - 2.7.3.v20180807-4be1041): org.eclipse.persistence.exceptions.XMLMarshalException
Exception Description: A descriptor with default root element {http://autosar.org/schema/r4.0}AUTOSAR was not found in the project]

The same logic and generated objects work for me with Java8.

Can someone help please to make this work with Java 11?

thanks
Frank


  • Attachment: J11.zip
    (Size: 8.02MB, Downloaded 240 times)
Re: Migrate RCP to Java11 using MOXy [message #1800751 is a reply to message #1800703] Mon, 07 January 2019 19:28 Go to previous message
Frank Benoit is currently offline Frank BenoitFriend
Messages: 179
Registered: July 2009
Senior Member
I was able to solve it.

1.
I removed the jaxb-osgi-2.4.0-b180830.0438.jar from the target platform.
Only added:
- javax.activation-1.2.0.jar
- jaxb-api-2.4.0-b180830.0359.jar

2.
Every bundle using Jaxb having the Require-Bundles:
-javax.xml.bind
-moxy

3.
And then i had the error about @XmlValue in derived classes.
I added the line:
System.setProperty(MOXySystemProperties.XML_VALUE_EXTENSION, "true");
before using the JAXBContextFactory.createContext(...).

Frank
Previous Topic:createNativeQuery : Exception [EclipseLink-4002]
Next Topic:Force eclipselink to avoid pulling the same object on separate queries on the same entity
Goto Forum:
  


Current Time: Wed Sep 25 17:23:19 GMT 2024

Powered by FUDForum. Page generated in 0.03040 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top