4 Replies Latest reply on Nov 12, 2004 6:50 PM by morgan

    Sending to queue from non-EJB class

    morgan

      Currently, I have a session EJB that sends messages to a queue (and this works fine). Now I'd like to be able to send messages to that queue from a plain old java class, say "Foo" (which is a part of my web app). Naturally, it's not going as planned. The following

      InitialContext context = new InitialContext();
       QueueConnectionFactory factory = null;
       try {
       factory = (QueueConnectionFactory) (context.lookup( "java:comp/env/jms/QueueFactory" ));
       }
       catch( NamingException exception ) {
       System.err.println(exception);
       }

      works fine in the EJB but when I transplant it to "Foo" I get the error message:
      javax.naming.NameNotFoundException: jms not bound

      I've been away from Java/J2EE for almost 2 years, and it's taking me a little while to get back into the swing of things, so any thoughts on how to fix my problem or pointers to the appropriate documentation would be greatly appreciated.

      Thanks,

      Paul

      p.s., this is with JBoss 3.2.3