Return-Path: Delivered-To: apmail-httpd-users-archive@www.apache.org Received: (qmail 95262 invoked from network); 5 Dec 2007 11:35:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Dec 2007 11:35:28 -0000 Received: (qmail 433 invoked by uid 500); 5 Dec 2007 11:35:07 -0000 Delivered-To: apmail-httpd-users-archive@httpd.apache.org Received: (qmail 278 invoked by uid 500); 5 Dec 2007 11:35:07 -0000 Mailing-List: contact users-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: users@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 267 invoked by uid 99); 5 Dec 2007 11:35:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Dec 2007 03:35:07 -0800 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Dec 2007 11:35:08 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1IzsWd-0008Rz-GI for users@httpd.apache.org; Wed, 05 Dec 2007 03:34:47 -0800 Message-ID: <14169980.post@talk.nabble.com> Date: Wed, 5 Dec 2007 03:34:47 -0800 (PST) From: sh_santosh To: users@httpd.apache.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: santosh.ncstk@gmail.com X-Virus-Checked: Checked by ClamAV on apache.org Subject: [users@httpd] HttpURLConnection - java.net.ConnectException: Connection timed out Dear all, I am usging Apache-Tomcat 5.5.20 and Axis 1.2 RC. I am invoking the web services method by my java client program. In SoapBindingImpl class i have written a Implementation method sendAndReceive(). sendAndReceive method code is -- public String sendAndReceive(String sRequest, String sMode) { StringBuffer sbResponse = new StringBuffer(); URL url = null; try { sbResponse = new StringBuffer(); String _sServerURL =_sLocalServerPath; url = new URL(_sServerURL+"/wsTestServiceServlet"); //Servlet - where business Implementation code is written. HttpURLConnection conn = (HttpURLConnection)url.openConnection(); // sun.net.www.protocol.http.HttpURLConnection {rt.jar} conn.setRequestMethod("POST"); conn.setDoOutput(true); conn.setDoInput(true); PrintStream outStream = new PrintStream(conn.getOutputStream()); ==> java:140 from Exception stack outStream.print("request="+URLEncoder.encode(sRequest)); outStream.print("&BIZ_ACTION_MODE=" +sMode); outStream.close(); BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line; while ((line = rd.readLine()) != null) { sbResponse.append(line); } rd.close(); } catch (MalformedURLException e) { sbResponse.setLength(0); sbResponse.append(e.getMessage()); e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); sbResponse.setLength(0); sbResponse.append(e.getMessage()); } return sbResponse.toString(); } >From this method i am getting Connection Time out Exception. On this line program is hanged : PrintStream outStream = new PrintStream(conn.getOutputStream()); Please see Exception == java.net.ConnectException: Connection timed out at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.Socket.connect(Socket.java:516) at java.net.Socket.connect(Socket.java:466) at sun.net.NetworkClient.doConnect(NetworkClient.java:157) at sun.net.www.http.HttpClient.openServer(HttpClient.java:365) at sun.net.www.http.HttpClient.openServer(HttpClient.java:477) at sun.net.www.http.HttpClient.(HttpClient.java:214) at sun.net.www.http.HttpClient.New(HttpClient.java:287) at sun.net.www.http.HttpClient.New(HttpClient.java:299) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:796) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:748) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:673) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:840) at webservices.wsHotelEngine.WssearchdetailsSoapBindingImpl.sendAndReceive(WssearchdetailsSoapBindingImpl.java:198) at webservices.wsHotelEngine.WsseardetailsSoapBindingImpl.getHotelDetailsXML(WssearchdetailsSoapBindingImpl.java:43) at webservices.wsHotelEngine.WssearchdetailsSoapBindingSkeleton.getHotelDetailsXML(WssearchdetailsSoapBindingSkeleton.java:140) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:384) at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:281) at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:319) 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.handlers.soap.SOAPService.invoke(SOAPService.java:450) at org.apache.axis.server.AxisServer.invoke(AxisServer.java:285) at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:653) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:301) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697) at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595) Problem is something related to HttpURLConnection with getOutputStream() and getInputStream() .. Or it is due to some configuration of Tomcat. I am not able to figure it out what adjactly the Problem is. 1. is it due to HttpURLConnection with getOutputStream() and getInputStream(). 2. is it due to wsTestServiceServlet Servlet ==> ( url = new URL(_sServerURL+"/wsTestServiceServlet");) 3. is it due to some configuration file in Tomcat. 4. As i am thinking it's not a Axis problem. please help me out............... Regards Santosh Kumar Sharma -- View this message in context: http://www.nabble.com/HttpURLConnection---java.net.ConnectException%3A-Connection-timed-out-tf4949098.html#a14169980 Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See for more info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org " from the digest: users-digest-unsubscribe@httpd.apache.org For additional commands, e-mail: users-help@httpd.apache.org