webservice服务报Connection reset 200C

webservice客户端(用的是axis1.4)调用webservice服务的时候报java.net.SocketException: Connection reset。是什么问题造成的呢。服务端和客户端都在同一台服务器
客户端调用方法
queryUserRequest = new QueryUserRequest();
queryUserRequest.setObject(devices);
queryUserRequest.setRequestId(reqSeq);
queryUserRequest.setRequestTime(StringTools.getCurrentDate());
log.debug("鉴权请求 :\n" + xstream.toXML(queryUserRequest));
UvcSoapForCrmService service = new UvcSoapForCrmServiceLocator();
UvcSoapForCrm ocs = service.getcrm();
queryUserResponse = ocs.queryUser(queryUserRequest);
queryUserResponse的响应消息的不到,然后客户端会捕获一个java.net.SocketException: Connection reset异常 求解决。 服务端方面没有收到客户端发来的请求消息

1个回答

java.net.SocketException:该异常在客户端和服务器端均有可能发生,引起该异常的原因有两个,第一个就是如果一端的Socket被关闭(或主动关闭或者因为异常退出而引起的关闭),另一端仍发送数据,发送的第一个数据包引发该异常(Connect reset by peer)。另一个是一端退出,但退出时并未关闭该连接,另一端如果在从连接中读数据则抛出该异常(Connection reset)。简单的说就是在连接断开后的读和写操作引起的。
当访问url达到一定数量的时候或者连接已关闭是客户端仍在发送请求导致无法接收,就报了connection reset的错误。

HackAge4619
写给初学者的几封信 回复baidu_36592086: 你所问的问题中并没有体现你想知道是什么代码导致的错误,所以当你看完别人的回答后,说得像你什么都懂了一样,只是解决不了新的问题而已!
大约 3 年之前 回复
baidu_36592086
baidu_36592086 这个我也知道,我想知道的是代码中哪里有问题导致出现这个错误。相关字符流还有建立的连接在消息发送完成后都会关掉
大约 3 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
webservice接口报连接重置错误

webservice客户端(用的是axis1.4)调用webservice服务的时候报java.net.SocketException: Connection reset。是什么问题造成的呢。服务端和客户端都在同一台服务器 客户端调用方法 queryUserRequest = new QueryUserRequest(); queryUserRequest.setObject(devices); queryUserRequest.setRequestId(reqSeq); queryUserRequest.setRequestTime(StringTools.getCurrentDate()); log.debug("鉴权请求 :\n" + xstream.toXML(queryUserRequest)); UvcSoapForCrmService service = new UvcSoapForCrmServiceLocator(); UvcSoapForCrm ocs = service.getcrm(); queryUserResponse = ocs.queryUser(queryUserRequest); queryUserResponse的响应消息的不到,然后客户端会捕获一个java.net.SocketException: Connection reset异常 求解决。 服务端方面没有收到客户端发来的请求消息

android调webservice出现 (Connection reset by peer)

sunnyinfo.myapplication D/IOException: +++++++++++++++++++++++java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: at libcore.io.IoBridge.maybeThrowAfterRecvfrom(IoBridge.java:592) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: at libcore.io.IoBridge.recvfrom(IoBridge.java:556) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: at java.net.PlainSocketImpl.read(PlainSocketImpl.java:485) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:37) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:237) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: at com.android.okio.Okio$2.read(Okio.java:113) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: at com.android.okio.RealBufferedSource.indexOf(RealBufferedSource.java:147) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: at com.android.okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:94) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: at com.android.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:175) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: at com.android.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:101) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:616) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:379) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:323) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:491) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: at org.ksoap2.transport.ServiceConnectionSE.getResponseCode(ServiceConnectionSE.java:103) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:197) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:118) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:113) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: at com.sunnyinfo.myapplication.WebServiceUtils$2.run(WebServiceUtils.java:131) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 03-14 17:51:27.073 20045-20211/com.sunnyinfo.myapplication W/System.err: at java.lang.Thread.run(Thread.java:818) ``` ```

java 获取服务器数据,报SocketException connection reset 异常 怎么解决异常,让程序继续执行。。

