1 Reply Latest reply on May 20, 2006 7:23 PM by David Palmer

    Class cast exception with QueueConnectionFactor

    David Palmer Newbie

      I'm encountering a rather strange and frustrating problem.

      I have a class that creates a queue connection factory, prepares a message and then writes it. very simple. and it works like a charm when I run it as a stand-alone app (within eclipse).

      now, when i run the class from within a servlet (also running in jboss with the included tomcat 5.5) i get this error:

      java.lang.ClassCastException: org.jboss.mq.SpyConnectionFactory
       at org.diy.util.ServiceLocator.getQueueConnectionFactory(ServiceLocator.java:135)
       at org.diy.processors.EventProcessor.writeMessage(EventProcessor.java:89)
       at org.diy.processors.EventProcessor.process(EventProcessor.java:55)
       at org.diy.services.ServiceProxy.handleRequest(ServiceProxy.java:191)
       at org.diy.services.ServiceProxy.doPost(ServiceProxy.java:124)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:613)
      


      I should say, again, that running the class that writes the message (EventProcessor) as a stand-alone, it writes the message without any errors.

      i've included the jbossall-client.jar in the WEB-INF/lib of my servlet (because when i run the EventProcessor as a stand alone, I obviously have that in the runtime classpath) but that had no effect.

      So, I'm most positive I'm the one doing something wrong here. Just wondering if anyone has seen something similar to this and had a few words of advice or guidance.

      Thanks