Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dali » Unable to generate JAXB classes(Using Jdk 1.6 xjcfacade not flound)
Unable to generate JAXB classes [message #662270] Wed, 30 March 2011 00:43 Go to next message
Michael Giroux is currently offline Michael Giroux
Messages: 78
Registered: July 2009
Location: Phoenix, AZ
Member
I'm attempting to generate JAXB classes from an XSD. When I right-click the schema and select the Generate->JAXB Classes, I get the following error on the console.

java.lang.NoClassDefFoundError: com/sun/tools/xjc/XJCFacade
Caused by: java.lang.ClassNotFoundException: com.sun.tools.xjc.XJCFacade
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301 )
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

I've been digging through Eclipse docs for better part of a day now, and cannot find anything that suggests that I need to do anything special to Generate JAXB Classes.

Config:
Version: Helios Service Release 2 Java EE version.
Build id: 20110218-0911

EclipseLink SDK 2.2.0 (not sure if I need this or not)

JDK 1.6.0_24

Can someone point me to docs that explain where XJCFacade is and how to install it into eclipse?

Thanks
Michael
Re: Unable to generate JAXB classes [message #662502 is a reply to message #662270] Wed, 30 March 2011 20:30 Go to previous messageGo to next message
Neil Hauge is currently offline Neil Hauge
Messages: 469
Registered: July 2009
Senior Member
Michael,

Docs are currently lacking for this feature. This should be resolved in the upcoming release. The issue is that the XJC compiler isn't on the default jdk classpath. The easiest thing to do if you intend to use EclipseLink JAXB (MOXy) is to grab a couple of jars from EclipseLink jlib and put them into your project classpath. These jars are found under 'eclipselink\jlib\moxy'. The jars you need are most likely:

com.sun.tools.xjc_2.2.0.jar
com.sun.xml.bind_2.2.0.v201004141950.jar

If you were using JDK 1.5 or less you would need to add javax.xml.bind and javax.xml.stream as well, but this shouldn't be necessary in your case.

Neil
Re: Unable to generate JAXB classes [message #662507 is a reply to message #662502] Wed, 30 March 2011 20:58 Go to previous messageGo to next message
Michael Giroux is currently offline Michael Giroux
Messages: 78
Registered: July 2009
Location: Phoenix, AZ
Member
Thanks for the help.

Will these jars be moved into an update of Dali and exposed as a Library? It seems strange that the standard Eclipse J2EE install gives me a Generate / JAXB Classes menu, and does not provide the libraries needed to support it.

I do not mind enabling a library for my build path, but at the moment, the library is not defined. It is up to me to locate the jars and define the library.

Would be a little easier if I could just add a predefined library to the build path.

Let me know if this is not planned, and I'll post a feature request.

Michael
Re: Unable to generate JAXB classes [message #662739 is a reply to message #662507] Thu, 31 March 2011 17:46 Go to previous messageGo to next message
Neil Hauge is currently offline Neil Hauge
Messages: 469
Registered: July 2009
Senior Member
Michael,

My verbose reply to your last post was apparently lost by the forums so apologies if this response is brief.

We have considered shipping a version of these libraries with the IDE in the past. The benefit to this would be the usability improvements that you describe. The negative aspect would be the lack of flexibility that this solution provides. On some occasions you may need to generate with an older version or a newer version of JAXB that has a bug fix you may require. The ideal solution would probably be to have both as options (use the IDE shipped libs or provide your own libs).

For Indigo (3.7) we have introduced a JAXB facet, which provides better usability in configuring your JAXB libraries. The up-front library configuration helps you configure the necessary libraries for JAXB. It also provide a downloadable library feature, which allows a user to download a particular version of EclipseLink (with JAXB) and then configures the library automatically on your build path. This solves much of the current usability issue around JAXB tools.

So, I think we have a better library configuration method for Indigo, but please feel free to enter a specific feature request for shipping a version of these libraries with the IDE.

Neil
Re: Unable to generate JAXB classes [message #700735 is a reply to message #662739] Sun, 24 July 2011 00:06 Go to previous messageGo to next message
Dan  is currently offline Dan
Messages: 2
Registered: July 2011
Junior Member
I'm not sure whats up, but I have added the jars to my system classpath, and as well as the projects class path..and still whenever I:

Right click xsd file, select generate ->JAXB classes, check: Use EclilpseLink MOXy as..

I still get the error:
Caused by: java.lang.ClassNotFoundException: org.eclipse.persistence.jaxb.xjc.MOXyXJC
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Exception in thread "main"

what I'm I missing?

I've tried this with both helios and indigo..still no cigar...
Re: Unable to generate JAXB classes [message #700738 is a reply to message #700735] Sun, 24 July 2011 00:14 Go to previous message
Dan  is currently offline Dan
Messages: 2
Registered: July 2011
Junior Member
well I was finally able to find:

http: // java.net/downloads/jaxb-workshop/IDE%20plugins/org.jvnet.jaxbw.zip

which is working just fine for my purposes.
Previous Topic:JPA 2.0 metamode gen and orm.xml
Next Topic:JPA Diagram editor 0.5.0 not working with Graphiti 0.8.0
Goto Forum:
  


Current Time: Fri Oct 24 15:29:09 GMT 2014

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

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