10 Replies Latest reply on Feb 24, 2012 4:07 AM by Alessio Soldano

    ClassNotFoundException org.jboss.ws.api.tools.WSContractConsumer when using maven-jaxws-tools-plugin

    nicolas duminil Master

      Hi,

       

      I'm using JBoss SOA-P 5.2 to deploy some web services. The following pom file:

       

      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

        <modelVersion>4.0.0</modelVersion>

        <parent>

          <artifactId>credit-card-validator</artifactId>

          <groupId>fr.simplex-software.soa</groupId>

          <version>0.0.1-SNAPSHOT</version>

          <relativePath>..</relativePath>

        </parent>

        <artifactId>credit-card-validator-war</artifactId>

        <packaging>war</packaging>

        <name>creditCardValidatorWar</name>

        <description>Credit Card Validator Service</description>

        <dependencies>

          <dependency>

            <groupId>org.jboss.ws.native</groupId>

            <artifactId>jbossws-native-client</artifactId>

            <version>3.3.1.GA</version>

          </dependency>

        </dependencies>

        <build>

          <plugins>

            <plugin>

              <groupId>org.jboss.ws.plugins</groupId>

              <artifactId>maven-jaxws-tools-plugin</artifactId>

              <version>1.1.0.GA</version>

              <configuration>

                <wsdls>

                  <wsdl>${basedir}/creditcardcheck.wsdl</wsdl>

                </wsdls>

                <targetPackage>foo.bar</targetPackage>

                <extension>true</extension>

              </configuration>

              <executions>

                <execution>

                  <goals>

                    <goal>wsconsume</goal>

                  </goals>

                </execution>

              </executions>

            </plugin>

          </plugins>

        </build>

      </project>

       

      raises the following exception:

       

      [INFO] ------------------------------------------------------------------------

      [ERROR] BUILD ERROR

      [INFO] ------------------------------------------------------------------------

      [INFO] Error while running wsconsume

       

      Embedded error: org.jboss.ws.api.tools.WSContractConsumer

      [INFO] ------------------------------------------------------------------------

      [INFO] Trace

      org.apache.maven.lifecycle.LifecycleExecutionException: Error while running wsconsume

              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)

              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)

              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)

              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)

              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)

              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)

              at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)

              at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)

              at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)

              at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

              at java.lang.reflect.Method.invoke(Method.java:597)

              at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)

              at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)

              at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

              at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

      Caused by: org.apache.maven.plugin.MojoExecutionException: Error while running wsconsume

              at org.jboss.ws.plugins.tools.AbstractWsConsumeMojo.execute(AbstractWsConsumeMojo.java:157)

              at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)

              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)

              ... 17 more

      Caused by: java.lang.ClassNotFoundException: org.jboss.ws.api.tools.WSContractConsumer

              at java.net.URLClassLoader$1.run(URLClassLoader.java:202)

              at java.security.AccessController.doPrivileged(Native Method)

              at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

              at java.lang.ClassLoader.loadClass(ClassLoader.java:307)

              at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

              at org.jboss.ws.plugins.tools.WSContractDelegate.runConsumerInProcess(WSContractDelegate.java:110)

              at org.jboss.ws.plugins.tools.WSContractDelegate.runConsumer(WSContractDelegate.java:103)

              at org.jboss.ws.plugins.tools.AbstractWsConsumeMojo.execute(AbstractWsConsumeMojo.java:149)

              ... 19 more

      [INFO] ------------------------------------------------------------------------

      [INFO] Total time: 23 seconds

      [INFO] Finished at: Wed Feb 08 16:52:11 CET 2012

      [INFO] Final Memory: 34M/295M

      [INFO] ------------------------------------------------------------------------

      [

       

      Looking with jarscan in the whole JBoss installation, there is no such a class like org.jboss.ws.api.tools.WSContractConsumer. Many thanks in advance for any help.

       

      Kind regards,

       

      Nicolas

        • 2. Re: ClassNotFoundException org.jboss.ws.api.tools.WSContractConsumer when using maven-jaxws-tools-plugin
          Alessio Soldano Master

          maven-jaxws-tools-plugin 1.1.0.GA is meant for being used with JBossWS 4.x. Try either moving to that or using the 1.0.x versions of the plugin.

          • 3. Re: ClassNotFoundException org.jboss.ws.api.tools.WSContractConsumer when using maven-jaxws-tools-plugin
            nicolas duminil Master

            If I decode weel what you're saying, SOA-P 5.2 does not include JBossWS 4.x. Is that correct ?

            • 4. Re: ClassNotFoundException org.jboss.ws.api.tools.WSContractConsumer when using maven-jaxws-tools-plugin
              Alessio Soldano Master

              Well, yes, SOA-P 5.2 does not include JBWS 4.x, it should have a 3.1.2.SPx release afair.

              However, you're declaring a dependency on jbossws-native-client 3.3.1.GA in your pom above, that's why I said there's a mismatch between the 1.1.0.GA plugin and the JBWS version you're using.

              • 5. Re: ClassNotFoundException org.jboss.ws.api.tools.WSContractConsumer when using maven-jaxws-tools-plugin
                nicolas duminil Master

                Okay, thanks for the update. Now I modified my pom such that to use the 1.0.0.GA release. Here is the new one:

                 

                <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

                  <modelVersion>4.0.0</modelVersion>

                  <groupId>be.ovam.soa</groupId>

                  <artifactId>FakeSearchService</artifactId>

                  <version>0.0.1-SNAPSHOT</version>

                  <packaging>war</packaging>

                  <name>fake search service</name>

                  <description>This is a simulation of the SearchService</description>

                  <dependencies>

                    <dependency>

                      <groupId>org.jboss.ws.native</groupId>

                      <artifactId>jbossws-native-client</artifactId>

                      <version>3.3.1.GA</version>

                    </dependency>

                  </dependencies>

                  <build>

                    <plugins>

                      <plugin>

                        <groupId>org.apache.maven.plugins</groupId>

                        <artifactId>maven-compiler-plugin</artifactId>

                        <version>2.3.2</version>

                        <configuration>

                          <source>1.6</source>

                          <target>1.6</target>

                        </configuration>

                      </plugin>

                      <plugin>

                        <groupId>org.jboss.ws.plugins</groupId>

                        <artifactId>maven-jaxws-tools-plugin</artifactId>

                        <version>1.0.0.GA</version>

                        <configuration>

                          <wsdls>

                            <wsdl>${basedir}/wsdl/OrderProcess.wsdl</wsdl>

                          </wsdls>

                          <targetPackage>be.ovam.soa</targetPackage>

                          <extension>true</extension>

                        </configuration>

                        <executions>

                          <execution>

                            <goals>

                              <goal>wsconsume</goal>

                            </goals>

                          </execution>

                        </executions>

                      </plugin>

                    </plugins>

                  </build>

                </project>

                 

                Now it generates the stubs, etc. but the generated stuff doesn't compile raising this errors:

                 

                22/02/12 16:51:27 CET: [INFO] Compiling 7 source files to /home/nicolas/workspace/jds40/FakeSearchService/target/classes

                22/02/12 16:51:28 CET: [INFO] -------------------------------------------------------------

                22/02/12 16:51:28 CET: [ERROR] COMPILATION ERROR :

                22/02/12 16:51:28 CET: [INFO] -------------------------------------------------------------

                22/02/12 16:51:28 CET: [ERROR] /home/nicolas/workspace/jds40/FakeSearchService/target/wsconsume/java/be/ovam/soa/OrderProcessService.java:[46,8] cannot find symbol

                symbol  : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[])

                location: class javax.xml.ws.Service

                22/02/12 16:51:28 CET: [ERROR] /home/nicolas/workspace/jds40/FakeSearchService/target/wsconsume/java/be/ovam/soa/OrderProcessService.java:[54,8] cannot find symbol

                symbol  : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[])

                location: class javax.xml.ws.Service

                22/02/12 16:51:28 CET: [ERROR] /home/nicolas/workspace/jds40/FakeSearchService/target/wsconsume/java/be/ovam/soa/OrderProcessService.java:[62,8] cannot find symbol

                symbol  : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[])

                location: class javax.xml.ws.Service

                22/02/12 16:51:28 CET: [INFO] 3 errors

                 

                So it doesn't compile what itself has generated !

                • 6. Re: ClassNotFoundException org.jboss.ws.api.tools.WSContractConsumer when using maven-jaxws-tools-plugin
                  nicolas duminil Master

                  I've read again your previous message and noticed that you're warning me that my dependency was on 3.3.1 while SOA-P 5.2 includes 3.1.2. So I modified the pom such to rely on the good release and now every thing works fine, sorry for the complaint. But more generally, how is one supposed to know i) what version of JBossWS contains SOA-P 5.2, ii)what release of the plugin has to be used for a given version of JBossWS, etc ? All that becomes damed complicated. After all, the SOA-P should be a toaster: no need to know what version of JBossWS release it contains. One even doesn't have to know that there is such a thing like JBossWS. It should be just an SOA platform containing every thing which is required.

                  • 7. Re: ClassNotFoundException org.jboss.ws.api.tools.WSContractConsumer when using maven-jaxws-tools-plugin
                    Alessio Soldano Master

                    It's your compiler (plugin) that is not endorsing the jaxws 2.2 api and using the api that comes with JDK 1.6.

                    So you either need to endorse that or specify target 2.1 in the jaxws tools plugin configuration.

                     

                    Btw, there's a 1.0.1.GA version of the jaxws tools plugin.

                    • 8. Re: ClassNotFoundException org.jboss.ws.api.tools.WSContractConsumer when using maven-jaxws-tools-plugin
                      Alessio Soldano Master

                      I see your point on the SOA-P, there should probably be an example already including the jbossws version in SOA-P and plugin doc customized for that. The SOA-P platform can't contain the maven plugin, as that's meant for coming from a maven repo only.

                      In any case, you can see the jbossws version installed in any AS version looking at the boot log.

                      • 9. Re: ClassNotFoundException org.jboss.ws.api.tools.WSContractConsumer when using maven-jaxws-tools-plugin
                        nicolas duminil Master

                        But what if I'll be using CXF with Apache plugins ? I mean org.apache.cxf:cxf-rt-frontend-jaxws. What would be the implications ? I would replace the JBossWS stack in the server with the CXF one and continue like this. This is because, after having ran wsconsume and deployed the generated war, there is no web service deployed. The generated stuff includes, besides the JAX-B classes, the SEI and a *Service class that I'm not sure what it is as it is annotated with @WebServiceClient. There is no *Impl class, as it would be the case with CXF, and I tried to implement it from scratch but I cannot see any deployed web service in the console for this war. It doen't seem to exist any documentation about doing contract-first with JBossWS, as oposed as the CXF documentation which is very complete. What do you think about this approach ?

                        • 10. Re: ClassNotFoundException org.jboss.ws.api.tools.WSContractConsumer when using maven-jaxws-tools-plugin
                          Alessio Soldano Master

                           

                          But what if I'll be using CXF with Apache plugins ? I mean org.apache.cxf:cxf-rt-frontend-jaxws. What would be the implications ? I would replace the JBossWS stack in the server with the CXF one and continue like this.

                          On a JBoss AS community application server, you're free to play with the ws stacks and try whatever you want, but please consider that successfully replacing jbossws-cxf with a vanilla Apache CXF is not going to be easy and at minum you're loosing the JSR109 features and all the JBoss integration customizations with the app server. Speaking of maven plugins, you can probably use the Apache CXF one without much problems, though I never tried.

                          On a JBoss Enterprise Product, instead, (including SOA-P) you are not supposed to replace/modify the ws stack. I believe you're loosing official support in that case, but please check the details through your established support contact.

                           

                          This is because, after having ran wsconsume and deployed the generated war, there is no web service deployed. The generated stuff includes, besides the JAX-B classes, the SEI and a *Service class that I'm not sure what it is as it is annotated with @WebServiceClient. There is no *Impl class, as it would be the case with CXF, and I tried to implement it from scratch but I cannot see any deployed web service in the console for this war. It doen't seem to exist any documentation about doing contract-first with JBossWS, as oposed as the CXF documentation which is very complete. What do you think about this approach ?

                          You're most likely forgetting something here. Speaking of documentation, the JBossWS 4 / AS 7.x webservices documentation is available at https://docs.jboss.org/author/display/JBWS/ ; in particular check https://docs.jboss.org/author/display/JBWS/JAX-WS+Tools .

                          For JBossWS 3.x, the documentation is at https://community.jboss.org/wiki/JBossWS ; in particular see https://community.jboss.org/wiki/JBossWS-JAX-WSTools

                          The links above are also provided on the project webpage http://www.jboss.org/jbossws/docs .

                          Finally, I believe the SOA-P product should come with his own documentation, including ws related stuff. If that's not the case, please let me know so that I have someone check.