Stumped on wsgen + maven configuration

10.3k views Asked by At

I've spent a whole day searching for a solution on how to get wsgen + maven to generate artifacts from my annotated class with no avail, always ending with the "Could not find class file" error.

My pom.xml looks like the following :

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxws-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>wsgen</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <sei>fr.extelia.ibabi.ws.convergence.impl.ServiceWSConvergence</sei>
                <keep>true</keep>
                <verbose>true</verbose>
                <sourceDestDir>target/generated-sources/artifacts</sourceDestDir>
                <packageName>fr.extelia.ibabi.ws.convergence.stub</packageName>
            </configuration>
            <dependencies>
            <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>
                    <version>2.2.5</version>
                </dependency>
            </dependencies>
        </plugin>

Besides, I tried generating the artifacts at command line with no better results :

wsgen -cp C:\workspace\ibabi\trunk\ibabi-ws\ibabi-ws-service\target\classes -keep -s C:/workspace/ibabi/trunk/ibabi-ws/ibabi-ws-service/target/generated-sources/artifacts fr.extelia.ibabi.ws.convergence.impl.ServiceWSConvergence

PS : I'm using the "classes" folder as the location of the endpoint class at command line. Using the src folder just returns an error with the command line input description.

Any help on this would really appreciated

Thanks

2

There are 2 answers

1
Baha On BEST ANSWER
  1. Using command line wsgen

    wsgen -cp C:\workspace\ibabi\trunk\ibabi-ws\ibabi-ws-service\target\classes 
    -keep -s C:/workspace/ibabi/trunk/ibabi-ws/ibabi-ws-service/target/generated-       
    sources/artifacts 
    fr.extelia.ibabi.ws.convergence.impl.ServiceWSConvergence
    

    When running wsgen command, first confirm source folder is C:/workspace/ibabi/trunk/ibabi-ws/ibabi-ws-service/target/generated-sources/artifacts and class files are generated inside C:\workspace\ibabi\trunk\ibabi-ws\ibabi-ws-service\target\classes. Before running wsgen, fr.extelia.ibabi.ws.convergence.impl.ServiceWSConvergence bytecode file should be inside C:\workspace\ibabi\trunk\ibabi-ws\ibabi-ws-service\target\classes.

  2. Using Maven

    Use dependency from org.jvnet.jax-ws-commons instead of org.codehaus.mojo. org.codehaus.mojo plugin has been migrated to org.jvnet.jax-ws-commons.
    Refer different valid options for maven wsgen from http://jax-ws-commons.java.net/jaxws-maven-plugin/wsgen-mojo.html If project is based on default maven project structure, following sample snippet will work.

    <build>
      <pluginManagement>
        <plugins>              
            <plugin>
                <groupId>org.jvnet.jax-ws-commons</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <version>2.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>wsgen</goal>
                        </goals>
                    </execution>
                </executions>
    
                <configuration>
                    <sei>fr.extelia.ibabi.ws.convergence.impl.ServiceWSConvergence</sei>
                    <sourceDestDir>src/main/java</sourceDestDir>
                </configuration>
    
                <dependencies>
                    <dependency>
                        <groupId>com.sun.xml.ws</groupId>
                        <artifactId>jaxws-tools</artifactId>
                        <version>2.2.5</version>
                    </dependency>
                </dependencies>
              </plugin>
          </plugins>
        </pluginManagement>
    </build>
    

If you still get problem, please post your project structure.

0
zapryano On

You don't need to define the target, but first to compile the service impl class. mvn compile