【问题标题】:Maven JAX-WS WSGEN "Class not found error"Maven JAX-WS WSGEN“找不到类错误”
【发布时间】:2012-03-23 18:53:52
【问题描述】:

当我尝试编译我的程序时。我收到以下错误消息:

Failed to execute goal org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.2:wsgen (generate-wsdl) on project SimpleWebServices: Error executing: wsgen [-keep, -s, etc..........

所以,我开始四处寻找并进一步发现错误,我看到了这个:

Class not found: "com.test.ws.services.SimpleServiceImpl"

似乎由于某种原因,WSGEN 无法找到我的价值。有没有人有任何想法?

如果有兴趣,这是我的 POM……

        <plugin>
            <groupId>org.jvnet.jax-ws-commons</groupId>
            <artifactId>jaxws-maven-plugin</artifactId>
            <version>2.2</version>
            <executions>
                <execution>
                    <id>generate-wsdl</id>
                    <phase>process-classes</phase>
                    <goals>
                        <goal>wsgen</goal>
                    </goals>
                    <configuration>
                        <sei>com.test.ws.services.SimpleServiceImpl</sei>
                        <genWsdl>true</genWsdl>
                        <verbose>true</verbose>
                    </configuration>
                </execution>
            </executions>
        </plugin>

用户编辑: 我想我明白了(基于@Thomas 的建议)。看来我没有在 POM 构建区域中指定源文件夹。导致我的源代码没有被编译。

添加:

<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>

为我做了诀窍。

@Thomas 如果您发布您的答案,我很乐意为您提供答案。

感谢您的回复,

【问题讨论】:

  • 看起来是类路径问题,你有包含 SimpleServiceImpl 的包吗?
  • 你的意思是SimpleServiceImpl也生成了(因为${project.basedir}target/目录)?
  • 我的代码都没有被编译(一开始我没有注意到)。所以在 POM 中,我指定了 sourceDirectory。这似乎将我的源代码包含在编译中,其余的都是历史......
  • 很好奇 &lt;sourceDirectory&gt; 的定义解决了这个问题,因为路径 ${project.basedir}/src/main/java 是默认路径。

标签: java maven jax-ws wsgen


【解决方案1】:

随便用

mvn clean compile jaxws:wsgen

而不是

mvn clean jaxws:wsgen

问题是,没有可用的编译版本。 wsgen 将适用于类路径,例如带有 ByteCode 的 JAR。

sourceDirectory ${project.basedir}/src/main/java 是 maven 默认的,所以你不必设置它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-20
    • 2012-03-08
    相关资源
    最近更新 更多