I am getting the following exception where trying to access a JMS queue
created by jonas.

Class: javax.naming.Reference
Reference: org.objectweb.jonas_jms.QueueConnectionFactory
java.lang.ClassCastException: javax.naming.Reference
 at
com.triforcetech.messagepro.servlet.CImportMasterTargetListServlet.doPost(CImportMasterTargetListServlet.java:63)

 at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)

 at org.apache.tomcat.core.Handler.service(Handler.java:287)
 at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
 at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)

 at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
 at
org.apache.tomcat.service.connector.Ajp13ConnectionHandler.processConnection(Ajp13ConnectionHandler.java:160)

 at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)

 at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)

 at java.lang.Thread.run(Thread.java:484)


Here is the code to produce the error.


import java.io.*;
import java.util.*;
import javax.jms.*;
import javax.naming.*;
import javax.rmi.*;
import javax.servlet.*;
import javax.servlet.http.*;


public class CImportMasterTargetListServlet extends HttpServlet
{
 public void doPost(HttpServletRequest inRequest, HttpServletResponse
ioResponse)
   throws IOException, ServletException
 {
  try
  {
   InitialContext theEJBContext = new InitialContext();


   //QueueConnectionFactory theQueueConnectionFactory =
(QueueConnectionFactory) theEJBContext.lookup("XAQCF1");

   Object theObj =  theEJBContext.lookup("QCF1");
   if (theObj != null)
   {
    Class theClass = theObj.getClass();
    System.out.println("Class: " + theClass.getName());
    javax.naming.Reference theReference = (javax.naming.Reference)
theObj;
    System.out.println("Reference: " + theReference.getClassName());
    QueueConnectionFactory theQueueConnectionFactory =
(QueueConnectionFactory) theObj;
    QueueConnection theQueueConnection =
theQueueConnectionFactory.createQueueConnection();
    QueueSession theQueueSession =
theQueueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
    Queue theQueue = (Queue)
theEJBContext.lookup("importMasterTargetListQueue");
    QueueSender theQueueSender = theQueueSession.createSender(theQueue);

    TextMessage theTextMessage =
theQueueSession.createTextMessage("Test");
    theQueueSender.send(theTextMessage);
    theQueueSession.close();
    theQueueConnection.close();
   }
   else
   {
    System.out.println("Failed to lookup QCF1");
   }
  }
  catch (Exception inException)
  {
   inException.printStackTrace();
  }


  ioResponse.sendRedirect("/manager/targetmanager/index.jsp");
 }
}

Ok now for the wierd part.  The above code works fine when turned into
an application.  It also works fine if the EJBServer and the Tomcat
Server are on the same machine, however when the EJBServer is run on one
machine and tomcat on another I can access session beans on the
EJBServer but not the JMS queue!   Anyone have any ideas?

Thanks
    G.C. Miller

----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".

Reply via email to