httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Axel-Stephane SMORGRAV" <Axel-Stephane.SMORG...@europe.adp.com>
Subject RE: [users@httpd] HttpURLConnection - java.net.ConnectException: Connection timed out
Date Fri, 07 Dec 2007 07:07:42 GMT
Just a wild shot:

1. Verify that the URL you try to connect to ( _sServerURL+"/wsTestServiceServlet" ) is correct
( e.g. http://my.tomcat.com:8080/wsTestServiceServlet )

2. Test the network connectivity between your java client host and the hosts on which Tomcat
and Axis are running. To do so, try doing telnet my.tomcat.com:8080 from the java client host.

If you reproduce the problem in 2) above, there may be a firewall between the client and the
server.


-ascs
 
-----Message d'origine-----
De : sh_santosh [mailto:santosh.ncstk@gmail.com] 
Envoyé : mercredi 5 décembre 2007 12:35
À : users@httpd.apache.org
Objet : [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.<init>(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 <URL:http://httpd.apache.org/userslist.html> 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


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> 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


Mime
View raw message