3 Replies Latest reply on Nov 18, 2003 11:30 AM by ah123

    org.jboss.mq.SpyJMSException: Cannot authenticate user

    ah123 Newbie

      Hello Jboss members,

      I'm getting an exception connecting from my client to a server where my jboss is running. The code works fine when it's running on the same machine:

      Hashtable properties = new Hashtable();
      properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");

      properties.put(Context.PROVIDER_URL, "anotherhost" + ":1099");

      InitialContext ctx = new InitialContext(properties);
      QueueConnectionFactory conFactory = (QueueConnectionFactory) ctx.lookup("ConnectionFactory");
      connection = (QueueConnection) conFactory.createQueueConnection();

      I also tried to pass user/password in the connection but it still gave me the same exception.
      connection = (QueueConnection) conFactory.createQueueConnection("john", "needle");


      The exception:

      org.jboss.mq.SpyJMSException: Cannot authenticate user; - nested throwable: (java.net.ConnectException: Connection refused: connect)
      at org.jboss.mq.Connection.authenticate(Connection.java:883)
      at org.jboss.mq.Connection.(Connection.java:238)
      at org.jboss.mq.SpyConnection.(SpyConnection.java:48)
      at org.jboss.mq.SpyConnectionFactory.createQueueConnection(SpyConnectionFactory.java:135)
      at ejb.MessClient.go(MessClient.java:40)
      at ejb.MessClient.main(MessClient.java:23)
      Caused by: java.net.ConnectException: Connection refused: connect
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(Unknown Source)
      at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
      at java.net.PlainSocketImpl.connect(Unknown Source)
      at java.net.Socket.connect(Unknown Source)
      at java.net.Socket.connect(Unknown Source)
      at java.net.Socket.(Unknown Source)
      at java.net.Socket.(Unknown Source)
      at javax.net.DefaultSocketFactory.createSocket(Unknown Source)
      at org.jboss.mq.il.oil.OILServerIL.createConnection(OILServerIL.java:563)
      at org.jboss.mq.il.oil.OILServerIL.checkConnection(OILServerIL.java:507)
      at org.jboss.mq.il.oil.OILServerIL.authenticate(OILServerIL.java:289)
      at org.jboss.mq.Connection.authenticate(Connection.java:876)
      ... 5 more
      Exception in thread "main"


      Please help.

      -ah