This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Services and the fly likes ANT build script fails with JAXB classes in use Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "ANT build script fails with JAXB classes in use" Watch "ANT build script fails with JAXB classes in use" New topic
Author

ANT build script fails with JAXB classes in use

Lokesh Pahadi
Greenhorn

Joined: Jan 09, 2005
Posts: 21
Hi All,

I have installed Weblogic SP3. I am trying to make a Web Service which uses JAXB to convert xml into Java Objects. My Web Service is a simple Java class which I compile in Eclipse 3.1. Because I am using JAXB so I created my Project in Eclipse and I set the 'project specific complaince' to 5.0 as it is required for working with JAXB classes.

Problem:
Once I have compiled my project successfully, I copy my classes to a folder from where I am running my Ant build script to generate the web-services.xml. The script is as follows:

<project name="buildWebservice" default="generate-typeinfo">
<target name="generate-typeinfo">
<source2wsdd
javaSource="com/services/BaseWebServiceSimulator.java"
ddFile="ddfiles/web-services.xml"
serviceURI="/MyService" />
</target>
</project>

The classes generated from the xsd by using JAXB are also in the same folder under the directories com/vipul/jaxb/appdefaults.

But when I run this script it gives me the following error:

C:\>cd webservice

C:\webservice>ant
Buildfile: build.xml

generate-typeinfo:
[source2wsdd] Loading source file C:\webservice\com\services\BaseWebServiceSimulator.java...
[source2wsdd] Constructing Javadoc information...
[source2wsdd] C:\webservice\com\services\BaseWebServiceSimulator.java:8: package javax.xml.bind does not exist
[source2wsdd] import javax.xml.bind.JAXBContext;
[source2wsdd] ^
[source2wsdd] C:\webservice\com\services\BaseWebServiceSimulator.java:9: package javax.xml.bind does not exist
[source2wsdd] import javax.xml.bind.Unmarshaller;
[source2wsdd] ^
[source2wsdd] source2wsdd: In doclet class weblogic.webservice.tools.ddgen.ServiceGen, method start has thrown an exception jav
reflect.InvocationTargetException
[source2wsdd] java.lang.UnsupportedClassVersionError: com/services/BaseWebServiceSimulator (Unsupported major.minor version 49.0
[source2wsdd] at java.lang.ClassLoader.defineClass0(Native Method)
[source2wsdd] at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
[source2wsdd] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
[source2wsdd] at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
[source2wsdd] at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
[source2wsdd] at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
[source2wsdd] at java.security.AccessController.doPrivileged(Native Method)
[source2wsdd] at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
[source2wsdd] at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
[source2wsdd] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
[source2wsdd] at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
[source2wsdd] at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
[source2wsdd] at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:223)
[source2wsdd] at weblogic.xml.schema.binding.util.ClassUtil.loadNonArrayClass(ClassUtil.java:95)
[source2wsdd] at weblogic.xml.schema.binding.util.ClassUtil.loadClass(ClassUtil.java:72)
[source2wsdd] at weblogic.webservice.tools.ddgen.ServiceGen.canCreate(ServiceGen.java:252)
[source2wsdd] at weblogic.webservice.tools.ddgen.ServiceGen.populateComponent(ServiceGen.java:232)
[source2wsdd] at weblogic.webservice.tools.ddgen.ServiceGen.populateWebServices(ServiceGen.java:168)
[source2wsdd] at weblogic.webservice.tools.ddgen.ServiceGen.generate(ServiceGen.java:98)
[source2wsdd] at weblogic.webservice.tools.ddgen.ServiceGen.start(ServiceGen.java:325)
[source2wsdd] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[source2wsdd] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[source2wsdd] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[source2wsdd] at java.lang.reflect.Method.invoke(Method.java:324)
[source2wsdd] at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:193)
[source2wsdd] at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:92)
[source2wsdd] at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:311)
[source2wsdd] at com.sun.tools.javadoc.Start.begin(Start.java:121)
[source2wsdd] at com.sun.tools.javadoc.Main.execute(Main.java:65)
[source2wsdd] at weblogic.ant.taskdefs.webservices.autotype.JavaSource2DD.runJavadoc(JavaSource2DD.java:293)
[source2wsdd] at weblogic.ant.taskdefs.webservices.autotype.JavaSource2DD.execute(JavaSource2DD.java:150)
[source2wsdd] at org.apache.tools.ant.Task.perform(Task.java:341)
[source2wsdd] at org.apache.tools.ant.Target.execute(Target.java:309)
[source2wsdd] at org.apache.tools.ant.Target.performTasks(Target.java:336)
[source2wsdd] at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
[source2wsdd] at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
[source2wsdd] at org.apache.tools.ant.Main.runBuild(Main.java:609)
[source2wsdd] at org.apache.tools.ant.Main.start(Main.java:196)
[source2wsdd] at org.apache.tools.ant.Main.main(Main.java:235)
[source2wsdd] 1 error
[source2wsdd] 2 warnings

BUILD FAILED
file:C:/webservice/build.xml:6: javadoc execution failed

Total time: 1 second
C:\webservice>


It gives me an error "package javax.xml.bind does not exist". I don't know why. I even copied the jar file "jaxb-api.jar" that is installed when we install Java Web Service Pack 2.0 in the same directory where I am running my build script, but it still gives me the same error. I also tried exploding the jar files into the same directory but still the error persists.

Can someone give me a clue as to what is happening?

Thanks in advance!
Yassine Lajmi
Greenhorn

Joined: Oct 11, 2002
Posts: 9
java.lang.UnsupportedClassVersionError: com/services/BaseWebServiceSimulator (Unsupported major.minor version 49.0
[source2wsdd] at java.lang.ClassLoader.defineClass0(Native Method)



Hi,

The Java version your are using is older than the one used to build BaseWebServiceSimulator.

Regards


SCJP<br />SCJD<br />SCBCD<br />SCWCD<br />OCA 9i
 
 
subject: ANT build script fails with JAXB classes in use
 
Similar Threads
Eclipse problem with generate javadoc
Ant error on trying to run an taskdef
Problem in creating web-services.xml
ejbGen help
Generating Webservice with Ant. Source2wsdd