I'm trying to develop a new webservice using JAX-WS and JAXB annotations. When I deploy the .jar in axis2 and open the browser to retrieve the generated .wsdl I get the following error:
[ERROR] Error occurred generating WSDL file for Web service implementation class {foo.bar.myServiceImpl}
java.lang.NoClassDefFoundError: com/sun/xml/ws/api/server/Container
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.generateWsdl(JAXWSRIWSDLGenerator.java:179)
at org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.initialize(JAXWSRIWSDLGenerator.java:390)
at org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.getWSDL(JAXWSRIWSDLGenerator.java:383)
at org.apache.axis2.description.AxisService.printWSDL(AxisService.java:1394)
at org.apache.axis2.transport.http.HTTPWorker.service(HTTPWorker.java:154)
at org.apache.axis2.transport.http.server.AxisHttpService.doService(AxisHttpService.java:281)
at org.apache.axis2.transport.http.server.AxisHttpService.handleRequest(AxisHttpService.java:187)
at org.apache.axis2.transport.http.server.HttpServiceProcessor.run(HttpServiceProcessor.java:82)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.sun.xml.ws.api.server.Container
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)
... 15 more
Digging in the source, i notice that the com.sun.xml.ws.api.server.Container is part of the jaxws-rt implementation, which is not part of the Axis2 distribution (could not find it in the /lib/ folder). Why is this? Am I missing a point here?
I had the same problem. I need to add dependecies to jaxws-maven-plugin. Without these dependecies it throws me the same error
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<configuration>
<wsdlDirectory>src/main/resources/wsdl/</wsdlDirectory>
<keep>true</keep>
<sourceDestDir>${project.build.directory}/generated-sources/wsimport</sourceDestDir>
<sei></sei>
</configuration>
<dependencies>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.1.4</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-tools</artifactId>
<version>2.1.4</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>generate-from-wsdl</id>
<goals>
<goal>wsimport</goal>
</goals>
</execution>
</executions>
</plugin>
Ok, got it. I'll post the answer to avoid anybody else banging his (or her) head to the wall.
I had an old JAVA_HOME environment variable set on my system. This pointed to the installer JRE, but it needs to point to the installed JDK. That's all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With