I'm having trouble enlisting a message sent from a message bean into
that bean's transaction.  Transaction attribute is set to Required.

The code works in weblogic, so maybe i'm doing something dumb in my
orion-specific setup?  Has anyone seen this behavior before?  Code at
bottom.

The bean responds to a message by sending a new message but then rolling
it back.  Each of the following cases seems to be broken:

   * Comment out the send, just do a rollback.  The input message is
     consumed, when it should be rolled back and redelivered.
   * Send with session create parameters: true, AUTO_ACKNOWLEDGE.  Same
     as first case (output message not sent, but input message not
     redelivered either).  Orion crashes fairly often in this case,
     requiring me to kill the process.  The client also hangs when that
     happens, even though it's doing a synchronous receive() with a
     timeout set.
   * Send with session create parameters: true, CLIENT_ACKNOWLEDGE.
     Same as the first case.
   * Send with session create parameters: false, AUTO_ACKNOWLEDGE.  The
     message is sent, not rolled back.

Sometimes i get this exception in the application log:
Error rolling back transaction
java.lang.IllegalStateException: Not active or marked for rollback
 at com.evermind.server.ApplicationServerTransaction._end(Unknown
Source)
 at com.evermind.server.ApplicationServerTransaction.rollback(Unknown
Source)
 at com.evermind.server.ThreadState._gh(Unknown Source)
 at com.evermind._io._twc(Unknown Source)
 at com.evermind._io._gc(Unknown Source)
 at com.evermind._if.run(Unknown Source)



My code essentially looks like this:

            QueueConnectionFactory factory = (QueueConnectionFactory)
lookup("jms/QueueConnectionFactory");

            System.err.println("XA? " + (factory instanceof
XAQueueConnectionFactory)); // prints "true"

            QueueConnection connection =
factory.createQueueConnection();

            Queue queue = lookupQueue(queueName);

            connection.start();

            QueueSession session = connection.createQueueSession(true,
session.AUTO_ACKNOWLEDGE);

            QueueSender sender = session.createSender(queue);

            sender.send(message, DeliveryMode.PERSISTENT,
Message.DEFAULT_PRIORITY, Jms.TTL_FOREVER);

            context.setRollbackOnly();

            ...

My ejb-jar looks like this:

<ejb-jar>
  <enterprise-beans>
    <message-driven>
      <display-name>TestModule</display-name>
      <ejb-name>TestModule</ejb-name>
      <ejb-class>com.swansystems.etc.TestModule</ejb-class>
      <transaction-type>Container</transaction-type>
      <message-driven-destination>
        <destination-type>javax.jms.Queue</destination-type>
      </message-driven-destination>
      <resource-ref>
        <res-ref-name>jms/QueueConnectionFactory</res-ref-name>
        <res-type>javax.jms.XAQueueConnectionFactory</res-type>
        <res-auth>Container</res-auth>
      </resource-ref>
      <resource-ref>
        <res-ref-name>jms/testQueue</res-ref-name>
        <res-type>javax.jms.Queue</res-type>
        <res-auth>Container</res-auth>
      </resource-ref>
    </message-driven>
  </enterprise-beans>
  <assembly-descriptor>
    <container-transaction>
      <method>
        <ejb-name>TestModule</ejb-name>
        <method-name>*</method-name>
      </method>
      <trans-attribute>Required</trans-attribute>
    </container-transaction>
  </assembly-descriptor>
</ejb-jar>

My orion-ejb-jar is essentially one line:

    <message-driven-deployment name="TestModule"
destination-location="jms/testInputQueue"
connection-factory-location="jms/QueueConnectionFactory" />

Jms.xml looks like this:

  <jms-server port="9127">

  <xa-queue-connection-factory location="jms/QueueConnectionFactory"
username="admin" password="foo"/>

  <queue name="testQueue" location="jms/testQueue"
persistence-file="testQueue">
   <description>Test Queue</description>
  </queue>

The client is a Java application which sends a message to the bean and
synchronously waits for a response on its output queue.


Reply via email to