我用Jsoup 爬取网站数据时,设置了延时时间,但爬到一部分时会Connection reset.![图片说明](https://img-ask.csdn.net/upload/201902/27/1551267442_315066.jpg) 我的请求代码如下: ![图片说明](https://img-ask.csdn.net/upload/201902/27/1551267468_60307.jpg) 这里面为什么不可以添加SocketException 的异常,它确实在这个地方报了这个异常呀。。。。。。。。。。 我想知道出现connection reset后,怎么重连,继续把剩下的任务做完。。。。。

java请求https接口,connection reset

nginx下配好https证书,java 请求https接口会reset。tomcat下配好证书,就没有问题。

基于AXIS调用webservice报错:Connection refused: connect

我的调用方法: public static void main(String[] args) throws Exception { String client_id = "HeYiApp"; String orderNum = "2"; List numberList = new ArrayList(); numberList.add("120719"); numberList.add("120746"); numberList.add("113095"); String webUrl = "https://10.218.132.26/api/openapi/employee/getBatchEmpInfoList.json";// 服务端url地址 String webMethod = "getBatchEmpInfoList";// 调用方法名称 Service service = new Service(); // 建服务 Call call; try { call = (Call) service.createCall(); try { call.setTargetEndpointAddress(new URL(webUrl)); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); }// 设置访问地址 call.setOperationName(webMethod);// 设置访问方法 call.addParameter("arg0", XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);// 定义参数 call.addParameter("arg1", XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);// 定义参数 call.addParameter("arg2", XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);// 定义参数 call.setReturnType(XMLType.XSD_STRING);// 定义返回值格式 //List<Map<String, Object>> workersInfo= (List<Map<String, Object>>) call.invoke(new Object[] { client_id, numberList, orderNum }); //for(Map m:workersInfo){ // System.out.println(m.get("name")); //} JSONArray jsonObject = (JSONArray) call.invoke(new Object[] { client_id, numberList, orderNum }); System.out.println(jsonObject.toString()); } catch (ServiceException e) { // TODO Auto-generated catch block e.printStackTrace(); } // 建对话 } 报错: Exception in thread "main" AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: java.net.ConnectException: Connection refused: connect faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}stackTrace:java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668) at sun.security.ssl.SSLSocketImpl.&lt;init&gt;(SSLSocketImpl.java:427) at sun.security.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:88) at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:92) at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191) at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404) at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165) at org.apache.axis.client.Call.invokeEngine(Call.java:2784) at org.apache.axis.client.Call.invoke(Call.java:2767) at org.apache.axis.client.Call.invoke(Call.java:2443) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812) at webservice.Test.main(Test.java:52) {http://xml.apache.org/axis/}hostname:zhangxl java.net.ConnectException: Connection refused: connect at org.apache.axis.AxisFault.makeFault(AxisFault.java:101) at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:154) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165) at org.apache.axis.client.Call.invokeEngine(Call.java:2784) at org.apache.axis.client.Call.invoke(Call.java:2767) at org.apache.axis.client.Call.invoke(Call.java:2443) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812) at webservice.Test.main(Test.java:52) Caused by: java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668) at sun.security.ssl.SSLSocketImpl.<init>(SSLSocketImpl.java:427) at sun.security.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:88) at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:92) at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191) at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404) at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138) ... 10 more

ksoap访问webservice出现SocketException

ksoap访问服务器一个接口,会随机出现java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer) 只有这个接口访问会随机出现异常,其他的接口都能正常访问.服务器php写的webservice.....求大神解答 困扰好几天的问题

Webservice客户端调用服务端时,服务端一直报错

这个是服务端报错信息: 十一月 18, 2016 2:19:39 下午 org.apache.cxf.phase.PhaseInterceptorChain doIntercept 警告: Application has thrown exception, unwinding now org.apache.cxf.interceptor.Fault at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:148) at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:83) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:114) at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:55) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:68) at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:98) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:104) at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:99) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:452) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:196) at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:220) at org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java:153) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at org.apache.cxf.transport.servlet.AbstractCXFServlet.service(AbstractCXFServlet.java:211) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.hyjx.framework.interceptor.XSSFilter.doFilter(XSSFilter.java:73) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NullPointerException at com.hyjx.framework.service.Ddzh_hdxxWebServiceImpl.getOneZhiXingAjxx(Ddzh_hdxxWebServiceImpl.java:39) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:166) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:82) ... 35 more 下面是客户端调用时的方法(客户端现在不能修改只能改服务端):/** * 执行远程调用,单例模式调用 * * @param url * wsdl URL * @param invokeFunc * 调用方法 * @param objArray * 参数 * @return * @throws Exception */ public static String remoteCall(String url, String invokeFunc, Object... param) { Client client = null; ClientPool pool = ClientPool.getInstance(url); LOGGER.debug("执行webservice使用参数:" + Arrays.toString(param)); LOGGER.debug("执行webservice调用方法:" + invokeFunc); try { client = pool.get(); if (null == client) { return CONNECT_TIMED_OUT; } return executeRemoteCall4String(client, invokeFunc, param); } catch (Exception e) { LOGGER.error("执行webservice调用失败,尝试重新初始化客户端后调用", e); pool.destory(client); client = pool.get(); try { return executeRemoteCall4String(client, invokeFunc, param); } catch (Exception e1) { LOGGER.error("error ro invoke function: " + invokeFunc + ", where remote call url=" + url + " and params:" + Arrays.toString(param)); } } finally { pool.reuse(client); } return null; } /** * 用指定客户端执行远程调用 * * @param Client * Client * @param invokeFunc * 调用方法 * @param objArray * 参数 * @return * @throws Exception */ private static String executeRemoteCall4String(Client client, String invokeFunc, Object[] objArray) throws Exception { if (client == null) { return null; } Object[] results = client.invoke(invokeFunc, objArray); if (results != null && results.length > 0) { String resultStr = (String) results[0]; LOGGER.debug("执行webservice返回结果:" + resultStr); return resultStr; } return null; }

