Reputation: 11445
I am using netbeans with maven 3. When I try to compile with jaxws-maven-plugin, I get the following error.
Here is my pom
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<executions>
<execution>
<id>teamWS</id>
<goals>
<goal>wsgen</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<resourceDestDir>${project.build.directory}/classes/wsdl</resourceDestDir>
<sei>xyz.timerserver.server.TimeServer</sei>
<genWsdl>true</genWsdl>
<keep>true</keep>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
</dependency>
<dependency>
<groupId>javax.jws</groupId>
<artifactId>jsr181-api</artifactId>
<version>1.0-MR1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
</dependency>
</dependencies>
This is the error message that I get. I tried to add tools.jar using system scope dependency but still no luck
Failed to execute goal org.codehaus.mojo:jaxws-maven-plugin:1.10:wsgen (teamWS) on project JWSServer: Failed to execute wsgen: com/sun/mirror/apt/AnnotationProcessorFactory: com.sun.mirror.apt.AnnotationProcessorFactory -> [Help 1]
Upvotes: 4
Views: 17631
Reputation: 2785
You can use the official example configuration, it is available here.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
<phase>initialize</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>@project.version@</version>
<executions>
<execution>
<goals>
<goal>wsgen</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<sei>org.codehaus.mojo.jaxws.it.HelloWorldImpl</sei>
<genWsdl>true</genWsdl> <!-- for demo purpose only, the wepapp does not need those the generated wsdl files-->
<keep>true</keep>
</configuration>
</execution>
</executions>
</plugin>
Please review the dependencies they are using to avoid compilation errors. See the mvn dependency:tree
output:
[INFO] Scanning for projects...
[INFO]
[INFO] -----------< org.jvnet.jax-ws-commons:mojo.it.helloworldws >------------
[INFO] Building helloworld 1.0-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ mojo.it.helloworldws ---
[INFO] org.jvnet.jax-ws-commons:mojo.it.helloworldws:war:1.0-SNAPSHOT
[INFO] \- com.sun.xml.ws:jaxws-rt:jar:2.3.2:compile
[INFO] +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.2:compile
[INFO] +- jakarta.xml.ws:jakarta.xml.ws-api:jar:2.3.2:compile
[INFO] +- jakarta.xml.soap:jakarta.xml.soap-api:jar:1.4.1:compile
[INFO] +- jakarta.annotation:jakarta.annotation-api:jar:1.3.4:compile
[INFO] +- jakarta.jws:jakarta.jws-api:jar:1.1.1:compile
[INFO] +- org.glassfish.jaxb:jaxb-runtime:jar:2.3.2:compile
[INFO] | +- org.glassfish.jaxb:txw2:jar:2.3.2:compile
[INFO] | \- com.sun.istack:istack-commons-runtime:jar:3.0.8:compile
[INFO] +- com.sun.xml.ws:policy:jar:2.7.6:compile
[INFO] +- org.glassfish.gmbal:gmbal:jar:4.0.0:compile
[INFO] | +- org.glassfish.external:management-api:jar:3.2.1:compile
[INFO] | +- org.glassfish.pfl:pfl-basic:jar:4.0.1:compile
[INFO] | +- org.glassfish.pfl:pfl-tf:jar:4.0.1:compile
[INFO] | | +- org.glassfish.pfl:pfl-asm:jar:4.0.1:compile
[INFO] | | \- org.glassfish.pfl:pfl-dynamic:jar:4.0.1:compile
[INFO] | +- org.glassfish.pfl:pfl-basic-tools:jar:4.0.1:compile
[INFO] | \- org.glassfish.pfl:pfl-tf-tools:jar:4.0.1:compile
[INFO] +- org.jvnet.staxex:stax-ex:jar:1.8.1:compile
[INFO] +- com.sun.xml.stream.buffer:streambuffer:jar:1.5.7:compile
[INFO] +- org.jvnet.mimepull:mimepull:jar:1.9.11:compile
[INFO] +- com.sun.xml.fastinfoset:FastInfoset:jar:1.2.16:compile
[INFO] +- org.glassfish.ha:ha-api:jar:3.1.12:compile
[INFO] +- com.sun.xml.messaging.saaj:saaj-impl:jar:1.5.1:compile
[INFO] +- com.fasterxml.woodstox:woodstox-core:jar:5.1.0:runtime
[INFO] +- org.codehaus.woodstox:stax2-api:jar:4.1:runtime
[INFO] \- jakarta.activation:jakarta.activation-api:jar:1.2.1:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.808 s
[INFO] Finished at: 2022-10-15T12:58:08-03:00
[INFO] ------------------------------------------------------------------------
Upvotes: 0
Reputation: 9816
The project just went back to MojoHaus so you should use the latest version from there.
The original code was developed in the Codehaus Mojo project, then as of March 2007, the project moved to jax-ws-commons with version 1.x in org.codehaus.mojo groupId and version 2.x in org.jvnet.jax-ws-commons groupId. In September 2015, for version 2.4, it went back to MojoHaus (the new home of Codehaus Mojo) in org.codehaus.mojo groupId
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.5</version>
</dependency>
Upvotes: 3
Reputation: 5213
Try using updated version of the plugin from JAX-WS commons project.
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.2</version>
Upvotes: 10
Reputation: 1527
As a first step, ensure that you're running maven with a correct java version -- jaxws:wsgen (1.12) appears to malfunction with java 7, in such a case use java 6, i.e.:
export JAVA_HOME=/path/to/java/6
-vm /path/to/java/6
For me, this solved the Failed to execute wsgen
caused by com.sun.xml.bind.v2.runtime.IllegalAnnotationsException
.
Upvotes: 12