首先要求:
我需要编写使用SOAP服务的代码并将其构建为可以在Apache Sling中部署的OSGi包。使用Maven 3.0.3
完成构建到目前为止我做了什么:
我创建了一个maven模块,并使用它来生成SOAP客户端类:https://jax-ws-commons.java.net/jaxws-maven-plugin/usage.html。我不得不删除插件依赖jaxws-tools版本2.2.5,因为它不支持wsimport的-encoding参数。删除它会自动下载2.2.8版,它可以正常工作,因为它是POM的依赖项。
接下来,我将包类型更改为bundle并包含maven-bundle-plugin和maven-scr-plugin,以将生成的代码打包为OSGi包并使用Maven构建它
最后,我将其部署到作为独立应用程序在本地运行的Sling。
以下是我在给定顺序中遇到的问题:
添加了未解决的类似软件包,其中包括:
javax.xml.ws javax.xml.ws.handler中 javax.xml.ws.spi javax.xml.ws.spi.http javax.xml.ws.wsaddressing
根本原因:org.apache.felix.http.jetty找不到java.lang.ClassNotFoundException:com.sun.xml.internal.ws.spi.ProviderImpl
这是我遇到障碍的地方,我无法通过。
到目前为止,我根据谷歌上的众多答案解决了这个问题
我正在使用Maven 3.0.3,JDK 1.6.0_43,Apache Sling org.apache.sling.launchpad.base.jar 2.4.0所有这些都在我的Mac Book Pro OSX 10.8.5上运行 这是我的POM片段与此问题相关。如果需要更多信息,我也可以提供相同的信息
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Private-Package>
<!--javax.jws,-->
javax.xml.ws,
javax.xml.ws.handler,
javax.xml.ws.spi,
javax.xml.ws.spi.http,
javax.xml.ws.wsaddressing
</Private-Package>
<!--
<Export-Package>
com.sun.xml.internal.ws.spi
</Export-Package>
<Import-Package>
!javax.xml.ws,*
</Import-Package>
-->
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- The name of your generated source package -->
<packageName>com.mycompany.mypackage</packageName>
<wsdlUrls>
<wsdlUrl>http://localhost/mysoapservice?WSDL</wsdlUrl>
</wsdlUrls>
<extension>true</extension>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<endorseddirs>${project.build.directory}/endorsed</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/endorsed</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.7</version>
<type>jar</type>
</artifactItem>
<artifactItem>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.2.9</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
非常感谢任何帮助。等待预期的回应。