tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ronald Haring" <rhar...@planet.nl>
Subject Retry, problems using j2ee JMS in Tomcat 4.x.x
Date Thu, 24 Oct 2002 21:29:53 GMT
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>

After running the servlet on 3.2.3 I get 2 errors for loading ejb and
security.properties file, but after that it prints the following for the
enumeration
on the context:
java.naming.corba.orb = com.sun.enterprise.iiop.POAEJBORB@a49e0

and for tomcat 4.0.4
java.naming.factory.initial = org.apache.naming.java.javaURLContextFactory
java.naming.factory.url.pkgs = org.apache.naming:com.sun.enterprise.naming

So here is a big difference. The one from 3.2.3 appears to be an instance of
a class
whereas the ones from 4.0.4 are just string representations of classes to
load.

Now how can I activate my Jms system, in order for Tomcat 4.0.4 to find it?
Or what should I do so Tomcat will be able to find my queues and use them?



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message