5 Replies Latest reply on May 18, 2015 12:08 PM by Jon Onstott

    javax.naming.NameNotFoundException: ConnectionFactory

    varsha g Newbie

      Hi,

       

       

          I did following  configuration for jndi in jboss7.0.2

           

           

      Properties props = new Properties();

              props.setProperty("java.naming.factory.initial", "org.jboss.as.naming.InitialContextFactory");

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

              props.setProperty("java.naming.provider.url", "localhost");

              ic = new InitialContext(props);

              cf = (QueueConnectionFactory)ic.lookup("java:/ConnectionFactory");

              Queue queue = (Queue)ic.lookup(destinationName);

              connection = cf.createConnection();

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

              MessageProducer publisher = session.createProducer(queue);

              connection.start();

       

      Am getting the following Exception

       

             javax.naming.NameNotFoundException: ConnectionFactory -- service jboss.naming.context.java.ConnectionFactory

            12:36:44,153 ERROR [stderr] (http--0.0.0.0-8080-3)     at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:87)

           12:36:44,153 ERROR [stderr] (http--0.0.0.0-8080-3)     at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:173)

           12:36:44,153 ERROR [stderr] (http--0.0.0.0-8080-3)     at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:47)

           12:36:44,153 ERROR [stderr] (http--0.0.0.0-8080-3)     at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:209)

           12:36:44,153 ERROR [stderr] (http--0.0.0.0-8080-3)     at javax.naming.InitialContext.lookup(InitialContext.java:392)

           12:36:44,156 ERROR [stderr] (http--0.0.0.0-8080-3)     at java.lang.Thread.run(Thread.java:662)

           INFO   | jvm 1    | 2012/02/21 12:36:44 | 12:36:44,152 ERROR [stderr] (http--0.0.0.0-8080-3) javax.naming.NameNotFoundException: ConnectionFactory -- service jboss.naming.context.java.ConnectionFactory

           INFO   | jvm 1    | 2012/02/21 12:36:44 | 12:36:44,153 ERROR [stderr] (http--0.0.0.0-8080-3)     at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:87)

       

       

      what am missing in this code?

      how to resolve this?