Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error: QueueConnectionFactory is not bound in this Context

843830Oct 18 2002 — edited Oct 18 2002
Hi all,

Using win2k, JDK1.3.1, J2ee1.3.1.

I have created a small JMS system to generate pdf files. I created a very short test servlet. In tomcat 3.2.3 my queue is found. In tomcat 4.0.4 and 4.1.12 I get the next error:

NamingException
javax.naming.NameNotFoundException: Name QueueConnectionFactory is not bound in
this Context
at org.apache.naming.NamingContext.lookup(NamingContext.java:811)
at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
at javax.naming.InitialContext.lookup(InitialContext.java:350)

My code is :
protected void handle ( HttpServletRequest request, HttpServletResponse response ) 
		throws ServletException, IOException {
   try {

      // Create the initial context
      Context ctx = new InitialContext();
      Hashtable env = ctx.getEnvironment();
      Enumeration enum = env.keys();
      while ( enum.hasMoreElements() ) {
         String key = (String) enum.nextElement();
         System.out.println( key + " = " + env.get( key ) );
      }
      QueueConnectionFactory queueConnectionFactory = null;
      Queue queue = null;

      try {
         // The next definition works in tomcat 3.2.3
         queueConnectionFactory = (QueueConnectionFactory)
              ctx.lookup( "QueueConnectionFactory" );
         queue = (Queue) ctx.lookup( "generatePDF" );

         // The next definition doesnt work in either tomcat
         //queueConnectionFactory = (QueueConnectionFactory) 
         //	ctx.lookup("java:comp/env/QueueConnectionFactory");
         //queue = (Queue) ctx.lookup("java:comp/env/generatePDF");
         System.out.println( "Found the queue generatePDF" );
      }
      catch (NamingException e) {
         System.out.println( "NamingException" );
         e.printStackTrace();
      }

      // Close the context when we're done
      ctx.close();
   }
   catch (NamingException e) {
      System.err.println( "Problem " + e );
   }
}
And here is my JmsDestination and JmsFactory listing:
D:\jakarta-tomcat-4.0.4\bin>j2eeadmin -listJmsDestination
JmsDestination
--------------
< JMS Destination : sendPDF , javax.jms.Queue >
< JMS Destination : jms/Topic , javax.jms.Topic >
< JMS Destination : jms/Queue , javax.jms.Queue >
< JMS Destination : generatePDF , javax.jms.Queue >
D:\jakarta-tomcat-4.0.4\bin>j2eeadmin -listJmsFactory
JmsFactory
----------
< JMS Cnx Factory : QueueConnectionFactory , Queue , No properties >
< JMS Cnx Factory : jms/TopicConnectionFactory , Topic , No properties >
< JMS Cnx Factory : TopicConnectionFactory , Topic , No properties >
< JMS Cnx Factory : jms/QueueConnectionFactory , Queue , No properties >
D:\jakarta-tomcat-4.0.4\bin>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 15 2002
Added on Oct 18 2002
2 comments
492 views