Android 通过webservice调用 上传图片数据 报错

SoapFault - faultcode: 'soap:Client' faultstring: 'Invalid operation: {http://service.BSInfo.dustcontrol.webservice.client.dekn.com.cn}addBSInfo' faultactor: 'null' detail: null 这是什么原因啊 求大神知道啊 啊啊啊啊

https接口添加信任证书问题

调用别人接口时报错。证书已经添加到jdk cacerts中,jdk1.7,网上说的替换local_policy两个jar也替换过了。还是javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure这个错误。求大神解答,积极急急急,在线等![图片说明](https://img-ask.csdn.net/upload/201708/21/1503291495_860765.png)

java webservice 接口调用异常

基于CXF开发的java端接口,部署到服务器上,偶尔出现这样的问题:客户那边提示我已经调用过接口了,但是我没有收到返回值,也没有生成调用日志。 调用客户接口之前,首先我会将收到的参数封装成json字符串,然后将json字符串写入服务器的一个txt文档,接着调用客户接口,然后解析客户返回的json数据,返回的结果也会写入txt文档中。但是偶尔出现的问题是:客户那边的接口已经调用过了,我这边没有日志写入txt,导致以为接口没有调用过,反复回写。 不知道这是什么原因造成的?本地调试是没有问题的。![图片说明](https://img-ask.csdn.net/upload/201707/31/1501486565_37402.png)

java调用webservice接口出现如下错误,求指教。

![图片说明](https://img-ask.csdn.net/upload/201601/22/1453429977_524712.png) 找了好久也没有找到类似的问题,有没有大神知道是怎么回事?

java webservice项目遇到连接失败问题

请教各位大神,我们系统抛的问题,一直持续20分钟连接失败,是webservice项目 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:262) at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:532) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:464) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:367) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:320) at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:89) at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134) at com.sun.proxy.$Proxy187.querySingle(Unknown Source) at com.internetfinance.webservice.client.impl.ID5ServiceImpl.policeCheckService(ID5ServiceImpl.java:76) at com.internetfinance.businessImpl.id5.action.PoliceCheckAction.fetchFromThird(PoliceCheckAction.java:100) at com.internetfinance.business.ServiceTemplate.templateMethod(ServiceTemplate.java:173) at com.internetfinance.businessService.handler.RequestHandler.queryInfoByService(RequestHandler.java:136) at com.internetfinance.webservice.CreditInfoExtWebservice.queryServiceItemByCode(CreditInfoExtWebservice.java:171) at sun.reflect.GeneratedMethodAccessor180.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:178) at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:64) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75) at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:107) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:122) at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:211) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:213) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:193) at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:129) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:187) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:110) at javax.servlet.http.HttpServlet.service(HttpServlet.java:648) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:166) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:283) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2463) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2452) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) Caused by: java.net.SocketException: SocketException invoking http://gboss.id5.cn/services/QueryValidatorServices: Connection reset at sun.reflect.GeneratedConstructorAccessor163.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1457) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1442) at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:658) at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) ... 78 more Caused by: java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:196) at java.net.SocketInputStream.read(SocketInputStream.java:122) at java.io.BufferedInputStream.fill(BufferedInputStream.java:235) at java.io.BufferedInputStream.read1(BufferedInputStream.java:275) at java.io.BufferedInputStream.read(BufferedInputStream.java:334) at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687) at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:633) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1324) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1577) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1520) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1428) ... 81 more

android开发,调用webservice报错,求指导一下,感激不尽

java.net.SocketException: sendto failed: ECONNRESET (Connection reset by peer)

客户端调用web service服务异常

