users@jaxb.java.net

Re: JAXB 2.1.8 XJCTask issue with source="1.0"

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Fri, 12 Sep 2008 19:33:22 +0200

This is how I use 2.1.7 with jdk1.6.0 with ant to run xjc
for simple experiments. It also works with 2.1.8.
My current Java is jdk1.6.0_03.

Let's say that JAXB_HOME is /extra/jaxb-ri-2.1.8
Create a directory $JAXB_HOME/samples/foo, copy your
schema file into it and create a build.xml according
to the one in some sibling directory (unmarshal-validate
contains a simple one).

Calling ant should compile the schema.

Notice that for running your application after compiling
everything you will have to call java like this:

   java -Djava.endorsed.dirs=/extra/jaxb-ri-2.1.8/lib ...

If this works for you, then you should be able to set
things up at some other place as well.

-W



On Fri, Sep 12, 2008 at 6:09 PM, Philip A. Culver <
pculver_at_bostonatlantic.net> wrote:

> Yes it is. Some additional information I have found: The code
> compiles and generated correctly with Java 1.5 and Jaxb 2.1.8 with
> source="1.0". I think the problem is Java 1.6. I am using JDK 1.6.0_07
> which comes with Jaxb 2.1.3 albeit with class packages renamed. Was the
> XJCTask class package renamed in that JDK? I am guessing not because I saw
> a mail message in the archive from Kohsuke that the problem I am
> experiencing was a bug in 2.1.3. Is there any way to force the JDK to
> use the XJCTask instance from the classpath and not the JDK itself?
>
>
>
> Thanks,
> Phil
>
>
> ------------------------------
>
> *From:* Wolfgang Laun [mailto:wolfgang.laun_at_gmail.com]
> *Sent:* Friday, September 12, 2008 4:16 AM
> *To:* users_at_jaxb.dev.java.net
> *Subject:* Re: JAXB 2.1.8 XJCTask issue with source="1.0"
>
>
>
> Is the jaxb1-impl.jar that comes with JAXB 2.x in your classpath?
> -W
>
> On Fri, Sep 12, 2008 at 3:10 AM, Philip A. Culver <
> pculver_at_bostonatlantic.net> wrote:
>
> Hello,
>
>
>
> I am attempting to migrate to JAXB 2.1.8 from JAXB 1.0. I initially need
> to compile and run the code using the 1.0 source/target attributes of
> jaxb. However I can not compile my schema in this manner. I get the error
> at the bottom of this email while using JDK 1.6.0_07 and jaxb 2.1.8:
>
>
>
> I thought this might be a problem in my code so I modified the build.xml
> for the sample project: datatypeconverter so that the xjc execution had the
> attributes source="1.0" and target="1.0" and received the same error as
> earlier. I don't know if I am doing something run. Some web searches seem
> to indicate this was a bug in 2.1.3 but was supposedly fixed. FYI: My
> schema compiles correctly in jaxb 2.0.5 with the source="1.0" attribute.
>
>
>
> java.lang.NoClassDefFoundError: com/sun/xml/bind/JAXBAssertionError
>
> at java.lang.Class.forName0(Native Method)
>
> at java.lang.Class.forName(Class.java:169)
>
> at com.sun.tools.xjc.Options.class$(Options.java:154)
>
> at com.sun.tools.xjc.Options.findServices(Options.java:482)
>
> at com.sun.tools.xjc.Options.<clinit>(Options.java:154)
>
> at com.sun.tools.xjc.XJCTask.<init>(XJCTask.java:49)
>
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>
> at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>
> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>
> at java.lang.Class.newInstance0(Class.java:355)
>
> at java.lang.Class.newInstance(Class.java:308)
>
> at
> com.sun.istack.tools.ProtectedTask.execute(ProtectedTask.java:49)
>
> at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>
> at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
>
> at
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
>
> at org.apache.tools.ant.Task.perform(Task.java:348)
>
> at org.apache.tools.ant.Target.execute(Target.java:357)
>
> at org.apache.tools.ant.Target.performTasks(Target.java:385)
>
> at
> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
>
> at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
>
> at
> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
>
> at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
>
> at org.apache.tools.ant.Main.runBuild(Main.java:758)
>
> at org.apache.tools.ant.Main.startAnt(Main.java:217)
>
> at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
>
> at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
>
> Caused by: java.lang.ClassNotFoundException:
> com.sun.xml.bind.JAXBAssertionError
>
> at
> com.sun.istack.tools.ParallelWorldClassLoader.findClass(ParallelWorldClassLoader.java:71)
>
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>
>
>
>
>
> Thanks,
>
> Phil
>
>
>
>
>