user3572079
user3572079

Reputation: 135

Using EclipseLink (MOXy) in Eclipse

I'm writing a Java program that uses JAXB to create XML files from a given XSD and am using Eclipse for the first time. I have also downloaded EclipseLink to use within Eclipse as I want to use MOXy as my JAXB provider. Unfortunately, I'm not sure if I'm using it correctly. I've read various documentation, blogs and forums which mentions various techniques but as I'm new to it, I'm not sure if my understanding is correct. Can someone enlighten me please?

I understand that MOXy is an alternative JAXB implementation to the Reference Implementation and as such has features that could be useful above those found in the Reference Implementation. With this in mind, I downloaded EclipseLink and placed the eclipselink.jar in my classpath and added the jaxb.properties file in my package. Under the eclipselink\jlib folder there is another folder called moxy that contains 6 jar files, what are these for and do I also need to include them in my classpath?

The generated JAXB classes from Eclipse have automatically generated comments at the top of the files. These comments mention that they were generated by the Reference Implementation and not MOXy. Should I expect the JAXB classes to be generated by MOXy and not the JAXB Reference Implementation?

Thx

Upvotes: 2

Views: 1963

Answers (1)

bdoughan
bdoughan

Reputation: 149047

I understand that Moxy is an alternative JAXB implementation to the Reference Implementation and as such has features that could be useful above those found in the Reference Implementation.

MOXy and the JAXB reference implementation (RI) are both implementations of JSR-222, and pass the same compliance test suites. Anywhere the RI is used MOXy could be used instead without impacting any users. For example WebLogic now uses MOXy as the default JAXB provider and you can configure it to use the RI as an alternate provider.

Under the eclipselink\jlib folder there is another folder called moxy that contains 6 jar files, what are these for and do I also need to include them in my classpath?

The jlib/moxy folder contains the implementation of XJC which is called from our bin/jaxb-compiler.sh script as well as some supported libraries for those people using versions of Java prior to Java SE 6.

The generated JAXB classes from Eclipse have automatically generated comments at the top of the files. These comments mention that they were generated by the Reference Implementation and not Moxy. Should I expect the JAXB classes to be generated by Moxy and not the JAXB Reference Implementation?

MOXy leverages the XJC (XML Schema to Java Compiler) from the JAXB reference implementation. This is why you see the comments in the generated comments. XJC is a very nice component with a lot of useful community contributed extensions, so we didn't invent our own.

Upvotes: 1

Related Questions