1 Reply Latest reply on Oct 28, 2012 5:53 PM by thinksteep thinksteep

    InitialContext instantiation question

    thinksteep thinksteep Novice

      Hi Community,


      I have spent days on troubleshooting this issue but no success. Any input would be appreciated.


      I wrote a plain simple java program to perform remote connection with HornetQ server.


              Properties p = new Properties();

              p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");

              p.put(Context.PROVIDER_URL, "remote://myIP:4447");

              p.put(Context.SECURITY_PRINCIPAL, "user");

              p.put(Context.SECURITY_CREDENTIALS, "pwd");


              final InitialContext iniCtx = new InitialContext(p);


      If JBoss server is down, final InitialContext iniCtx = new InitialContext(p); statements itself throwing

      javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.RuntimeException: Operation failed with status WAITING]


      Is this valid case, Instantiating InitialContext itsefl should fail if JBoss server is down?


      If this is valid case,


      I have anyother standalone app (this is not on any server, standalone java application)


      Inside this standalone app, I am trying to create IntialContext exact same lines as above.


      When JBoss server is down, InitialContext instantiation is not failing.


      Could anyone please confirm which behaviour is correct?


      The reason why I am all doing this is, when JBoss server restarts, JMS context failing to re-set (Which is bug in 7.1.1.Final). As work around I am trying to create to new InitialContext to re-establish the context and queue connection.


      Any input would be really appreciated.


      Thanks for your time and help.