MDB start and stop delivery
jprio Oct 12, 2009 2:28 PMHi all,
We have a mdb listening to an exernal activemq in JBoss 5.1.0GA. The mdb is configured with @ResourceAdapter and we have a rar pointing to our broker deployed on the JBoss.
When i "stopDelivery" with the jmx-console, it works fine. But when I try to "startDelivery", I get the following error :
20:09:13,396 ERROR [[HtmlAdaptor]] "Servlet.service()" pour la servlet HtmlAdaptor a g�n�r� une exception
javax.resource.ResourceException: ResourceAdapter already set
at org.apache.activemq.ra.ActiveMQActivationSpec.setResourceAdapter(ActiveMQActivationSpec.java:234)
at org.jboss.resource.deployers.RARDeployment.endpointActivation(RARDeployment.java:329)
at org.jboss.resource.deployers.RARDeployment.internalInvoke(RARDeployment.java:284)
at org.jboss.system.ServiceDynamicMBeanSupport.invoke(ServiceDynamicMBeanSupport.java:156)
at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at org.jboss.ejb3.JmxClientKernelAbstraction.invoke(JmxClientKernelAbstraction.java:58)
at org.jboss.ejb3.mdb.inflow.JBossMessageEndpointFactory.activate(JBossMessageEndpointFactory.java:342)
at org.jboss.ejb3.mdb.MessagingContainer.startDelivery(MessagingContainer.java:185)
at org.jboss.ejb3.mdb.MessagingDelegateWrapper.startDelivery(MessagingDelegateWrapper.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
This error occurs because of the following code in org.apache.activemq.ra.ActiveMQActivationSpec :
public void setResourceAdapter(ResourceAdapter resourceAdapter) throws ResourceException {
// spec section 5.3.3
if (this.resourceAdapter != null) {
throw new ResourceException("ResourceAdapter already set");
}
So, the solution in JBoss would be to set the adapter to null in org.jboss.resource.deployers.RARDeployment.endpointDeactivation (activationSpec.setResourceAdapter(null)).
What do you think of this ?