jms主题连接工厂查找挂起

时间:2015-03-11 16:54:40

标签: jms hornetq jms-topic

我正在尝试连接到HornetQ并执行查找主题连接工厂b TopicConnectionFactory hornetQConnectionFactory = (javax.jms.TopicConnectionFactory)ic.lookup("/ConnectionFactory");,但它出现错误" javax.naming.NamingException:无法取消引用对象[root exception is java.lang .ClassNotFoundException:org.hornetq.jms.client.HornetQJMSConnectionFactory]"。请帮忙

       Properties p = new java.util.Properties();

      p.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
      "org.jnp.interfaces.NamingContextFactory");

      p.put(javax.naming.Context.URL_PKG_PREFIXES,
      "org.jboss.naming:org.jnp.interfaces");     


      p.put(javax.naming.Context.PROVIDER_URL, "jnp://172.26.178.137:3900");

      // Step 1. Create an initial context to perform the JNDI lookup.
      System.out.println("Step 0.5");
      ic = new javax.naming.InitialContext(p);        
      System.out.println("Step 1");   


     // Step 3. Perform a lookup on the Connection Factory

      TopicConnectionFactory hornetQConnectionFactory = (javax.jms.TopicConnectionFactory)ic.lookup("/ConnectionFactory");

     System.out.println("Step 1.5");

     String hornetQTopicName = "topic/Test";

      Topic hornetQTopic= (javax.jms.Topic)ic.lookup(hornetQTopicName);

0 个答案:

没有答案