9 Replies Latest reply on Oct 19, 2012 11:11 AM by luca paone

    "Failed to create session factory"  from client connecting to jboss-as7 hornetq

    luca paone Newbie

      Hi , I am trying to connect from a remote host to a Hornetq embedded in jboss as7. whith this code:



        env.put(Context.INITIAL_CONTEXT_FACTORY, org.jboss.naming.remote.client.InitialContextFactory.class.getName());


      env.put(Context.PROVIDER_URL, "remote://");


        env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");


      initialContext = new InitialContext(env);

                      ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("jms/RemoteConnectionFactory");

                      connection = cf.createConnection("guest", "guest");


                    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);


      But I receive this error


      javax.jms.JMSException: Failed to create session factory

                at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:605)

                at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:119)

                at com.sistemaits.vao.XMLReceiver.runExample(XMLReceiver.java:163)

                at com.sistemaits.vao.XMLReceiver.main(XMLReceiver.java:63)

      Caused by: HornetQException[errorCode=2 message=Cannot connect to server(s). Tried with all available servers.]

                at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:769)

                at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:601)

                ... 3 more

      ERROR RemoteNamingStoreV1 - Channel end notification received, closing channel Channel ID 96523c98 (outbound) of Remoting connection 26789869 to /



      while on the server I can see:

      09:21:39,566 INFO  [org.jboss.as.naming] (Remoting "win-gv9pboi9ea1" task-1) JBA

      S011806: Channel end notification received, closing channel Channel ID 16523c98

      (inbound) of Remoting connection 52a9fd96 to /


      From debug I can see that the exception is launched in the line:

        connection = cf.createConnection("guest", "guest");



      Can someone help us to find where we have an error?