geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sbyonge <sbyo...@gmail.com>
Subject Re: Cannot deploy wmq.jmsra.rar (WebSphere MQ)
Date Wed, 23 Jul 2008 15:26:17 GMT

I am deploying RAR separately from my test app. My app is deployed as ear and
dependency is specified in  web.xml.  To simplify testing, I removed MDB and
test code is contained in a single servlet (WmqServlet).  No MQ libraries
are included in the ear file.  Please let me know if you need any additional
information

gmo-mq.xml (MQ RAR deployment plan - deployed with wmq.jmsra.rar using
console application)

<?xml version="1.0" encoding="UTF-8"?>
<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2"
  xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2"
  xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
  <sys:environment>
    <sys:moduleId>
      <sys:groupId>gmo.mq</sys:groupId>
      <sys:artifactId>jmsra</sys:artifactId>
      <sys:version>1.0</sys:version>
      <sys:type>rar</sys:type>
    </sys:moduleId>
  </sys:environment>

  <resourceadapter>
    <resourceadapter-instance>
      <resourceadapter-name>MQRA</resourceadapter-name>
      <nam:workmanager>
        <nam:gbean-link>DefaultWorkManager</nam:gbean-link>
      </nam:workmanager>
    </resourceadapter-instance>

    <outbound-resourceadapter>
      <connection-definition>
       
<connectionfactory-interface>javax.jms.QueueConnectionFactory</connectionfactory-interface>
        <connectiondefinition-instance>
          <name>MyQueueConnectionFactory</name>
          <config-property-setting
name="queueManager">...</config-property-setting>
          <config-property-setting
name="channel">...</config-property-setting>
          <config-property-setting
name="transportType">CLIENT</config-property-setting>
          <config-property-setting
name="hostName">...</config-property-setting>
          <config-property-setting
name="port">1414</config-property-setting>
          <connectionmanager>
            <!--
            <xa-transaction/>
            -->
            <local-transaction/>
            <single-pool>
              <max-size>50</max-size>
              <min-size>20</min-size>
             
<blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
              <idle-timeout-minutes>2</idle-timeout-minutes>
              <match-all />
            </single-pool>
          </connectionmanager>
        </connectiondefinition-instance>
      </connection-definition>
    </outbound-resourceadapter>
  </resourceadapter>

  <adminobject>
    <adminobject-interface>javax.jms.Queue</adminobject-interface>
   
<adminobject-class>com.ibm.mq.connector.outbound.MQQueueProxy</adminobject-class>
    <adminobject-instance>
      <message-destination-name>RequestQueue</message-destination-name>
      <config-property-setting
name="baseQueueName">...</config-property-setting>
      <config-property-setting
name="baseQueueManagerName">...</config-property-setting>
      <config-property-setting
name="targetClient">MQ</config-property-setting>
    </adminobject-instance>
    <adminobject-instance>
      <message-destination-name>ReplyQueue</message-destination-name>
      <config-property-setting
name="baseQueueName">...</config-property-setting>
      <config-property-setting
name="baseQueueManagerName">...</config-property-setting>
   </adminobject-instance>
  </adminobject>
</connector>

// web deployment descriptor for WmqServlet
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
  http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
  version="2.5">

  <display-name>Geronimo MQ testing</display-name>

  <servlet>
    <servlet-name>WmqServlet</servlet-name>
    <servlet-class>gmo.servlet.WmqServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>WmqServlet</servlet-name>
    <url-pattern>/wmq</url-pattern>
  </servlet-mapping>

  <resource-ref>
    <res-ref-name>jms/wmqcf</res-ref-name>
    <res-type>javax.jms.QueueConnectionFactory</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
  </resource-ref>

  <resource-env-ref>
    <resource-env-ref-name>jms/RequestQueue</resource-env-ref-name>
    <resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
  </resource-env-ref>
  <resource-env-ref>
    <resource-env-ref-name>jms/ReplyQueue</resource-env-ref-name>
    <resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
  </resource-env-ref>
</web-app>

