Reputation: 863
mvn generate-sources
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBu
ilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building epay_api 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- jaxws-maven-plugin:2.3:wsimport (wsimport-generate-sources) @ api ---
[INFO] Processing: file:/C:/service.wsdl
[WARNING] Using platform encoding (Cp1256), build is platform dependent!
[INFO] jaxws:wsimport args: [-keep, -s, C:\api\src\main\java, -d, C:\api\target\classes, -verbose, -Xnocompile, -B-debug, -B-no-header, -B-Xxew, -B-Xx
ew:instantiate lazy, -B-Xxew:delete, -B-extension, -B-b C:\api/src/main/res
ources/jaxb_binding.xml, "file:/C:/api/src/main/resources/service.w
sdl"]
[DEBUG] JAXB Compilation started (XmlElementWrapperPlugin.onActivated):
[DEBUG] buildId : 2.2.7
[DEBUG] targetDir : .
[DEBUG] defaultPackage : null
[DEBUG] defaultPackage2 : null
[DEBUG] debug : true
[DEBUG] verbose : true
[DEBUG] quiet : false
[DEBUG] grammars : 0
[DEBUG] Argument[0] = -Xxew
[DEBUG] Argument[0] = -Xxew:instantiate
[DEBUG] Argument[0] = -Xxew:delete
parsing WSDL...
Exception in thread "main" java.lang.ClassCastException: java.lang.NoSuchMethodError cannot be cast
to java.lang.Exception
at org.jvnet.jax_ws_commons.jaxws.Invoker.main(Invoker.java:87)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.593 s
[INFO] Finished at: 2014-04-04T04:06:54+04:00
[INFO] Final Memory: 7M/216M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.3:wsimport (wsimport-ge
nerate-sources) on project epay_api: Mojo failed - check output -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following arti
cles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Here is my simple 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>api</groupId>
<artifactId>api</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<id>wsimport-generate-sources</id>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<verbose>true</verbose>
<sourceDestDir>src/main/java</sourceDestDir>
<wsdlDirectory>src/main/resources/</wsdlDirectory>
<wsdlLocation>src/main/resources/*</wsdlLocation>
<xjcArgs>
<xjcArg>-debug</xjcArg>
<xjcArg>-no-header</xjcArg>
<xjcArg>-Xxew</xjcArg>
<xjcArg>-Xxew:instantiate lazy</xjcArg>
<xjcArg>-Xxew:delete</xjcArg>
<xjcArg>-extension</xjcArg>
<xjcArg>-b ${basedir}/src/main/resources/jaxb_binding.xml</xjcArg>
<xjcArg>-XJsr303Annotations</xjcArg>
<!-- <xjcArg>-Xfluent-api</xjcArg> -->
<!-- <xjcArg>-Xvalue-constructor</xjcArg> -->
</xjcArgs>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.github.jaxb-xew-plugin</groupId>
<artifactId>jaxb-xew-plugin</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>com.github.krasa</groupId>
<artifactId>krasa-jaxb-tools</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
And -e -X switch does not reveal anything about this error
"main" java.lang.ClassCastException: java.lang.NoSuchMethodError cannot be cast on .jax_ws_commons.jaxws.Invoker.main(Invoker.java:87)
This is the most basic configuration i am trying.
C:\api>java -version java version "1.7.0_51" Java(TM) SE Runtime Environment (build 1.7.0_51-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
C:\api>mvn -version Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T21:37:52+04:00) Maven home: C:\Program Files\apache-maven-3.2.1\bin.. Java version: 1.7.0_51, vendor: Oracle Corporation Java home: C:\Program Files\Java\jdk1.7.0_51\jre Default locale: en_US, platform encoding: Cp1256 OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
What is wrong with my configuration? Appreciate any help thanks
Upvotes: 1
Views: 8544
Reputation: 1834
Try with add this plugin in your pom.xml
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3</version>
<configuration>
<!-- Needed with JAXP 1.5 -->
<vmArgs>
<vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
</vmArgs>
</configuration>
</plugin>
Upvotes: 2
Reputation: 81
I got the same error:
Failed to execute goal org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.3:wsimport (default) on project birst-soap-client: Mojo failed - check output.
But the cause is something in Jenkins. The Jenkins job name has some spaces in it ("file:/data/jenkins/workspace/Dpm-Flyer-Core%20-%20Release%20Tag+Nexus/...), and that caused a failure to execute "jaxws:wsimport". But stragely, Jenkins list this as [INFO] instead of [ERROR]. After removing the spaces in Jenkins job name. The build executed successfully. The exerpt is listed below.
[INFO] [INFO] Processing: file:/data/jenkins/workspace/Dpm-Flyer-Core%20-%20Release%20Tag+Nexus/thirdparty/birst-soap-client/src/main/resources/wsdl/CommandWebService.5.19.wsdl [INFO] [WARNING] Using platform encoding (UTF-8), build is platform dependent! [INFO] [INFO] jaxws:wsimport args: [-keep, -s, /data/jenkins/workspace/Dpm-Flyer-Core - Release Tag+Nexus/thirdparty/birst-soap-client/target/generated-sources/wsimport, -d, /data/jenkins/workspace/Dpm-Flyer-Core - Release Tag+Nexus/thirdparty/birst-soap-client/target/classes, -verbose, -Xnocompile, -B-XautoNameResolution, -p, com.birst, -target, 2.0, "file:/data/jenkins/workspace/Dpm-Flyer-Core%20-%20Release%20Tag+Nexus/thirdparty/birst-soap-client/src/main/resources/wsdl/CommandWebService.5.19.wsdl"] [INFO] directory not found: /data/jenkins/workspace/Dpm-Flyer-Core
Upvotes: 0
Reputation: 917
The workaround from https://java.net/jira/browse/JAX_WS_COMMONS-129 helped me:
<configuration>
<vmArgs>
<vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
</vmArgs>
</configuration>
Upvotes: 9
Reputation: 118
For what it is worth: I had the same sort of error - using Maven 3.2.2 and I had the jaxws-maven-plugin set to 2.3. This stopped working with the problem:
Exception in thread "main" java.lang.ClassCastException: java.lang.NoSuchMethodError cannot be cast to java.lang.Exception
Reading the threads and the Stack Overflow posts, it seemed that going to a new version of the plugin would help. Moved to 2.3.1-b01 all the way to 2.3.1-b03. This changed the issue to now results in:
java.lang.NoClassDefFoundError: org/sonatype/aether/* Caused by: java.lang.ClassNotFoundException: org.sonatype.aether.*
Seems that there is a well documented issue with the 2.3.1-b03 working with any Maven release that is >=3.1. You can find more info by searching (there are JIRAs and bug reports open on it) or start here.
Ultimately I moved back down to 2.2. for the plugin and this worked without and issue.
Upvotes: 3
Reputation: 161
According to the samples of the jaxb xew plugin you need to use a newer version of the jaxws maven plugin. The sample uses version 2.3.1-b03 which is also working in my project. Older versions of this plugin are probably compiled against a library that is incompatible with the jaxb xew plugin.
If you browse the sample code history you will find a configuration for the jaxws maven plugin version 2.2, too.
Upvotes: 3