加入了你给的依赖"<dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-jaxws</artifactId> <version>3.4.4</version></dependency>"后,依然报错:"jakarta.xml.soap.SOAPException: Unable to create SAAJ meta-factory: Provider com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl not found at jakarta.xml.soap.SAAJMetaFactory.getInstance(SAAJMetaFactory.java:73) at jakarta.xml.soap.MessageFactory.newInstance(MessageFactory.java:126) at com.firstronix.webservice.WebServiceUtils.getSOAPMsgFactory(WebServiceUtils.java:86) at com.firstronix.webservice.WebServiceUtils.newBlankSOAPMessage(WebServiceUtils.java:136)",补充一点,我是在Polarion Server运行
时间: 2024-04-23 19:23:50 浏览: 136
根据错误信息,看起来是 SAAJ(SOAP with Attachments API for Java)的实现类没有找到导致的,可能是因为你的项目中缺少了 SAAJ 的实现类的依赖。
你可以尝试添加以下依赖来解决该问题:
```
<dependency>
<groupId>javax.xml.soap</groupId>
<artifactId>javax.xml.soap-api</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.messaging.saaj</groupId>
<artifactId>saaj-impl</artifactId>
<version>1.5.1</version>
</dependency>
```
如果还不行的话,你可以检查一下你的项目中是否存在多个版本的 SAAJ 实现类,导致冲突。如果存在多个版本的 SAAJ 实现类,你需要排除其中一个或多个版本的依赖。
希望能帮到你!
相关问题
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.xml.ws.Endpoint]: Factory method 'endpoint' threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/cxf/frontend/ServerFactoryBean at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:622) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE] ... 19 common frames omitted Caused by: java.lang.NoClassDefFoundError: org/apache/cxf/frontend/ServerFactoryBean at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_301] at java.lang.ClassLoader.defineClass(ClassLoader.java:756) ~[na:1.8.0_301] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.8.0_301] at java.net.URLClassLoader.defineClass(URLClassLoader.java:468) ~[na:1.8.0_301] at java.net.URLClassLoader.access$100(URLClassLoader.java:74) ~[na:1.8.0_301] at java.net.URLClassLoader$1.run(URLClassLoader.java:369) ~[na:1.8.0_301] at java.net.URLClassLoader$1.run(URLClassLoader.java:363) ~[na:1.8.0_301] at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_301] at java.net.URLClassLoader.findClass(URLClassLoader.java:362) ~[na:1.8.0_301] at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[na:1.8.0_301] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355) ~[na:1.8.0_301] at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[na:1.8.0_301] at org.apache.cxf.jaxws.EndpointImpl.<init>(EndpointImpl.java:164) ~[cxf-rt-frontend-jaxws-3.4.4.jar:3.4.4] at org.apache.cxf.jaxws.EndpointImpl.<init>(EndpointImpl.java:157) ~[cxf-rt-frontend-jaxws-3.4.4.jar:3.4.4] at org.apache.cxf.jaxws.EndpointImpl.<init>(EndpointImpl.java:171) ~[cxf-rt-frontend-jaxws-3.4.4.jar:3.4.4] at org.apache.cxf.jaxws.EndpointImpl.<init>(EndpointImpl.java:178) ~[cxf-rt-frontend-jaxws-3.4.4.jar:3.4.4]
根据错误信息显示,它无法找到org/apache/cxf/frontend/ServerFactoryBean类,这表明您的应用程序缺少CXF的JAR文件。您可以通过将以下依赖项添加到Maven POM文件中来解决此问题:
```xml
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-core</artifactId>
<version>3.3.6</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>3.3.6</version>
</dependency>
```
如果您不使用Maven,则需要手动下载这些JAR文件并将其添加到您的类路径中。
我需要cxf-core、cxf-rt-bindings-soap、cxf-rt-bindings-xml、cxf-rt-databinding-jaxb、cxf-rt-frontend-simple、 cxf-rt-ws-addr、cxf-rt-ws-policy、cxf-rt-wsdl、wsdl4j、xml-resolver、xmlschema-core这些jar包,给出我在pom文件中需要的maven依赖配置
你可以在你的pom文件中添加以下依赖配置:
```
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-core</artifactId>
<version>3.4.4</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-bindings-soap</artifactId>
<version>3.4.4</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-bindings-xml</artifactId>
<version>3.4.4</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-databinding-jaxb</artifactId>
<version>3.4.4</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-simple</artifactId>
<version>3.4.4</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-addr</artifactId>
<version>3.4.4</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-policy</artifactId>
<version>3.4.4</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-wsdl</artifactId>
<version>3.4.4</version>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>xml-resolver</groupId>
<artifactId>xml-resolver</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.apache.ws.xmlschema</groupId>
<artifactId>xmlschema-core</artifactId>
<version>2.2.5</version>
</dependency>
</dependencies>
```
请注意,这些依赖的版本可能会随着时间的推移而更新。建议在使用这些依赖时,查阅官方文档以获取最新版本信息。
阅读全文