geronimo-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1"
  xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2"
  xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
  <sys:environment>
    <sys:moduleId>
      <sys:groupId>gmo.testing</sys:groupId>
      <sys:artifactId>mq</sys:artifactId>
      <sys:version>1.0.0</sys:version>
      <sys:type>war</sys:type>
    </sys:moduleId>
    <sys:dependencies>
      <sys:dependency>
        <sys:groupId>gmo.mq</sys:groupId>
        <sys:artifactId>jmsra</sys:artifactId>
        <sys:version>1.0</sys:version>
        <sys:type>rar</sys:type>
      </sys:dependency>
    </sys:dependencies>
  </sys:environment>

  <nam:resource-ref>
    <nam:ref-name>jms/wmqcf</nam:ref-name>
    <nam:resource-link>MyQueueConnectionFactory</nam:resource-link>
  </nam:resource-ref>
  <nam:resource-env-ref>
    <nam:ref-name>jms/RequestQueue</nam:ref-name>
   
<nam:message-destination-link>RequestQueue</nam:message-destination-link>
  </nam:resource-env-ref>
  <nam:resource-env-ref>
    <nam:ref-name>jms/ReplyQueue</nam:ref-name>
    <nam:message-destination-link>ReplyQueue</nam:message-destination-link>
  </nam:resource-env-ref>
</web-app>

// Servlet used for testing MQ
public class WmqServlet extends HttpServlet
{
  private final Logger log = Logger.getLogger(WmqServlet.class);
  
  @Resource(name="jms/wmqcf")
  private QueueConnectionFactory qcf;

  @Resource(name="jms/RequestQueue")
  private Queue qRequest;

  @Resource(name="jms/ReplyQueue")
  private Queue qReply;

  @Override
  protected void doGet(HttpServletRequest request, HttpServletResponse
response)
  throws ServletException, IOException
  {
    try {
      processMessage();
    }
    catch (Exception e) {
      e.printStackTrace();
    }
  }

  private void processMessage() throws NamingException, JMSException
  {
    log.info("Testing MQ send/receive");
    
    log.info("ConnectionFactory=" + qcf);
    log.info("Request Queue=" + qRequest);
    log.info("Reply Queue=" + qReply);

    QueueConnection qc = qcf.createQueueConnection();
    
    try {
      log.info("Connection created=" + qc);

      qc.start();

      QueueSession session = qc.createQueueSession(false,
QueueSession.AUTO_ACKNOWLEDGE);
      log.info("Session created=" + session);
      
      QueueSender producer = session.createSender(qRequest);
      log.info("Producer created=" + producer);
      
      Message msg = session.createTextMessage("ACC12345");
      msg.setJMSReplyTo(qReply);  // failing here
      producer.send(msg);

      log.info("Message sent=" + msg);
      
      QueueReceiver receiver = session.createReceiver(qReply);
      log.info("Receiver created=" + receiver);

      msg = receiver.receive(30000);
      log.info("Got message: " + msg);

      receiver.close();
      producer.close();
      session.close();
    }
    finally {
      qc.close();
    }
  }
}

Stack trace:
10:28:37,612 INFO  [WmqServlet] Testing MQ send/receive
10:28:37,612 INFO  [WmqServlet]
ConnectionFactory=com.ibm.mq.connector.outbound.
QueueConnectionFactoryImpl@19b39f6
10:28:37,612 INFO  [WmqServlet] Request
Queue=com.ibm.mq.connector.outbound.MQQu
eueProxy@1fa6619
10:28:37,612 INFO  [WmqServlet] Reply
Queue=com.ibm.mq.connector.outbound.MQQueu
eProxy@4528a3
10:28:40,217 INFO  [WmqServlet] Connection
created=com.ibm.mq.connector.outbound
.QueueConnectionWrapper@1fce0aa
10:28:40,627 INFO  [WmqServlet] Session
created=com.ibm.mq.connector.outbound.Qu
eueSessionWrapper@a1fa7f
10:28:40,768 INFO  [WmqServlet] Producer
created=com.ibm.mq.connector.outbound.Q
ueueSenderWrapper@129607b
java.lang.ClassCastException: com.ibm.mq.connector.outbound.MQQueueProxy
cannot
be cast to com.ibm.mq.jms.MQQueue
        at
com.ibm.mq.jms.MQJMSMessage.setHeaderFromMQMD(MQJMSMessage.java:899)
        at
