Error while running wsconume using maven
indranilrc Mar 6, 2018 8:16 AMHi,
The topic of running wsconsume through maven is widely discussed and before posting this issue I had looked into quite a few of them but have not found a specific solution to the issue.
I am using Red Hat Jboss developer studio Version: 10.4.0.GA with JBoss EAP 6.4.0.GA (AS 7.5.0.Final-redhat-21). From standalone server start up log I can see that JBoss Web Services - Stack CXF Server 4.3.4.Final-redhat-1 is being used.
The objective is to run wsconsume (to generate client and service from a wsdl) from a maven project set up in JBoss IDE (eventually deploy the web service in EAP 6.4).
Following repository is setup in Jboss IDE.
https://repository.jboss.org/nexus/content/groups/public-jboss/
However I get java.lang.ClassNotFoundException: org.jboss.ws.api.tools.WSContractConsumer exception while run the maven build. I have referenced the following articles :
https://developer.jboss.org/wiki/JAXWSToolsMavenPluginSample
https://docs.jboss.org/author/display/JBWS/wsconsume
How to configure wsconsume maven plugin?
Also, looked at Jax-ws tools documentation available within jbossws-cxf-4.3.2.Final distribution documentation.
Here is copy of the project pom.xml:
<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>org.jboss.tools</groupId> <artifactId>jboss-calculator-ws</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <name>jboss-calculator-ws</name> <build> <sourceDirectory>${basedir}/src</sourceDirectory> <resources> <resource> <directory>${basedir}/src</directory> <excludes> <exclude>**/*.java</exclude> </excludes> </resource> </resources> <plugins> <plugin> <artifactId>maven-war-plugin</artifactId> <version>${maven.war.plugin.version}</version> <configuration> <warSourceDirectory>${basedir}/WebContent</warSourceDirectory> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>${version.compiler.plugin}</version> <configuration> <source>${maven.compiler.source}</source> <target>${maven.compiler.target}</target> </configuration> </plugin> <plugin> <groupId>org.jboss.ws.plugins</groupId> <artifactId>jaxws-tools-maven-plugin</artifactId> <version>${jaxws.tools.maven.plugin.version}</version> <configuration> <wsdls> <wsdl>${basedir}/calculator.wsdl</wsdl> </wsdls> <classpathElements>${basedir}/WebContent/WEB-INF/lib/commons-lang-2.6.jar</classpathElements> <targetPackage>com.myapp.ws.generated</targetPackage> <verbose>true</verbose> </configuration> <executions> <execution> <goals> <goal>wsconsume</goal> </goals> </execution> </executions> </plugin> </plugins> <finalName>jboss-calculator-ws</finalName> </build> <dependencies> <dependency> <groupId>org.jboss.ws.cxf</groupId> <artifactId>jbossws-cxf-client</artifactId> <version>${org.jboss.ws.cxf.client.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.6</version> </dependency> </dependencies> <properties> <maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.source>1.8</maven.compiler.source> <version.compiler.plugin>3.0</version.compiler.plugin> <jaxws.tools.maven.plugin.version>1.2.0.Final</jaxws.tools.maven.plugin.version> <org.jboss.ws.cxf.client.version>4.3.4.Final</org.jboss.ws.cxf.client.version> <maven.war.plugin.version>2.3</maven.war.plugin.version> </properties> </project>
NOTE: Commons lang dependency was added to avoid error ClassNotFoundException on StringUtils
The relevant error trace is as below (full trace attached in the post)
[INFO] --- jaxws-tools-maven-plugin:1.2.0.Final:wsconsume (default) @ jboss-calculator-ws ---
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=0, ConflictMarker.markTime=0, ConflictMarker.nodeCount=37, ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=20, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=0, ConflictResolver.conflictItemCount=37, DefaultDependencyCollector.collectTime=80, DefaultDependencyCollector.transformTime=0}
[DEBUG] org.jboss.ws.plugins:jaxws-tools-maven-plugin:jar:1.2.0.Final:
[DEBUG] org.jboss.ws:jbossws-common-tools:jar:1.2.1.Final:compile
[DEBUG] org.jboss.ws:jbossws-api:jar:1.0.3.Final:compile
[DEBUG] gnu.getopt:java-getopt:jar:1.0.13:compile
[DEBUG] log4j:log4j:jar:1.2.14:compile
[DEBUG] org.apache.maven:maven-project:jar:2.2.1:compile
[DEBUG] org.apache.maven:maven-settings:jar:2.2.1:compile
[DEBUG] org.apache.maven:maven-profile:jar:2.2.1:compile
[DEBUG] org.apache.maven:maven-model:jar:2.2.1:compile
[DEBUG] org.apache.maven:maven-artifact-manager:jar:2.2.1:compile
[DEBUG] org.apache.maven:maven-repository-metadata:jar:2.2.1:compile
[DEBUG] backport-util-concurrent:backport-util-concurrent:jar:3.1:compile
[DEBUG] org.apache.maven:maven-plugin-registry:jar:2.2.1:compile
[DEBUG] org.codehaus.plexus:plexus-interpolation:jar:1.11:compile
[DEBUG] org.codehaus.plexus:plexus-utils:jar:1.5.15:compile
[DEBUG] org.apache.maven:maven-artifact:jar:2.2.1:compile
[DEBUG] org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
[DEBUG] junit:junit:jar:3.8.1:compile
[DEBUG] classworlds:classworlds:jar:1.1-alpha-2:compile
[DEBUG] org.apache.maven:maven-plugin-api:jar:2.2.1:compile
[DEBUG] Created new class realm plugin>org.jboss.ws.plugins:jaxws-tools-maven-plugin:1.2.0.Final
[DEBUG] Importing foreign packages into class realm plugin>org.jboss.ws.plugins:jaxws-tools-maven-plugin:1.2.0.Final
[DEBUG] Imported: < maven.api
[DEBUG] Populating class realm plugin>org.jboss.ws.plugins:jaxws-tools-maven-plugin:1.2.0.Final
[DEBUG] Included: org.jboss.ws.plugins:jaxws-tools-maven-plugin:jar:1.2.0.Final
[DEBUG] Included: org.jboss.ws:jbossws-common-tools:jar:1.2.1.Final
[DEBUG] Included: org.jboss.ws:jbossws-api:jar:1.0.3.Final
[DEBUG] Included: gnu.getopt:java-getopt:jar:1.0.13
[DEBUG] Included: log4j:log4j:jar:1.2.14
[DEBUG] Included: backport-util-concurrent:backport-util-concurrent:jar:3.1
[DEBUG] Included: org.codehaus.plexus:plexus-interpolation:jar:1.11
[DEBUG] Included: org.codehaus.plexus:plexus-utils:jar:1.5.15
[DEBUG] Included: junit:junit:jar:3.8.1
[DEBUG] Configuring mojo org.jboss.ws.plugins:jaxws-tools-maven-plugin:1.2.0.Final:wsconsume from plugin realm ClassRealm[plugin>org.jboss.ws.plugins:jaxws-tools-maven-plugin:1.2.0.Final, parent: sun.misc.Launcher$AppClassLoader@55f96302]
[DEBUG] Configuring mojo 'org.jboss.ws.plugins:jaxws-tools-maven-plugin:1.2.0.Final:wsconsume' with basic configurator -->
[DEBUG] (f) additionalHeaders = false
[DEBUG] (f) classpathElements = [C:\Users\jdoe\jboss-workspace\jboss-calculator-ws/WebContent/WEB-INF/lib/commons-lang-2.6.jar]
[DEBUG] (f) extension = false
[DEBUG] (f) fork = false
[DEBUG] (f) outputDirectory = C:\Users\jdoe\jboss-workspace\jboss-calculator-ws\target\classes
[DEBUG] (f) pluginArtifacts = [org.jboss.ws.plugins:jaxws-tools-maven-plugin:maven-plugin:1.2.0.Final:, org.jboss.ws:jbossws-common-tools:jar:1.2.1.Final:compile, org.jboss.ws:jbossws-api:jar:1.0.3.Final:compile, gnu.getopt:java-getopt:jar:1.0.13:compile, log4j:log4j:jar:1.2.14:compile, org.apache.maven:maven-project:jar:2.2.1:compile, org.apache.maven:maven-settings:jar:2.2.1:compile, org.apache.maven:maven-profile:jar:2.2.1:compile, org.apache.maven:maven-model:jar:2.2.1:compile, org.apache.maven:maven-artifact-manager:jar:2.2.1:compile, org.apache.maven:maven-repository-metadata:jar:2.2.1:compile, backport-util-concurrent:backport-util-concurrent:jar:3.1:compile, org.apache.maven:maven-plugin-registry:jar:2.2.1:compile, org.codehaus.plexus:plexus-interpolation:jar:1.11:compile, org.codehaus.plexus:plexus-utils:jar:1.5.15:compile, org.apache.maven:maven-artifact:jar:2.2.1:compile, org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile, junit:junit:jar:3.8.1:compile, classworlds:classworlds:jar:1.1-alpha-2:compile, org.apache.maven:maven-plugin-api:jar:2.2.1:compile]
[DEBUG] (f) project = MavenProject: org.jboss.tools:jboss-calculator-ws:0.0.1-SNAPSHOT @ C:\Users\jdoe\jboss-workspace\jboss-calculator-ws\pom.xml
[DEBUG] (f) sourceDirectory = C:\Users\jdoe\jboss-workspace\jboss-calculator-ws\target\generated-sources\wsconsume
[DEBUG] (f) targetPackage = com.myapp.ws.generated
[DEBUG] (f) verbose = true
[DEBUG] (f) wsdls = [C:\Users\jdoe\jboss-workspace\jboss-calculator-ws/calculator.wsdl]
[DEBUG] -- end configuration --
[INFO] Classpath:
[INFO] C:\Users\jdoe\jboss-workspace\jboss-calculator-ws/WebContent/WEB-INF/lib/commons-lang-2.6.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.661 s
[INFO] Finished at: 2018-03-06T17:52:42+05:30
[INFO] Final Memory: 9M/155M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jboss.ws.plugins:jaxws-tools-maven-plugin:1.2.0.Final:wsconsume (default) on project jboss-calculator-ws: Error while running wsconsume: org.jboss.ws.api.tools.WSContractConsumer -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jboss.ws.plugins:jaxws-tools-maven-plugin:1.2.0.Final:wsconsume (default) on project jboss-calculator-ws: Error while running wsconsume
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error while running wsconsume
at org.jboss.ws.plugins.tools.AbstractWsConsumeMojo.execute(AbstractWsConsumeMojo.java:169)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
Caused by: java.lang.ClassNotFoundException: org.jboss.ws.api.tools.WSContractConsumer
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.jboss.ws.plugins.tools.WSContractDelegate.runConsumerInProcess(WSContractDelegate.java:103)
at org.jboss.ws.plugins.tools.WSContractDelegate.runConsumer(WSContractDelegate.java:96)
at org.jboss.ws.plugins.tools.AbstractWsConsumeMojo.execute(AbstractWsConsumeMojo.java:161)
... 22 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
What additional dependency should I add to get rid of the above error ? Are the versions of jaxws-tools-maven-plugin and org.jboss.ws.cxf.client being used correct ?
Appreciate any feedback and pointers in this respect.