0 Replies Latest reply: Dec 15, 2011 11:58 AM by Xavi RSS

    java.lang.OutOfMemoryError: unable to create new native thread

    Xavi
      Hi.

      I have this code....

      public boolean run() {
      boolean status = true;
      String serviceURL = "service:jmx:rmi:///jndi/rmi://" + hostName + ":" + port + "/jmxrmi";

      JMXServiceURL url;
      try {
      url = new JMXServiceURL(serviceURL);

      log.info("Connecting to " + serviceURL);
      // Get an MBeanServerConnection
      JMXConnector jmxc = JMXConnectorFactory.connect(url, null);<<<<<< Line 33
      jmxc.getMBeanServerConnection();
      log.info("JMX Connection SUCCEEDED.");

      } catch (MalformedURLException e) {
      status=false;
      log.error("Check failed to connect via JMX.", e);
      } catch (IOException e) {
      status=false;
      log.error("Check failed to connect via JMX.", e);
      }

      return status;
      }

      If the hostname is down ---I get the next error..


      05:29:46,205 INFO [main] com.db.fim.cmm.ComponentMonitorModule - Setting status of module [MODMO] to status [true]] on node [N2]
      05:29:46,211 DEBUG [main] com.db.fim.cmm.ComponentMonitorModule - Testing DCS in hostname: dbfeedgru8.uk.db.com
      05:29:46,211 INFO [main] com.db.fim.cmm.JmxConnection - Connecting to service:jmx:rmi:///jndi/rmi://dbfeedgru8.uk.db.com:3333/jmxrmi
      05:29:46,233 ERROR [main] com.db.fim.cmm.JmxConnection - Check failed to connect via JMX.
      java.rmi.ServerError: Error occurred in server thread; nested exception is:
      java.lang.OutOfMemoryError: unable to create new native thread
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
      at sun.rmi.transport.Transport$1.run(Transport.java:153)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
      at java.lang.Thread.run(Thread.java:637)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
      at javax.management.remote.rmi.RMIServerImpl_Stub.newClient(Unknown Source)
      at javax.management.remote.rmi.RMIConnector.getConnection(RMIConnector.java:2239)
      at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:271)
      at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)
      at com.db.fim.cmm.JmxConnection.run(JmxConnection.java:33)
      at com.db.fim.cmm.ComponentMonitorModule.checkStatus(ComponentMonitorModule.java:301)
      at com.db.fim.cmm.ComponentMonitorModule.checkStatusDCSFileCollector(ComponentMonitorModule.java:353)
      at com.db.fim.cmm.ComponentMonitorModule.run(ComponentMonitorModule.java:445)
      at com.db.fim.cmm.ComponentMonitorModule.main(ComponentMonitorModule.java:487)
      Caused by: java.lang.OutOfMemoryError: unable to create new native thread
      at java.lang.Thread.start0(Native Method)
      at java.lang.Thread.start(Thread.java:616)
      at com.sun.jmx.remote.internal.ServerCommunicatorAdmin.<init>(ServerCommunicatorAdmin.java:32)
      at javax.management.remote.rmi.RMIConnectionImpl$RMIServerCommunicatorAdmin.<init>(RMIConnectionImpl.java:1259)
      at javax.management.remote.rmi.RMIConnectionImpl.<init>(RMIConnectionImpl.java:138)
      at javax.management.remote.rmi.RMIJRMPServerImpl.makeClient(RMIJRMPServerImpl.java:137)
      at javax.management.remote.rmi.RMIServerImpl.doNewClient(RMIServerImpl.java:230)
      at javax.management.remote.rmi.RMIServerImpl.newClient(RMIServerImpl.java:179)
      at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:592)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
      at sun.rmi.transport.Transport$1.run(Transport.java:153)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
      at java.lang.Thread.run(Thread.java:637)
      05:29:46,234 DEBUG [main] com.db.fim.cmm.ComponentMonitorModule - currentStatus: false
      05:29:46,235 DEBUG [main] com.db.fim.cmm.ComponentMonitorModule - Previous status: true
      05:29:46,235 INFO [main] com.db.fim.cmm.ComponentMonitorModule - Setting status of module [BATCH] to status [false] on node [N1]

      Does anybody know why?

      Thanks in advance!!

      Edited by: Xavi on Dec 15, 2011 9:57 AM