Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven jaxws Failed to execute wsgen

Tags:

maven

jax-ws

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]
like image 211
user373201 Avatar asked Nov 28 '22 17:11

user373201


1 Answers

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.:

  • if you run it from a shell, export JAVA_HOME=/path/to/java/6
  • if you're running it from an IDE, specify java version at the IDE start-up time
    • e.g. for eclipse, use start-up option -vm /path/to/java/6

For me, this solved the Failed to execute wsgen caused by com.sun.xml.bind.v2.runtime.IllegalAnnotationsException.

like image 152
charlie Avatar answered Dec 04 '22 11:12

charlie