WSDLServiceFactory的构造函数中的NPE

时间:2017-03-30 13:55:16

标签: java spring cxf

面对与此处提及的相同问题: https://issues.apache.org/jira/browse/CXF-2171

spring配置包含

HttpClient

从远程web服务加载wsdl,一切正常 在另一个配置文件中发生问题时,尝试创建新的cxf webservice。配置如下:

<bean id="testProxy" class="test.TestProxyImpl">
    <property name="testEndPoint" ref="testService"/>
</bean>

<bean id="testService" class="test.jaxws.testServiceImpl">
       <property name="serviceInterface" value="test.jaxws.testServiceEndPoint"/>
        <property name="wsdlDocumentUrl" value="${test.service.URL}"/>
        <property name="username" value="${test.username}"/>
        <property name="password" value="${test.password}"/>
    </bean>

现在我收到错误:

<import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> 

<jaxws:endpoint
       id="HelloWorld"
       implementor="test.ws.HelloWorldImpl"
       address="/hello" />

在这里,我想使用外部Web服务,并使用apache cxf创建新的Web服务。 有什么建议吗?

注意:它不是maven项目。由于一切都适用于第一个配置文件,因此无法更改cxf lib版本。

在类路径中运行tomcat 6和cxf libs是:

 Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testService' defined in ServletContext resource [/WEB-INF/classes/spring/adptContext.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1336)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:471)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
... 55 more

    Caused by: java.lang.NullPointerException
at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:81)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:299)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:392)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:180)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:163)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:79)
at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:51)
at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:97)
at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:115)

0 个答案:

没有答案