1 Reply Latest reply on Dec 28, 2004 10:36 AM by lunxian

    a problem when client access remote topic

    yj1804

      i use client to access a remote topic.the envroment is jboss3.2.2 + MSSQL SERVER 2000 + WINDOWS 2000 PRO.the remote topic is configed on jboss3.2.2.when the client access the topc,encounter a exception:

      org.jboss.mq.SpyJMSException: Cannot authenticate user; - nested throwable: (java.net.ConnectException: Connection refused: connect)

      but when the remote server run on jboss3.2.3,the client can access the remote topic successful.

      the follow is the client code frag:

      Hashtable ht = new Hashtable();
      ht.put(Context.INITIAL_CONTEXT_FACTORY,
      "org.jnp.interfaces.NamingContextFactory");
      ht.put(Context.PROVIDER_URL, "192.168.5.157:1099");
      ht.put("java.naming.rmi.security.manager", "yes");
      ht.put(Context.URL_PKG_PREFIXES, "org.jboss.naming");

      // ???JNDI
      Context ctx = new InitialContext(ht);

      // 1: ??JNDI??ConnectionFactory
      TopicConnectionFactory factory =
      (TopicConnectionFactory)
      ctx.lookup("ConnectionFactory");

      // 2: ?ConnectionFactory??JMS??
      TopicConnection connection =
      factory.createTopicConnection();

      // 3: ?Connection????
      TopicSession session = connection.createTopicSession(
      false, Session.AUTO_ACKNOWLEDGE);

      // 4: ??JNDI?????????
      Topic topic = (Topic) ctx.lookup("topic/logInAndOutTopic");

      // 5: ?????????
      TopicPublisher publisher = session.createPublisher(topic);
      the code frag in the follow:
      Hashtable ht = new Hashtable();
      ht.put(Context.INITIAL_CONTEXT_FACTORY,
      "org.jnp.interfaces.NamingContextFactory");
      ht.put(Context.PROVIDER_URL, "192.168.5.157:1099");
      ht.put("java.naming.rmi.security.manager", "yes");
      ht.put(Context.URL_PKG_PREFIXES, "org.jboss.naming");

      // init JNDI
      Context ctx = new InitialContext(ht);

      // 1: find ConnectionFactory
      TopicConnectionFactory factory =
      (TopicConnectionFactory)
      ctx.lookup("ConnectionFactory");

      // 2:create connection
      TopicConnection connection =
      factory.createTopicConnection();

      // 3: create session
      TopicSession session = connection.createTopicSession(
      false, Session.AUTO_ACKNOWLEDGE);

      // 4: find the topic
      Topic topic = (Topic) ctx.lookup("topic/logInAndOutTopic");

      // 5: create publisher
      TopicPublisher publisher = session.createPublisher(topic);


      i must use jboss3.2.2 as the container,please help me.appreciate your help!!