com.ibm.mq.jms.MQMessageProducer.sendInternal(MQMessageProducer.java:
1813)
        at
com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:1139)
        at
com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:1215)
        at
com.ibm.mq.connector.outbound.MessageProducerWrapper.send(MessageProd
ucerWrapper.java:203)
        at gmo.servlet.WmqServlet.processMessage(Unknown Source)
        at gmo.servlet.WmqServlet.doGet(Unknown Source)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
        at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487
)
        at
org.apache.geronimo.jetty6.InternalJettyServletHolder.handle(Internal
JettyServletHolder.java:65)
        at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:3
62)
        at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.jav
a:216)
        at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:1
81)
        at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:7
26)
        at
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)

        at
org.apache.geronimo.jetty6.handler.TwistyWebAppContext.access$101(Twi
styWebAppContext.java:40)
        at
org.apache.geronimo.jetty6.handler.TwistyWebAppContext$TwistyHandler.
handle(TwistyWebAppContext.java:65)
        at
org.apache.geronimo.jetty6.handler.ThreadClassloaderHandler.handle(Th
readClassloaderHandler.java:46)
        at
org.apache.geronimo.jetty6.handler.InstanceContextHandler.handle(Inst
anceContextHandler.java:58)
        at
org.apache.geronimo.jetty6.handler.UserTransactionHandler.handle(User
TransactionHandler.java:48)
        at
org.apache.geronimo.jetty6.handler.ComponentContextHandler.handle(Com
ponentContextHandler.java:47)
        at
org.apache.geronimo.jetty6.handler.TwistyWebAppContext.handle(TwistyW
ebAppContext.java:59)
        at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHand
lerCollection.java:206)
        at
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.
java:114)
        at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:1
39)
        at org.mortbay.jetty.Server.handle(Server.java:324)
        at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:50
5)
        at
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpCo
nnection.java:828)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
        at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.ja
va:395)
        at org.apache.geronimo.pool.ThreadPool$1.run(ThreadPool.java:214)
        at
org.apache.geronimo.pool.ThreadPool$ContextClassLoaderRunnable.run(Th
readPool.java:344)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:885)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:907)
        at java.lang.Thread.run(Thread.java:619)

Kevan Miller wrote:
> 
> 
> On Jul 22, 2008, at 10:13 PM, sbyonge wrote:
> 
>>
>> I am not sure why I am getting ClassCastException.  It may be my local
>> setting and Geronimo is working fine.  Any suggestion?
>>
>>      QueueSender producer = session.createSender(requestQueue);
>>
>>      Message msg = session.createTextMessage("...");
>>      // If I comment out "setJMSReplyTo" method, message is sent OK
>>      msg.setJMSReplyTo(replyQueue);  // Gererating ClassCastException
>>      producer.send(msg);
>>
>> java.lang.ClassCastException:  
>> com.ibm.mq.connector.outbound.MQQueueProxy
>> cannot
>> be cast to com.ibm.mq.jms.MQQueue
>>        at
>> com.ibm.mq.jms.MQJMSMessage.setHeaderFromMQMD(MQJMSMessage.java:899)
>>        at
>> com.ibm.mq.jms.MQMessageProducer.sendInternal(MQMessageProducer.java:
>> 1813)
>>        at
>> com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:1139)
>>        at
>> com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:1215)
>>        at
>> com.ibm.mq.connector.outbound.MessageProducerWrapper.send(MessageProd
>> ucerWrapper.java:203)
> 
> Heh. Don't take it personally, but I was hoping we were done with you  
> and your problem... ;-)
> 
> Can you email your full stack trace? This exception is occurring  
> within Geronimo, correct? Not an external MQ/JMS client?
> 
> Apologies if you've already told us this info:
> 
> How are you deploying the RA? Separately from your app? Or all in a  
> single ear? What's your ear deployment plan look like? Are you  
> packaging any MQ libraries in your ear?
> 
> --kevan 
> 
> 

-- 
View this message in context: http://www.nabble.com/Cannot-deploy-wmq.jmsra.rar-%28WebSphere-MQ%29-tp17811963s134p18613373.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Mime
View raw message