0 Replies Latest reply on Feb 19, 2008 6:38 AM by ollie1979

    WSProvideTask throws NoClassDefFoundError while class in cla

    ollie1979

      Hi,

      I am new to JBoss and web services so bear with me. I'm trying to generate artifacts for my web service using the wsprovide tool/ant task and I keep getting exceptions.

      This is my web service:

      package helloworld;
      
      import javax.jws.WebService;
      
      import org.springframework.beans.factory.annotation.Autowired;
      import org.springframework.web.context.support.SpringBeanAutowiringSupport;
      
      @WebService
      public class HelloWorld extends SpringBeanAutowiringSupport {
      
       @Autowired
       private MessageProvider messageProvider ;
      
       public String sayHello(String name) {
       return messageProvider.getMessage() + " " + name ;
       }
      }


      I'm deploying this on JBoss using the Eclipse WTP plugin and it works fine. My client can call this web service without a problem. However, I would like to generate the web service artifacts myself (instead of letting JBoss take care of it) and my Ant script keeps throwing exceptions.

      This is my Ant build script:
      <?xml version="1.0" encoding="UTF-8"?>
      <project name="helloworld" default="generate-artifacts">
       <description>
       Generates JAX-WS artifacts for our service endpoint implementation(s)
       </description>
      
       <property file="build.properties" />
      
       <path id="wsprovide.path">
       <fileset dir="${jboss.home}/client" includes="*.jar" />
       </path>
      
       <target name="generate-artifacts">
       <taskdef name="WSProvideTask" classname="org.jboss.wsf.spi.tools.ant.WSProvideTask">
       <classpath refid="wsprovide.path" />
       </taskdef>
      
       <WSProvideTask
       fork="true"
       genwsdl="true"
       verbose="true"
       sei="helloworld.HelloWorld">
       <classpath>
       <pathelement path="build/classes"/>
       <pathelement path="WebContent/WEB-INF/lib"/>
       </classpath>
       </WSProvideTask>
       </target>
      </project>


      And this is it's output:
      Buildfile: C:\Documents and Settings\Ollie\workspace\helloworld\build.xml
      
      generate-artifacts:
      [WSProvideTask] Command invoked: org.jboss.wsf.spi.tools.cmd.WSProvide -w -t helloworld.HelloWorld
      [WSProvideTask] Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/web/context/support/SpringBeanAutowiringSupport
      [WSProvideTask] at java.lang.ClassLoader.defineClass1(Native Method)
      [WSProvideTask] at java.lang.ClassLoader.defineClass(Unknown Source)
      [WSProvideTask] at java.security.SecureClassLoader.defineClass(Unknown Source)
      [WSProvideTask] at java.net.URLClassLoader.defineClass(Unknown Source)
      [WSProvideTask] at java.net.URLClassLoader.access$000(Unknown Source)
      [WSProvideTask] at java.net.URLClassLoader$1.run(Unknown Source)
      [WSProvideTask] at java.security.AccessController.doPrivileged(Native Method)
      [WSProvideTask] at java.net.URLClassLoader.findClass(Unknown Source)
      [WSProvideTask] at java.lang.ClassLoader.loadClass(Unknown Source)
      [WSProvideTask] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      [WSProvideTask] at java.lang.ClassLoader.loadClass(Unknown Source)
      [WSProvideTask] at org.jboss.wsf.spi.tools.cmd.WSProvide.generate(WSProvide.java:162)
      [WSProvideTask] at org.jboss.wsf.spi.tools.cmd.WSProvide.main(WSProvide.java:77)
      [WSProvideTask] Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.support.SpringBeanAutowiringSupport
      [WSProvideTask] at java.net.URLClassLoader$1.run(Unknown Source)
      [WSProvideTask] at java.security.AccessController.doPrivileged(Native Method)
      [WSProvideTask] at java.net.URLClassLoader.findClass(Unknown Source)
      [WSProvideTask] at java.lang.ClassLoader.loadClass(Unknown Source)
      [WSProvideTask] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      [WSProvideTask] at java.lang.ClassLoader.loadClass(Unknown Source)
      [WSProvideTask] at java.lang.ClassLoader.loadClassInternal(Unknown Source)
      [WSProvideTask] ... 13 more
      
      BUILD FAILED
      C:\Documents and Settings\Ollie\workspace\helloworld\build.xml:22: Could not invoke WSProvideTask
      
      Total time: 1 second


      WebContent/WEB-INF/lib (see classpath of WSProvideTask) contains spring.jar. What's going on? Why can't WSProvideTask find the sping class? Using the command line yields the same result (NoClassDefFoundError). It's probably something silly but I can't figure it out.