users@jaxb.java.net

2nd try: generating and compiling jaxb 1.0 source with jaxb 2.0 binaries

From: edward pedersson <cpsmadness_at_googlemail.com>
Date: Thu, 24 May 2007 15:38:15 +0100

Hi

I sent this a few days ago and there was no reply. Does anyone know if
v 2.13 is backwards compatible in terms of generating the source files
for version 1 and also compiling and deploying the code?

Many thanks for your help

---------- Forwarded message ----------
From: edward pedersson <cpsmadness_at_googlemail.com>
Date: 22-May-2007 13:50
Subject: compiling jaxb 1.0 with jaxb 2.0
To: JAXB Users <users_at_jaxb.dev.java.net>


Hi

I am developing a project that needs to use jaxb 1.0 and jaxb 2.0 for
legacy reasons. I have downloaded 2.1.3 an managed to use xjc to
generate the new code (2.1) but when I try and generate the 1.0
classes I get this error

java.lang.NoClassDefFoundError: com/sun/xml/bind/JAXBAssertionError
       at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1225)
       at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
       at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultEx
cutor.java:40)
       at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
       at org.apache.tools.ant.Main.runBuild(Main.java:668)
       at org.apache.tools.ant.Main.startAnt(Main.java:187)
       at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
       at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: java.lang.NoClassDefFoundError: com/sun/xml/bind/JAXBAssertionError
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:164)
       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(NativeConstruc
orAccessorImpl.java:39)
       at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Delegating
onstructorAccessorImpl.java:27)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
       at java.lang.Class.newInstance0(Class.java:350)
       at java.lang.Class.newInstance(Class.java:303)
       at com.sun.istack.tools.ProtectedTask.execute(ProtectedTask.java:49)
       at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
       at org.apache.tools.ant.Task.perform(Task.java:364)
       at org.apache.tools.ant.Target.execute(Target.java:341)
       at org.apache.tools.ant.Target.performTasks(Target.java:369)
       at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)


And this is the ant build file

<?xml version="1.0" encoding="windows-1252"?>
<project name="jaxb" default="compile" basedir=".">

<path id="classpath">
<pathelement location="activation.jar"/>
<pathelement location="jaxb-api.jar"/>
<pathelement location="jaxb-impl.jar"/>
               <pathelement location="jaxb1-impl.jar"/>
<pathelement location="jaxb-xjc.jar"/>
               <pathelement location="jsr173_1.0_api.jar"/>
</path>

<taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
<classpath refid="classpath"/>
</taskdef>

       <target name="compile">
               <xjc schema="import.xsd" destdir="generated"
package=".jaxb.importxsd" source="1.0" target="1.0" />
</target>
</project>


I have checked the classpath and there is nothing untoward there and
all the jars are in the same folder as the ant file. I thought jaxb
2.1 is meant to be backwards compatible?

many thanks for your help
--
-- e
-- 
-- e