我是一个菜鸟,现在正在学着用wsdl、stub、连接webservice 现在出现的问题是: org.apache.axis2.AxisFault: Exception occurred while trying to invoke service method ReadClientDBByStrings at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531) at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) at com.estar.test.ws.ReadDataBaseStub.readClientDBByStrings(ReadDataBaseStub.java:255) at com.estar.test.ws.testWebServices.main(testWebServices.java:36) 报这个错,不知道怎么解决,stub生成的两个文件应该是没错的,http://127.0.0.1:8099/webservice/services/ReadDataBase?wsdl连接也是可以成功的。 其中wsdl中的这部分的name应该是args,并且应该是6个,这块怎么改: <xs:sequence> <xs:element minOccurs="0" name="username" nillable="true" type="xs:string"/> <xs:element minOccurs="0" name="pwd" nillable="true" type="xs:string"/> <xs:element minOccurs="0" name="CustomSearch" nillable="true" type="xs:anyType"/> <xs:element maxOccurs="unbounded" minOccurs="0" name="CustomColumn" nillable="true" type="xs:string"/> <xs:element minOccurs="0" name="SearchTableName" nillable="true" type="xs:string"/> </xs:sequence> 这是测试类,不是我写的,所以也不知道是什么意思: public static void main(String[] args) { ReadDataBaseStub ms = null; try { System.out.println("----------------------getdata--------------------------------"); // 创建CallServiceStub对象,参数为webservice的wsdl地址 // DESPlus des = new DESPlus("estarcom");//自定义密�? String x = "2"; System.out.println(x.equalsIgnoreCase("2")); ms = new ReadDataBaseStub( "http://127.0.0.1:8099/webservice/services/ReadDataBase?wsdl"); System.out.println("1111111111111111111111111111"); ReadDataBaseStub.ReadClientDBByStrings rcbs = new ReadDataBaseStub.ReadClientDBByStrings(); String[] col = new String[2]; col[0] = "MC"; col[1] = "LX"; String[] fi = new String[1]; fi[0] = "MC like '%公司%'"; rcbs.setUsername("fr_select"); rcbs.setPwd("fr_select"); rcbs.setColumn(col); rcbs.setFilters(fi); rcbs.setTableName("T_FR_JBXX"); ReadClientDBByStringsResponse response = ms.readClientDBByStrings(rcbs); String retValue = response.get_return();// 获取到接口返回数�? System.out.println("retValue is : " + retValue); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } } 烦请哪位大神可以帮忙解决下

cxf webservice客户端和服务端报错

服务端报错: Caused by: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Connection reset by peer org.apache.cxf.binding.soap.SoapFault: Error writing to XMLStreamWriter. at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInterceptor.handleMessage(SoapOutInterceptor.java:288) at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInterceptor.handleMessage(SoapOutInterceptor.java:270) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263) at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:104) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:323) at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:77) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:118) at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:208) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:205) at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:113) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:648) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:163) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1521) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1478) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) Caused by: javax.xml.stream.XMLStreamException: No element was found to write: java.lang.ArrayIndexOutOfBoundsException: -1 at com.sun.xml.internal.stream.writers.XMLStreamWriterImpl.writeEndElement(XMLStreamWriterImpl.java:941) at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInterceptor.handleMessage(SoapOutInterceptor.java:279) ... 40 more Caused by: java.lang.ArrayIndexOutOfBoundsException: -1 at com.sun.xml.internal.stream.writers.XMLStreamWriterImpl$ElementStack.pop(XMLStreamWriterImpl.java:1976) at com.sun.xml.internal.stream.writers.XMLStreamWriterImpl.writeEndElement(XMLStreamWriterImpl.java:916) ... 41 more 客户端报: org.apache.cxf.interceptor.Fault: Unmarshalling Error: ParseError at [row,col]:[1,68437] Message: Premature EOF at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:791) at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:632) at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:156) at org.apache.cxf.binding.soap.interceptor.RPCInInterceptor.handleMessage(RPCInInterceptor.java:178) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263) at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:762) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1582) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1467) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1375) at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:623) at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263) at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:510) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:440) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:343) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:295) at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73) at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124) at $Proxy34.hquery(Unknown Source) at DCC.client.WebServiceThread.queryWebserviceSend(WebServiceThread.java:83) at DCC.client.WebServiceThread.run(WebServiceThread.java:240) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722) Caused by: javax.xml.bind.UnmarshalException - with linked exception: [javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,68437] Message: Premature EOF] at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:421) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:357) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:334) at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:768) ... 24 more Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,68437] Message: Premature EOF at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:596) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:182) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:355) ... 26 more

重启服务器后,tomcat可以跑起来,但是无法进入系统,只有登录界面。

