users@glassfish.java.net

GlashFishV3 Resource Adapter Help: Transaction Attribute not found for ... onMessage() using third party RAs

From: Jacques <whshub_at_gmail.com>
Date: Thu, 28 Jan 2010 21:52:19 -0800

I'm new to Glassfish and failing to effectively learn the ropes. I'm trying
to utilize the HornetQ Resource Adapter and keep having an error. I got
frustrated enough to try with the ActiveMQ Resource Adapter and I am still
having the problem. I'm posting this here because it seems like a
misconfiguration of Glassfish on my part as opposed to a failure in both of
the other project's resource adapters.

From a fresh Glassfish V3 release install (on a Win7 box with JDK 1.6.0_16):

1. Deploy jca adapter rar file (hornetq-ra.rar OR activemq-rar-5.3.0).
2. Create an associated Resource adapter configuration through the admin
using defaults.
3. Deploy a simple MDB like the attached.
4. Upon deployment, get exception of:

Caused by: javax.ejb.EJBException: Transaction Attribute not found for
methodpublic abstract void
javax.jms.MessageListener.onMessage(javax.jms.Message)
    at
com.sun.ejb.containers.BaseContainer.getTxAttr(BaseContainer.java:2638)
    at
com.sun.ejb.containers.MessageBeanContainer.containerStartsTx(MessageBeanContainer.java:346)
    at
com.sun.ejb.containers.MessageBeanContainer.isDeliveryTransacted(MessageBeanContainer.java:650)
    at
com.sun.enterprise.connectors.inbound.ConnectorMessageBeanClient.isDeliveryTransacted(ConnectorMessageBeanClient.java:370)
    at
org.hornetq.ra.inflow.HornetQActivation.<init>(HornetQActivation.java:136)


I know I must be missing something obvious but what is it?

Thanks,
Jacques

-----sun-ejb-jar.xml------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application
Server 9.0 EJB 3.0//EN" "
http://www.sun.com/software/appserver/dtds/sun-ejb-jar_3_0-0.dtd">
<sun-ejb-jar>
  <enterprise-beans>
   <unique-id>1</unique-id>
     <ejb>
     <ejb-name>MDBRemoteExample</ejb-name>
     <mdb-resource-adapter>
       <!-- The resource adapter mid element ties the generic ra for JMS
with this particular MDB -->
       <resource-adapter-mid>hornetq-ra</resource-adapter-mid>
     </mdb-resource-adapter>
     </ejb>
  </enterprise-beans>
</sun-ejb-jar>

-----MDBRemoteExample-----------------
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.ejb.TransactionManagement;
import javax.ejb.TransactionManagementType;
import javax.resource.ResourceException;
import javax.resource.cci.MessageListener;
import javax.resource.cci.Record;

@MessageDriven(name = "MDBRemoteExample",
    activationConfig =
    {
       @ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Queue"),
       @ActivationConfigProperty(propertyName = "destination", propertyValue
= "queue/testQueue"),
       @ActivationConfigProperty(propertyName = "acknowledgeMode",
propertyValue = "Auto-acknowledge"),
       @ActivationConfigProperty(propertyName = "ConnectorClassName",
propertyValue =
"org.hornetq.integration.transports.netty.NettyConnectorFactory"),
       @ActivationConfigProperty(propertyName = "ConnectionParameters",
propertyValue = "hornetq.remoting.netty.port=5545")
    })
@TransactionManagement(value= TransactionManagementType.CONTAINER)

 public class MDBRemoteExample implements MessageListener{

  @TransactionAttribute(value= TransactionAttributeType.REQUIRED) /* tried
with and without this */
  @Override
  public Record onMessage(Record inputData) throws ResourceException {
    System.out.println("hello");
    return null;
  }
}


-------More complete stack trace---------------
SEVERE: Exception while invoking class org.glassfish.ejb.startup.EjbDeployer
load method
java.lang.RuntimeException: EJB Container initialization error
    at
org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:219)
    at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:197)
    ... snip...
Caused by: java.lang.Exception
    at
com.sun.enterprise.connectors.inbound.ConnectorMessageBeanClient.setup(ConnectorMessageBeanClient.java:224)
    at
com.sun.ejb.containers.MessageBeanContainer.<init>(MessageBeanContainer.java:199)
    at
com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:115)
    at
org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:207)
    ... 32 more
Caused by: javax.resource.ResourceException: javax.ejb.EJBException:
Transaction Attribute not found for methodpublic abstract void
javax.jms.MessageListener.onMessage(javax.jms.Message)
    at
org.hornetq.ra.inflow.HornetQActivation.<init>(HornetQActivation.java:140)
    at
org.hornetq.ra.HornetQResourceAdapter.endpointActivation(HornetQResourceAdapter.java:134)
    at
com.sun.enterprise.connectors.inbound.ConnectorMessageBeanClient.setup(ConnectorMessageBeanClient.java:216)
    ... 35 more
Caused by: javax.ejb.EJBException: Transaction Attribute not found for
methodpublic abstract void
javax.jms.MessageListener.onMessage(javax.jms.Message)
    at
com.sun.ejb.containers.BaseContainer.getTxAttr(BaseContainer.java:2638)
    at
com.sun.ejb.containers.MessageBeanContainer.containerStartsTx(MessageBeanContainer.java:346)
    at
com.sun.ejb.containers.MessageBeanContainer.isDeliveryTransacted(MessageBeanContainer.java:650)
    at
com.sun.enterprise.connectors.inbound.ConnectorMessageBeanClient.isDeliveryTransacted(ConnectorMessageBeanClient.java:370)
    at
org.hornetq.ra.inflow.HornetQActivation.<init>(HornetQActivation.java:136)
    ... 37 more