2 Replies Latest reply on Sep 16, 2011 3:33 PM by smalejandro

    finding JMS resources with java:comp/env

    smalejandro

      Hi, I am new in JBoss, so, what i need to do is, find a topic (JMS) but with the following configuration:

       

      Context ctx;

      ctx = new InitialContext(new Hashtable(env));
      ctx = (Context)ctx.lookup("java:comp/env");

      TopicConnectionFactory factory = (TopicConnectionFactory)ctx.lookup("TopicConnectionFactory");

       

      For now, in my log i have:

       

      (http-127.0.0.1-8080-1) javax.naming.NameNotFoundException: TopicConnectionFactory not bound

      ................

       

      Of course, my topic is registered in JBoss, I am using JBoss 6.1.0.

       

      Thanks a lot.

        • 1. Re: finding JMS resources with java:comp/env
          wdfink

          What kind of client? Remote or inside the server? EJB2 or EJB3?

           

          Simple Remote access my example is JBoss 5.1:

          TopicConnectionFactory qcf = (TopicConnectionFactory) initialContext.lookup("ConnectionFactory");

          TopicConnection conn = qcf.createTopicConnection();

          Topic csTopic = (Topic) initialContext.lookup("topic/MyTopic");

           

          The env looks like:

          env.put("java.naming.factory.initial", "org.jboss.naming.NamingContextFactory");

          env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");

          env.put("java.naming.provider.url", "jnp://localhost:1099");

          • 2. Re: finding JMS resources with java:comp/env
            smalejandro

            Hi, thanks for your reply.

             

            I tell you that I have removed the line: ctx = (Context)ctx.lookup("java:comp/env"), of this way whether i can find the TopicConnectionFactory.

             

            But I have that doubt, why doesn't it works using java:comp/env?.

             

            Thanks.