WebService之CXF注解报错(二)

WebService之CXF注解

1、具体报错如下

五月 04, 2014 11:24:12 下午 org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
信息: Creating Service {http://service.you.com/}IServiceService from class com.you.service.IService
五月 04, 2014 11:24:15 下午 org.apache.cxf.services.IServiceService.IServicePort.IService
信息: Outbound Message
---------------------------
ID: 1
Address: http://localhost:8080/PortalService/services/test
Encoding: UTF-8
Http-Method: POST
Content-Type: text/xml
Headers: {Accept=[*/*], SOAPAction=[""]}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:test xmlns:ns2="http://service.you.com/"><arg0><age>18</age><name>张三</name></arg0></ns2:test></soap:Body></soap:Envelope>
--------------------------------------
五月 04, 2014 11:24:16 下午 org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
警告: Interceptor for {http://service.you.com/}IServiceService#{http://service.you.com/}test has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
	at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:502)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:411)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:314)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:267)
	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:137)
	at $Proxy39.test(Unknown Source)
	at com.test.service.IServiceTest.main(IServiceTest.java:50)
Caused by: java.net.ConnectException: ConnectException invoking http://localhost:8080/PortalService/services/test: Connection refused: connect
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1355)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1339)
	at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:50)
	at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:223)
	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:635)
	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
	... 9 more
Caused by: java.net.ConnectException: Connection refused: connect
	at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
	at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
	at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
	at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
	at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
	at java.net.PlainSocketImpl.connect(Unknown Source)
	at java.net.SocksSocketImpl.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at sun.net.NetworkClient.doConnect(Unknown Source)
	at sun.net.www.http.HttpClient.openServer(Unknown Source)
	at sun.net.www.http.HttpClient.openServer(Unknown Source)
	at sun.net.www.http.HttpClient.<init>(Unknown Source)
	at sun.net.www.http.HttpClient.New(Unknown Source)
	at sun.net.www.http.HttpClient.New(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
	at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.setupWrappedStream(URLConnectionHTTPConduit.java:174)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1299)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(HTTPConduit.java:1255)
	at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.onFirstWrite(URLConnectionHTTPConduit.java:201)
	at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:47)
	at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:69)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1312)
	... 14 more

Exception in thread "main" javax.xml.ws.WebServiceException: Could not send Message.
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:148)
	at $Proxy39.test(Unknown Source)
	at com.test.service.IServiceTest.main(IServiceTest.java:50)
Caused by: java.net.ConnectException: ConnectException invoking http://localhost:8080/PortalService/services/test: Connection refused: connect
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1355)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1339)
	at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:50)
	at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:223)
	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:635)
	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
	at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:502)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:411)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:314)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:267)
	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:137)
	... 2 more
Caused by: java.net.ConnectException: Connection refused: connect
	at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
	at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
	at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
	at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
	at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
	at java.net.PlainSocketImpl.connect(Unknown Source)
	at java.net.SocksSocketImpl.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at sun.net.NetworkClient.doConnect(Unknown Source)
	at sun.net.www.http.HttpClient.openServer(Unknown Source)
	at sun.net.www.http.HttpClient.openServer(Unknown Source)
	at sun.net.www.http.HttpClient.<init>(Unknown Source)
	at sun.net.www.http.HttpClient.New(Unknown Source)
	at sun.net.www.http.HttpClient.New(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
	at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.setupWrappedStream(URLConnectionHTTPConduit.java:174)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1299)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(HTTPConduit.java:1255)
	at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.onFirstWrite(URLConnectionHTTPConduit.java:201)
	at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:47)
	at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:69)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1312)
	... 14 more

2、错误原因

未启动服务器,只运行Test类

3、解决办法

启动Tomcat服务器,重新运行Test测试类

WebService之CXF注解报错(二)

时间: 2024-10-14 13:56:59

WebService之CXF注解报错(二)的相关文章

WebService之CXF注解报错(三)

如果你对项目管理.系统架构有兴趣,请加微信订阅号"softjg",加入这个PM.架构师的大家庭 要成为WEB架构师,首先要找到通往成功的正确方向,接下来我们就要往这个方向努力.然而如唐僧去西天取经一样,要历经种种磨难,一路上打败各种妖魔鬼怪才能继续前行,所以唐僧取经,第一件事,就是招徒弟,遇见妖魔鬼怪就让技术高超的徒弟打败它,徒弟不听话就念紧箍咒,徒弟也搞不定的妖怪,就请观音菩萨搞定,这就是唐僧成功的法宝,没法宝上路,看来我们会死的比较惨啊,哈哈. 我们在通往架构师的路上,同样会遇到各

WebService之CXF注解报错(一)

WebService之CXF注解 1.具体报错如下 usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ] { -help | start | stop } 2014-5-4 22:42:12 org.apache.catalina.core.AprLifecycleListener init 信息: Loaded APR based Apache Tomcat Native li

WebService之CXF注解之二(Service接口)

ITeacherService.java: /** * @Title:ITeacherService.java * @Package:com.you.service * @Description:教师Service接口 * @author:Youhaidong(游海东) * @date:2014-5-5 下午11:06:24 * @version V1.0 */ package com.you.service; import javax.jws.WebMethod; import javax.j

java_tomcat_Server at localhost was unable to start within 45 seconds 小喵咪死活启动报错-二

错误:Server Tomcat v6.0 Server at localhost was unable to start within 45 seconds 错误提示就是我们限定了部署的时间导致的错误. 修改 workspace\.metadata\.plugins\org.eclipse.wst.server.core\servers.xml文件. 把其中的start-timeout="45" 改为  start-timeout="120" 或者更长,根据不同同

WebService之CXF注解之一(封装类)

Teacher.java: /** * @Title:Teacher.java * @Package:com.you.model * @Description:老师封装类 * @author:Youhaidong(游海东) * @date:2014-5-5 下午11:03:13 * @version V1.0 */ package com.you.model; import java.io.Serializable; /** * 类功能说明 * 类修改者 修改日期 * 修改说明 * <p>Ti

WebService之CXF注解之四(测试类)

TeacherTest.java: /** * @Title:TeacherTest.java * @Package:com.test.service * @Description: * @author:Youhaidong(游海东) * @date:2014-5-5 下午11:14:09 * @version V1.0 */ package com.test.service; import org.apache.cxf.interceptor.LoggingInInterceptor; imp

AndroidStudio3.0 注解报错Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor.

体验最新版AndroidStudio3.0 Canary 8的时候,发现之前项目的butter knife报错,用到注解的应该都会报错 Error:Execution failed for task ':app:javaPreCompileDebug'. > Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to

myeclipse 从svn检出项目后会出现 所有的spring注解报错的问题

myeclipse  从svn检出项目后会出现 所有的spring注解报错的问题  即使更换项目jdk 都不好使. 解决方法如下: 1. 刚检出的项目有可能是 jdk 1.5 一下版本编译的.你只需要切换  编译版本就OK了. 2. 步骤如下: (1)点击项目右键-->选择properties (2)从弹出的窗口中选择 java compiler-->然后选择 适合自己的 jdk 版本就可以了.选择完 apply 一下  选择 yes. 原文地址:https://www.cnblogs.com

在接口的实现类里使用@Override注解报错

问题分析 @Override注解用来检测子类对父类或接口的方法的重写是否正确,但有一次我在Eclipse里对接口的实现类里使用@Override注解却报错,不过在父类的子类里使用该注解却是正常的. 百度了下才知道原来这是jdk1.5时的一个bug,在1.6时已经被修复:那么问题来了,我使用的jdk是1.8,为什么会报这个错误?明明之前也在接口的实现类里用过该注解,却没问题.由于Eclipse经常抽风,我怀疑是Eclipse的问题,经过排查确实如此,该项目使用的jdk版本不知道为什么变成了jdk1