cxf集成spring
最近用cxf框架写了一个webservice,在tomcat下什么问题也没有。部署到weblogic没问题,可以根据服务地址查看wsdl文件。但是用cxf测试客户端:代码如下:
/*
* CXF客户端测试;
*/
public static void testCxfClient() throws Exception {
JaxWsProxyFactoryBean jwpfb = new JaxWsProxyFactoryBean();
jwpfb.setServiceClass(com.service.HelloWorld.class);
jwpfb.setAddress("http://localhost:7001/CXFWebService/webservice/HelloWorldService?wsdl");
HelloWorld hw = (HelloWorld) jwpfb.create();
String text = hw.sayHi("abc");
System.out.println(text);
}
就会报下面错。
2013-7-5 12:00:33 org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
信息: Creating Service {http://service.com/}HelloWorldService from class com.service.HelloWorld
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Cannot create a secure XMLInputFactory
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:155)
at $Proxy40.sayHi(Unknown Source)
at com.TestWebService.testCxfClient(TestWebService.java:19)
at com.TestWebService.main(TestWebService.java:34)
Caused by: org.apache.cxf.binding.soap.SoapFault: Cannot create a secure XMLInputFactory
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:84)
这是怎么回事啊? cxf weblogic --------------------编程问答-------------------- 把所有的jar都加进去 --------------------编程问答-------------------- 加了后报下面错:
严重: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'helloWorld': Invocation of init method failed; nested exception is javax
.xml.ws.WebServiceException: java.lang.IllegalArgumentException: Cannot create U
RL for this address soap.udp://239.255.255.250:3702
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1422)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:518)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:455)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean --------------------编程问答-------------------- spring 已经过时了,还用它干嘛 --------------------编程问答-------------------- spring已经过时了?您现在用什么呢? --------------------编程问答-------------------- 遇到相同问题,请教楼主怎么解决的 --------------------编程问答-------------------- 刚整合了一次,传送门照着这个弄吧,应该没问题。jar包就用cxf自带的包 --------------------编程问答-------------------- 这个问题到后来有没有解决啊,我遇到了相同的问题。而且还很急,请大神指教啊。 --------------------编程问答--------------------
jar 和XML 配置好
--------------------编程问答-------------------- jwpfb.setAddress("http://localhost:7001/CXFWebService/webservice/HelloWorldService?wsdl");这个后面不用"?wsdl"吧,去掉它。 --------------------编程问答--------------------
+1
http://download.csdn.net/detail/s478853630/4902664
这个资源不需要spring,在webservice服务可用的情况下,调用方的main方法中就能运行
补充:Java , Web 开发