3

I recently encountered a problem that is giving me a headache and I need help ...

The System consists of two subsystems, called A and B, each running on a standalone Tomcat instance and currently running on the same machine. A invokes B's service via Spring httpInvoker (i.e. over HTTP). B system also invokes the other system's services via HTTP.

Symptoms:

  1. the system starts to run and appears to work normally for around 10-15 days;

  2. the system will run for a period of time after an exception:

    org.springframework.remoting.RemoteAccessException: Could not access HTTP invoker remote service at [http://xxx.xxx.xxx.xxx/remoting/call]; 
    

    The nested exception is

    java. net.SocketException: **Permission denied: connect**
    
  3. when the exception occurs, the system continues. This happens always, not only occasionally. (It looks like some resources are exhausted, but CPU rate < 5%, memory < 15%, network < 5%).

  4. when the system call between A and B fails, the B system call over HTTP to an external service also failed, with the same exception.

  5. Restarting both Tomcat services makes the whole system work properly.

So repeatedly following steps 1 - 5, I have not found the root reason.

Environment:

  • windows 2008 R2
  • tomcat7.0.42 x86_64
  • oralce-jdk-1.7.0_40

Any ideas?

luxinxian
  • 31
  • 1
  • 1
  • 2
  • Perhaps you could do "netstat -ano" to see if the application does not close the connections properly? – lacasitos May 28 '14 at 17:38
  • connections closed properly. – luxinxian May 29 '14 at 00:41
  • the problem still pending... any who can help me? – luxinxian Jun 26 '14 at 08:52
  • You could try running ProcessMonitor & ProcessExplorer from SysInternals. Try ProcessMonitor when the problem occurs in case it shows you something more descriptive and run periodically ProcessExplorer to see if your applications have something like a leak in file descriptors, memory. – lacasitos Jun 26 '14 at 17:48
  • Which user do use to run your system? Does this user have proper permission to use network socket? – user1345414 Jul 31 '14 at 03:11
  • @luxinxian if you ever knew how this was solved, can you please help by explaining, i am having similar issues – sm_ Aug 13 '15 at 11:45
  • Check Firewall or Antivirus software. It could also cause this. – prashanth-g Jul 18 '16 at 09:23

1 Answers1

1

I had the same problem with RestTemplate. I changed the initialization to use HttpClient and it fixed my problem.

Here is the spring declaration I used :

<code>
    <bean id="httpClient" class="org.apache.http.impl.client.DefaultHttpClient">
        <constructor-arg>
            <bean class="org.apache.http.impl.conn.PoolingClientConnectionManager"/>
        </constructor-arg>
    </bean>

    <bean id="restTemplate" class="org.springframework.web.client.RestTemplate" >
        <constructor-arg>
            <bean class="org.springframework.http.client.HttpComponentsClientHttpRequestFactory">
                <constructor-arg ref="httpClient"/>
            </bean>
        </constructor-arg>
    </bean>
</code>

This completely solved the problem (before, after a number of http requests (about 14500) I had the error about "connect".

Reaces
  • 5,597
  • 4
  • 38
  • 46
JNG
  • 11
  • 1