``` ERROR MiddleSmallScaleManageWebService - 获取key值 org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Connection reset) at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:241) ~[spring-jdbc-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:372) ~[spring-tx-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:417) ~[spring-tx-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:255) ~[spring-tx-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94) ~[spring-tx-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91) ~[spring-aop-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:633) ~[spring-aop-3.2.8.RELEASE.jar:3.2.8.RELEASE] at com.nari.business.UserManageBizService$$EnhancerBySpringCGLIB$$3191eefd.createUserManagerKey(<generated>) ~[spring-core-3.2.8.RELEASE.jar:na] at com.nari.webservice.MiddleSmallScaleManageWebService.getUpdateKey(MiddleSmallScaleManageWebService.java:99) ~[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_11] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_11] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_11] at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_11] at com.antunnel.ws.AntunnelWSMethodHandler.invokeServiceMethod(AntunnelWSMethodHandler.java:58) [antunnel-ws-0.0.1.54304.jar:na] at com.antunnel.ws.gateway.AntunnelWSGateway.doInvokeServiceMethod(AntunnelWSGateway.java:279) [antunnel-ws-0.0.1.54304.jar:na] at com.antunnel.ws.gateway.AntunnelWSGateway.submit(AntunnelWSGateway.java:128) [antunnel-ws-0.0.1.54304.jar:na] at com.antunnel.ws.AntunnelWSServlet.service(AntunnelWSServlet.java:34) [antunnel-ws-0.0.1.54304.jar:na] at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) [servlet-api.jar:na] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [catalina.jar:8.5.40] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.40] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-websocket.jar:8.5.40] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.40] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.40] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) [spring-web-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.40] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.40] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) [catalina.jar:8.5.40] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [catalina.jar:8.5.40] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493) [catalina.jar:8.5.40] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) [catalina.jar:8.5.40] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [catalina.jar:8.5.40] at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660) [catalina.jar:8.5.40] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [catalina.jar:8.5.40] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [catalina.jar:8.5.40] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798) [tomcat-coyote.jar:8.5.40] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-coyote.jar:8.5.40] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808) [tomcat-coyote.jar:8.5.40] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498) [tomcat-coyote.jar:8.5.40] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:8.5.40] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [na:1.7.0_11] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [na:1.7.0_11] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.5.40] at java.lang.Thread.run(Thread.java:722) [na:1.7.0_11] Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Connection reset) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1225) ~[commons-dbcp-1.2.2.jar:1.2.2] at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880) ~[commons-dbcp-1.2.2.jar:1.2.2] at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:203) ~[spring-jdbc-3.2.8.RELEASE.jar:3.2.8.RELEASE] ... 45 common frames omitted Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1352) ~[sqljdbc4-3.0.jar:na] at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1339) ~[sqljdbc4-3.0.jar:na] at com.microsoft.sqlserver.jdbc.TDSChannel.read(IOBuffer.java:1654) ~[sqljdbc4-3.0.jar:na] at com.microsoft.sqlserver.jdbc.TDSReader.readPacket(IOBuffer.java:3694) ~[sqljdbc4-3.0.jar:na] at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:5026) ~[sqljdbc4-3.0.jar:na] at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:4978) ~[sqljdbc4-3.0.jar:na] at com.microsoft.sqlserver.jdbc.SQLServerConnection$1ConnectionCommand.doExecute(SQLServerConnection.java:1441) ~[sqljdbc4-3.0.jar:na] at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4575) ~[sqljdbc4-3.0.jar:na] at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1400) ~[sqljdbc4-3.0.jar:na] at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectionCommand(SQLServerConnection.java:1446) ~[sqljdbc4-3.0.jar:na] at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:1907) ~[sqljdbc4-3.0.jar:na] at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:41) ~[sqljdbc4-3.0.jar:na] at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:1893) ~[sqljdbc4-3.0.jar:na] at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4575) ~[sqljdbc4-3.0.jar:na] at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1400) ~[sqljdbc4-3.0.jar:na] at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1045) ~[sqljdbc4-3.0.jar:na] at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:817) ~[sqljdbc4-3.0.jar:na] at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:700) ~[sqljdbc4-3.0.jar:na] at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:842) ~[sqljdbc4-3.0.jar:na] at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38) ~[commons-dbcp-1.2.2.jar:1.2.2] at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294) ~[commons-dbcp-1.2.2.jar:1.2.2] at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1247) ~[commons-dbcp-1.2.2.jar:1.2.2] at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1221) ~[commons-dbcp-1.2.2.jar:1.2.2] ... 47 common frames omitted INFO AntunnelWSGateway - 调用服务方法:nari.middlesmallscale.manage.login(1.0) LoginRequestParam5i78 ERROR MiddleSmallScaleManageWebService - 登录 java.lang.NullPointerException: null at com.nari.business.SecurityVerificationBizService.verifySessionUpdatekey(SecurityVerificationBizService.java:326) ~[classes/:na] at com.nari.business.UserManageBizService.userLoginNew(UserManageBizService.java:595) ~[classes/:na] at com.nari.business.UserManageBizService$$FastClassBySpringCGLIB$$21c620a9.invoke(<generated>) ~[spring-core-3.2.8.RELEASE.jar:na] at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:700) ~[spring-aop-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) ~[spring-aop-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91) ~[spring-aop-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:633) ~[spring-aop-3.2.8.RELEASE.jar:3.2.8.RELEASE] at com.nari.business.UserManageBizService$$EnhancerBySpringCGLIB$$3191eefd.userLoginNew(<generated>) ~[spring-core-3.2.8.RELEASE.jar:na] at com.nari.webservice.MiddleSmallScaleManageWebService.login(MiddleSmallScaleManageWebService.java:369) ~[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_11] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_11] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_11] at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_11] at com.antunnel.ws.AntunnelWSMethodHandler.invokeServiceMethod(AntunnelWSMethodHandler.java:58) [antunnel-ws-0.0.1.54304.jar:na] at com.antunnel.ws.gateway.AntunnelWSGateway.doInvokeServiceMethod(AntunnelWSGateway.java:279) [antunnel-ws-0.0.1.54304.jar:na] at com.antunnel.ws.gateway.AntunnelWSGateway.submit(AntunnelWSGateway.java:128) [antunnel-ws-0.0.1.54304.jar:na] at com.antunnel.ws.AntunnelWSServlet.service(AntunnelWSServlet.java:34) [antunnel-ws-0.0.1.54304.jar:na] at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) [servlet-api.jar:na] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [catalina.jar:8.5.40] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.40] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-websocket.jar:8.5.40] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.40] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.40] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) [spring-web-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.40] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.40] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) [catalina.jar:8.5.40] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [catalina.jar:8.5.40] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493) [catalina.jar:8.5.40] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) [catalina.jar:8.5.40] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [catalina.jar:8.5.40] at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660) [catalina.jar:8.5.40] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [catalina.jar:8.5.40] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [catalina.jar:8.5.40] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798) [tomcat-coyote.jar:8.5.40] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-coyote.jar:8.5.40] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808) [tomcat-coyote.jar:8.5.40] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498) [tomcat-coyote.jar:8.5.40] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:8.5.40] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [na:1.7.0_11] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [na:1.7.0_11] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.5.40] at java.lang.Thread.run(Thread.java:722) [na:1.7.0_11] ```

