CXF WebService的春季配置得到了java.lang.NoClassDefFoundError:javax / xml / ws / EndpointReference

Ame*_*hli 4 java spring web-services cxf

我正在尝试使CXF与weblogic上的maven弹簧一起使用。项目可以很好地进行编译/构建,但是当我尝试部署它时,出现了以下错误:

  <User defined listener org.springframework.web.context.ContextLoaderListener failed:    org.springframework.beans.factory.BeanCreationException: Error creating bean with name   'ibanInfos': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/ws/EndpointReference.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ibanInfos': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/ws/EndpointReference
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    at  org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    Truncated. see log file for complete stacktrace
java.lang.NoClassDefFoundError: javax/xml/ws/EndpointReference
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2395)
    at java.lang.Class.getDeclaredMethods(Class.java:1763)
    at java.beans.Introspector$1.run(Introspector.java:1265)
    at java.security.AccessController.doPrivileged(Native Method)
Run Code Online (Sandbox Code Playgroud)

任何想法如何解决这个问题?实际上,我使用的是Java first策略来生成WSDL。

这是我的春季文件:

  <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:jaxws="http://cxf.apache.org/jaxws"
    xsi:schemaLocation="
http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
    <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
    <import resource="classpath:service-definition-beans.xml"/> 
    <jaxws:endpoint id="ibanInfos" implementor="#ibanInfosService" address="http://localhost:7001/IbanInfos" />  
</beans>
Run Code Online (Sandbox Code Playgroud)

Kev*_*sox 6

确保您的类路径中有jaxws-api-2.1.jar

可以通过上面的链接或从Maven下载。

<dependency>
    <groupId>javax.xml.ws</groupId>
    <artifactId>jaxws-api</artifactId>
    <version>2.2.8</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)


Ame*_*hli 1

我终于发现了问题:我实际上在10.0版本下使用weblogic,它提供不包含EndPointInterface的Jaxws2.0。解决方法是将 jar 添加到 setDomainEnv.sh 中,它将完美运行。非常感谢你的回答。