2 Replies Latest reply on Sep 20, 2013 1:30 AM by charindu

    JMS Log Handler Cannot Connect Over Remote Naming

    stevenpaligo

      I have an application that logs to a JMS topic on a remote JBoss 7.1.1 server. The path the log message travels is something like this: application code -> slf4j -> JDK logging -> custom log handler -> JMS topic -> remote JBoss. The logging worked with JBoss 6, but not after porting it over to 7.1.1. Instead I get a the following exception while looking up the JMS connection factory using JNDI:

       

      javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.RuntimeException: Operation failed with status WAITING]
           at my.application.JMSTopicConnector.<init>(JMSTopicConnector.java:77)
           at my.application.LogHandler.<init>(LogHandler.java:74)
           at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
           at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
           at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
           at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
           at java.lang.Class.newInstance0(Class.java:355)
           at java.lang.Class.newInstance(Class.java:308)
           at java.util.logging.LogManager$7.run(LogManager.java:919)
           at java.security.AccessController.doPrivileged(Native Method)
           at java.util.logging.LogManager.initializeGlobalHandlers(LogManager.java:911)
           at java.util.logging.LogManager.access$900(LogManager.java:129)
           at java.util.logging.LogManager$RootLogger.getHandlers(LogManager.java:1018)
           at java.util.logging.Logger.log(Logger.java:454)
           at org.slf4j.impl.JDK14LoggerAdapter.log(JDK14LoggerAdapter.java:588)
           at org.slf4j.impl.JDK14LoggerAdapter.info(JDK14LoggerAdapter.java:285)
           at my.application.Testbench.<init>(Unknown Source)
      Caused by: javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.RuntimeException: Operation failed with status WAITING]
           at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:36)
           at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:121)
           at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
           at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
           at javax.naming.InitialContext.init(InitialContext.java:223)
           at javax.naming.InitialContext.<init>(InitialContext.java:197)
           at my.application.JMSTopicConnector.<init>(JMSTopicConnector.java:71)
           ... 23 more
      Caused by: java.lang.RuntimeException: Operation failed with status WAITING
           at org.jboss.naming.remote.protocol.IoFutureHelper.get(IoFutureHelper.java:89)
           at org.jboss.naming.remote.client.NamingStoreCache.getRemoteNamingStore(NamingStoreCache.java:56)
           at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateCachedNamingStore(InitialContextFactory.java:166)
           at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateNamingStore(InitialContextFactory.java:139)
           at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:104)
           ... 28 more
      

       

      It fails while creating the JNDI context so I doubt it has anything to do with JMS. However, later in the code I connect to a few different JMS topics using the same JNDI lookup code and that works! In all cases the properties passed to the initial context are the same:

       

           props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
           props.put(Context.PROVIDER_URL, "remote://<JBoss external IP>:4447");
           props.put("java.naming.security.principal", REMOTE_USER_NAME);
           props.put("java.naming.security.credentials", REMOTE_USER_PASSWORD);
      

       

      Does anyone have an idea of what would be wrong? Are there restrictions of what can be in a logging handler because they are instantiated by Java internals? Any help would be appreciated. I've been banging my head on this for weeks now.

       

      Thanks.

        • 1. Re: JMS Log Handler Cannot Connect Over Remote Naming
          stevenpaligo

          I forgot to mention some of what I've already tried:

           

          • I can telnet from the client to the JBoss server on port 4447
          • Connecting without getting the JMS connection factory from JNDI works
          • The JBoss bind addresses are set to the public IP when I start the server. This is the same IP used in the InitialContext properties:
            standalone.sh -b <JBoss external IP> -Djboss.bind.address=<JBoss external IP> -Djboss.bind.address.management=<JBoss external IP> -Djboss.bind.address.unsecure=<JBoss external IP> --server-config=standalone-full.xml
            
          • I also tried binding JBoss to 0.0.0.0 and that didn't work either.
          • I have increased the remote naming timeout property (jboss.naming.client.connect.timeout) in the InitialContext properties to 30 seconds and it didn't make a difference. When I did that, I could tell from the log that it did not wait 30 seconds before failing.
          • 2. Re: JMS Log Handler Cannot Connect Over Remote Naming
            charindu

            This worked for me,

            standalone.sh -b <JBoss external IP> -Djboss.bind.address=<JBoss external IP> -Djboss.bind.address.management=<JBoss external IP> -Djboss.bind.address.unsecure=<JBoss external IP> --server-config=standalone-full.xml

             

            Thanks