java cxf webservice 传输文件异常

利用cxf传输大文件会报如下异常,请高手帮忙: [org.apache.cxf.phase.PhaseInterceptorChain]Interceptor for {http://impl.ws.zr.com/}zfFileService#{http://service.ws.zr.com/}getWsUser has thrown exception, unwinding now org.apache.cxf.interceptor.Fault: Could not write attachments. at org.apache.cxf.interceptor.AttachmentOutInterceptor$AttachmentOutEndingInterceptor.handleMessage(AttachmentOutInterceptor.java:98) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263) at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:77) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:123) at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:207) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:213) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:193) at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:126) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:185) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:108) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:164) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:140) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:619) Caused by: ClientAbortException: java.net.SocketException: Connection reset by peer: socket write error at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:369) at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:448) at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:363) at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:392) at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:381) at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:89) at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:46) at javax.activation.DataHandler.writeTo(DataHandler.java:294) at org.apache.cxf.attachment.AttachmentSerializer.writeAttachments(AttachmentSerializer.java:234) at org.apache.cxf.interceptor.AttachmentOutInterceptor$AttachmentOutEndingInterceptor.handleMessage(AttachmentOutInterceptor.java:96) ... 31 more Caused by: java.net.SocketException: Connection reset by peer: socket write error at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) at java.net.SocketOutputStream.write(SocketOutputStream.java:136) at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:756) at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:448) at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:363) at org.apache.coyote.http11.InternalOutputBuffer$OutputStreamOutputBuffer.doWrite(InternalOutputBuffer.java:780) at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:126) at org.apache.coyote.http11.InternalOutputBuffer.doWrite(InternalOutputBuffer.java:593) at org.apache.coyote.Response.doWrite(Response.java:560) at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:364) ... 40 more

远程主机强迫关闭了一个现有的连接,求助~

问题是发生在我的客户端和服务器端之间进行Modbus TCP通讯的时候。代码如下: ``` internal class ModbusTcpIpWrapper : ModbusWrapper, IDisposable { public static ModbusTcpIpWrapper Instance = new ModbusTcpIpWrapper(); private ModbusSocketWrapper socketWrapper = new ModbusSocketWrapper(); public bool Connected = false; #region modbus tcp连接 public override void Connect(string ip) { if (!Connected) { this.socketWrapper.Logger = Logger; this.socketWrapper.Connect(ip); this.Connected = true; } } #endregion #region 读取Modbus寄存器数据 public override byte[] Receive(string ip, byte functionCode, UInt16 startAddress, short registerNum, int bufferSize) { Connect(ip); List<byte> sendData = new List<byte>(255); //申请一个255个字节空间的List //发送Modbus请求ADU编码 sendData.AddRange(ModbusValueHelper.Instance.GetBytes(this.NextDataIndex())); //事务ID标识 sendData.AddRange(new Byte[] { 0, 0 }); //Protocal Identifier(协议标识),Modbus中此值为0 sendData.AddRange(ModbusValueHelper.Instance.GetBytes((short)6)); //后续的Byte数量(针对读请求,后续为6个byte) sendData.Add((byte)0); //Unit Identifier(单元标识符):用于系统间的路由 sendData.Add((byte)functionCode); //读取寄存器中的值 sendData.AddRange(ModbusValueHelper.Instance.GetBytes((Int16)startAddress)); //起始地址 sendData.AddRange(ModbusValueHelper.Instance.GetBytes((short)registerNum)); //需要读取寄存器的数量 this.socketWrapper.Write(sendData.ToArray()); //发送读请求 //防止连续读写引起前台的UI线程堵塞 Application.DoEvents(); //读取Response Header:完后会返回8个byte的Response Header byte[] receiveData = socketWrapper.Read(bufferSize, ip); //缓冲区中的数量不超过256byte,一次读256byte,防止残余数据影响下次读取 short identifier = (short)((((short)receiveData[0]) << 8) + receiveData[1]); //读取返回数据:根据Response Header,读取后续的数据 if (identifier != CurrentDataIndex) //请求的数据标识与返回的标识不一致,则丢掉数据包 { return new Byte[0]; } byte length = receiveData[8]; //最后一个字节,记录寄存器中数据的Byte数 byte[] result = new byte[length]; Array.Copy(receiveData, 9, result, 0, length); //从指定的索引源开始,复制receiveData中的一系列数据到result中(从指定目标的索引开始) return result; } #endregion ``` ``` internal class ModbusSocketWrapper : IDisposable { private static int Port = Int32.Parse(ConfigurationManager.AppSettings["Port"]); //数据传输的端口号Port,Modbus TCP规定为502 private static int Timeout = Int32.Parse(ConfigurationManager.AppSettings["SocketTimeout"]); //设置数据发送超时时间 public IModbusLog Logger { get; set; } public Socket Socket = null; #region 建立Socket连接 /// <summary> /// 创建一个基于TCP上的Socket /// 实现Socket端口复用 /// 将服务器主机的IP地址与端口号组合 /// 建立与远程主机的连接 /// </summary> public void Connect(string ip) { this.Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); this.Socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, Timeout); IPEndPoint ipConnect = new IPEndPoint(IPAddress.Parse(ip), Port); this.Socket.Connect(ipConnect); } #endregion #region 读取数据 public byte[] Read(int length, string ipGet) { byte[] data = new byte[length]; //while (true) //{ try { Socket.Receive(data); Log("Receive:", data); return data; } catch (Exception ex) { string ep = ex.ToString(); Socket.Close(); Connect(ipGet); //MessageBox.Show(ep); return null; } //} } #endregion #region 写入数据 public void Write(byte[] data) { try { Log("Send:", data); Socket.Send(data); } catch (Exception ex) { string ep = ex.ToString(); //MessageBox.Show(ep); } } #endregion #region 记录数据 public void Log(string type, byte[] data) { if (Logger != null) { //创建一个新的可变字符字符串对象 StringBuilder logText = new StringBuilder(type); //将数据中的每一个byte量 foreach (byte item in data) { //将括号内的item转化成字符串表示形式添加到当前对象表示的字符串结尾处 logText.Append(item.ToString() + ""); } Logger.Write(logText.ToString()); } } #endregion #region IDisponsable 成员 public void Dispose() { if (Socket != null) { Socket.Close(); } } #endregion } ``` 当我运行时,就会出现下面的问题 ![图片说明](https://img-ask.csdn.net/upload/201604/20/1461119020_829290.png) ![图片说明](https://img-ask.csdn.net/upload/201604/20/1461119030_311075.png) 我将我发送的请求和Modbuspull这个工具发送的请求进行了对比,是一样的,但是我的请求会被拒绝,而Modbuspull这个工具发送的请求能正常收到请求后服务器返回的数据,请问这个原因是什么?

c#的套接字编程 System.Net.Sockets.SocketException

![图片说明](https://img-ask.csdn.net/upload/201610/02/1475377101_165736.png) 有人知道这个怎么解决吗??

YOLOv3目标检测实战:训练自己的数据集

YOLOv3目标检测实战:训练自己的数据集

150讲轻松搞定Python网络爬虫

150讲轻松搞定Python网络爬虫

实用主义学Python(小白也容易上手的Python实用案例)

实用主义学Python(小白也容易上手的Python实用案例)

我说我不会算法,阿里把我挂了。

不说了,字节跳动也反手把我挂了。

立方体线框模型透视投影 (计算机图形学实验)

计算机图形学实验 立方体线框模型透视投影 的可执行文件,亲测可运行,若需报告可以联系我,期待和各位交流

2019 AI开发者大会

2019 AI开发者大会

组成原理课程设计(实现机器数的真值还原等功能)

实现机器数的真值还原(定点小数)、定点小数的单符号位补码加减运算、定点小数的补码乘法运算和浮点数的加减运算。

C/C++跨平台研发从基础到高阶实战系列套餐

一 专题从基础的C语言核心到c++ 和stl完成基础强化; 二 再到数据结构,设计模式完成专业计算机技能强化; 三 通过跨平台网络编程,linux编程,qt界面编程,mfc编程,windows编程,c++与lua联合编程来完成应用强化 四 最后通过基于ffmpeg的音视频播放器,直播推流,屏幕录像,

MFC一站式终极全套课程包

该套餐共包含从C小白到C++到MFC的全部课程,整套学下来绝对成为一名C++大牛!!!

软件测试2小时入门

软件测试2小时入门

三个项目玩转深度学习(附1G源码)

三个项目玩转深度学习(附1G源码)

计算机图形学-球的光照模型课程设计

计算机图形学-球的光照模型,有代码完美运行,有课程设计书

Linux常用命令大全(非常全!!!)

Linux常用命令大全(非常全!!!) 最近都在和Linux打交道,感觉还不错。我觉得Linux相比windows比较麻烦的就是很多东西都要用命令来控制,当然,这也是很多人喜欢linux的原因,比较短小但却功能强大。我将我了解到的命令列举一下,仅供大家参考: 系统信息 arch 显示机器的处理器架构 uname -m 显示机器的处理器架构 uname -r 显示正在使用的内核版本 d...

因为看了这些书,我大二就拿了华为Offer

四年了,四年,你知道大学这四年我怎么过的么?

深度学习原理+项目实战+算法详解+主流框架(套餐)

深度学习系列课程从深度学习基础知识点开始讲解一步步进入神经网络的世界再到卷积和递归神经网络,详解各大经典网络架构。实战部分选择当下最火爆深度学习框架PyTorch与Tensorflow/Keras,全程实战演示框架核心使用与建模方法。项目实战部分选择计算机视觉与自然语言处理领域经典项目,从零开始详解算法原理,debug模式逐行代码解读。适合准备就业和转行的同学们加入学习! 建议按照下列课程顺序来进行学习 (1)掌握深度学习必备经典网络架构 (2)深度框架实战方法 (3)计算机视觉与自然语言处理项目实战。(按照课程排列顺序即可)

fakeLocation13.5.1.zip

fakeLocation13.5.1 虚拟定位 ios13.5.1的最新驱动下载,iPhone/iPad免越狱虚拟定位工具Location-cleaned驱动已更新

UnityLicence

UnityLicence

Python可以这样学(第一季:Python内功修炼)

Python可以这样学(第一季:Python内功修炼)

Python+OpenCV计算机视觉

Python+OpenCV计算机视觉

土豆浏览器

土豆浏览器可以用来看各种搞笑、电影、电视剧视频

【数据结构与算法综合实验】欢乐连连看(C++ & MFC)案例

这是武汉理工大学计算机学院数据结构与算法综合实验课程的第三次项目:欢乐连连看(C++ & MFC)迭代开发代码。运行环境:VS2017。已经实现功能:开始游戏、消子、判断胜负、提示、重排、计时、帮助。

php+mysql学生成绩管理系统

学生成绩管理系统,分三个模块:学生,教师和管理员。 管理员模块:负责学生、老师信息的增删改;发布课程信息的增删改,以便让学生选课;审核老师提交的学生成绩并且打印成绩存档;按照课号查询每个课号的学生成绩

多功能数字钟.zip

利用数字电子计数知识设计并制作的数字电子钟(含multisim仿真),该数字钟具有显示星期、24小时制时间、闹铃、整点报时、时间校准功能

推荐24个国外黄色网站欣赏

在中国清朝,明黄色的衣服只有皇子才有资格穿,慢慢的黄色在中国就成了高贵的颜色。在人们的色彩印象中,黄色也表现为暂停。所以当你的网页设计采用黄色的时候,会让人们在你的网页前停留。 黄色,就像橙色和红色,黄色也是一个暖色。它有大自然、阳光、春天的涵义,而且通常被认为是一个快乐和有希望的色彩。黄色是所有色相中最能发光的颜色,给人轻快,透明,辉煌,充满希望的色彩印象。 黄色是一个高可见的色...

u-boot-2015.07.tar.bz2

uboot-2015-07最新代码,喜欢的朋友请拿去

一学即懂的计算机视觉(第一季)

一学即懂的计算机视觉(第一季)

学生成绩管理系统(PHP + MYSQL)

做的是数据库课程设计,使用的php + MySQL,本来是黄金搭配也就没啥说的,推荐使用wamp服务器,里面有详细的使用说明,带有界面的啊!呵呵 不行的话,可以给我留言!

Windows版YOLOv4目标检测实战:训练自己的数据集

Windows版YOLOv4目标检测实战:训练自己的数据集

C++语言基础视频教程

C++语言基础视频教程

玩转Python-Python3基础入门

玩转Python-Python3基础入门

相关热词 c# 按行txt c#怎么扫条形码 c#打包html c# 实现刷新数据 c# 两个自定义控件重叠 c#浮点类型计算 c#.net 中文乱码 c# 时间排序 c# 必备书籍 c#异步网络通信
立即提问