3

JAX-WSおよびJAXBアノテーションを使用して新しいWebサービスを開発しようとしています。axis2に.jarをデプロイし、ブラウザーを開いて生成された.wsdlを取得すると、次のエラーが発生します。

[ERROR] Error occurred generating WSDL file for Web service implementation class {foo.bar.myServiceImpl}
java.lang.NoClassDefFoundError: com/sun/xml/ws/api/server/Container
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
        at java.lang.Class.getMethod0(Unknown Source)
        at java.lang.Class.getMethod(Unknown Source)
        at org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.generateWsdl(JAXWSRIWSDLGenerator.java:179)
        at org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.initialize(JAXWSRIWSDLGenerator.java:390)
        at org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.getWSDL(JAXWSRIWSDLGenerator.java:383)
        at org.apache.axis2.description.AxisService.printWSDL(AxisService.java:1394)
        at org.apache.axis2.transport.http.HTTPWorker.service(HTTPWorker.java:154)
        at org.apache.axis2.transport.http.server.AxisHttpService.doService(AxisHttpService.java:281)
        at org.apache.axis2.transport.http.server.AxisHttpService.handleRequest(AxisHttpService.java:187)
        at org.apache.axis2.transport.http.server.HttpServiceProcessor.run(HttpServiceProcessor.java:82)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.sun.xml.ws.api.server.Container
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 15 more

ソースを掘り下げると、com.sun.xml.ws.api.server.Containerがjaxws-rt実装の一部であり、Axis2ディストリビューションの一部ではないことに気付きました(/ lib /フォルダーに見つかりませんでした)。 )。どうしてこれなの?私はここでポイントを逃していますか?

4

2 に答える 2

2

はい、わかった。他の誰かが彼(または彼女)の頭を壁にぶつけないように、答えを投稿します。

システムに古いJAVA_HOME環境変数を設定しました。これはインストーラーJREを指していましたが、インストールされたJDKを指している必要があります。それで全部です。

于 2012-06-26T11:09:49.683 に答える
2

私も同じ問題を抱えていました。jaxws-maven-pluginに依存関係を追加する必要があります。これらの依存関係がないと、同じエラーが発生します

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxws-maven-plugin</artifactId>
            <configuration>
                <wsdlDirectory>src/main/resources/wsdl/</wsdlDirectory>
                <keep>true</keep>
                <sourceDestDir>${project.build.directory}/generated-sources/wsimport</sourceDestDir>
                <sei></sei>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>com.sun.xml.ws</groupId>
                    <artifactId>jaxws-rt</artifactId>
                    <version>2.1.4</version>
                </dependency>
                <dependency>
                    <groupId>com.sun.xml.ws</groupId>
                    <artifactId>jaxws-tools</artifactId> 
                    <version>2.1.4</version>
                </dependency>
            </dependencies>
            <executions>
                <execution>
                    <id>generate-from-wsdl</id>
                    <goals>
                        <goal>wsimport</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
于 2014-04-10T10:36:22.177 に答える