Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dali » Unable to generate JAXB classes(Unable to find the main class: java.util.Arrays.useLegacyMergeSort=true)
Unable to generate JAXB classes [message #804386] Wed, 22 February 2012 15:14 Go to next message
Terry Birch is currently offline Terry Birch
Messages: 14
Registered: May 2010
Location: SC
Junior Member
I am trying to generate the jaxb classes in eclipse from a xsd file and am getting the error: Could not find the main class: java/util/Arrays/useLegacyMergeSort=true. This is with Indigo, windows vista, java version 7 and as far as I know I am using the latest updates for all. I had been generating the jaxb classes okay on this machine a few months ago. I tried adding -Djava.util.Arrays.useLegacyMergeSort=true to my eclipse.ini but with no luck. Any suggestions please?
Re: Unable to generate JAXB classes [message #804446 is a reply to message #804386] Wed, 22 February 2012 16:31 Go to previous messageGo to next message
Neil Hauge is currently offline Neil Hauge
Messages: 469
Registered: July 2009
Senior Member
Interesting...I'll see if I can reproduce this. Some questions...Have you changed your project's JRE recently? What JAXB version are you using in this project (take a look at the facet info in the project properties).

Neil
Re: Unable to generate JAXB classes [message #804471 is a reply to message #804446] Wed, 22 February 2012 17:01 Go to previous messageGo to next message
Terry Birch is currently offline Terry Birch
Messages: 14
Registered: May 2010
Location: SC
Junior Member
Thanks Neil.
I have to use 1.6 in my projects properties because of the system I will be deploying to. I just tried switching the eclipse preferences jre option from 1.6. to 1.7 and still get the same error.Here is the console output when trying to generate the jaxb classes:
java.lang.NoClassDefFoundError: java/util/Arrays/useLegacyMergeSort=true
Caused by: java.lang.ClassNotFoundException: java.util.Arrays.useLegacyMergeSort=true
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"

I am using jaxb-api-2.2.jar and jaxb-impl--2.2.1.1.jar in my project libraries.

[Updated on: Wed, 22 February 2012 19:12]

Report message to a moderator

Re: Unable to generate JAXB classes [message #805263 is a reply to message #804471] Thu, 23 February 2012 15:00 Go to previous messageGo to next message
Terry Birch is currently offline Terry Birch
Messages: 14
Registered: May 2010
Location: SC
Junior Member
In the Edit Launch configuration properties window for the JAXB Run Config, the Bootstrap Entries has one entry which is JRE System Library [jre6]. I have tried taking this out and adding jre7. It appears to accept that change and if I finish the prompts and go back in and check, it does shows jre7. However, if I then try to run the Generate JAXB classes process, I still get the error as described in my earlier emails. And then going back into the JAXB Run Config and checking, the jre6 is back in the Bootstrap Entries, not the jre7 which I had just put in. Could it be that my project is corrupted? I did create a brand new project and the Generate JAXB option works just fine. Do I need to delete my project and start over from scratch (which will be a pain)?
Re: Unable to generate JAXB classes [message #805307 is a reply to message #804471] Thu, 23 February 2012 16:03 Go to previous messageGo to next message
Neil Hauge is currently offline Neil Hauge
Messages: 469
Registered: July 2009
Senior Member
It sounds like there might be some cached settings that are causing a problem, but I think we should make sure this workaround is reasonable. Running JAXB 2.2 in Java 1.6 can be problematic, and requires special JRE configuration. As long as you are generating 2.2 classes in Dali, and running 2.2 in production, that should be OK, but running newer JAXB generated code in older (1.6 embedded JAXB 2.1) could cause problems.

Dali will recreate the launch config with each run, so that would explain why your changes aren't sticking around. Dali will use the execution environment specified for the particular project it is running in, so I assume that it is set to 1.6 in this case, and as a result we will use 1.6. This is because as I mentioned before, the generation is sensitive to JDK and JAXB levels. Since you are actually trying to use JAXB 2.2 libs, they may have a runtime dependency on Java 7, which perhaps results in the error you are seeing when running against 1.6.

Neil
Re: Unable to generate JAXB classes [message #805350 is a reply to message #805307] Thu, 23 February 2012 16:59 Go to previous messageGo to next message
Terry Birch is currently offline Terry Birch
Messages: 14
Registered: May 2010
Location: SC
Junior Member
Neil,
I have started the process of recreating my project and so far I can generate the jaxb classes okay. I was not familiar with how to remove any cached settings so I did not try that. Do I hear you saying that I might not want to be using jaxb 2.2 in the java 1.6 environment?
Re: Unable to generate JAXB classes [message #805462 is a reply to message #805350] Thu, 23 February 2012 20:01 Go to previous message
Neil Hauge is currently offline Neil Hauge
Messages: 469
Registered: July 2009
Senior Member
That's correct. Please see the bug below for more info on running JAXB 2.2 with 1.6. It is certainly possible, but does involve making some changes to the JRE. That said, I have not had much success making this configuration work inside of Eclipse.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=345453

Also, with JAXB it's important to understand your deployment environment when generating classes. You could end up generating classes that don't work if you generate with JAXB 2.2 and deploy to a JAXB 2.1/JRE 1.6 environment.

Neil
Previous Topic:Sybase ASE 15: User data types mapped to java Object type
Next Topic:Eclipse JPA problem on a named query that doesn't have a problem
Goto Forum:
  


Current Time: Tue Sep 30 20:10:50 GMT 2014

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

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