users@glassfish.java.net

Using ActiveMQ with glassfish without genericra

From: Alexey Tyutchev <tyutchev.alex_at_gmail.com>
Date: Sat, 26 Dec 2009 16:47:36 +0100

Hi!

I am trying to make glassfish v3 work with ActiveMQ without genericRa...

I deployed resource adapter from Active MQ 5.1, and set it up...

MDB Bean easily receives messages form activeMQ, but I cannot post messages
to active MQ

Class code:

@Stateless(mappedName = NationalDatabaseLookupService.
JNDI_NAME)
@WebService(name = "NationalDatabaseLookupService")
public class NationalDatabaseLookupServiceBean implements
NationalDatabaseLookupService {

    @Resource(name = "jms/activemqConnectionFactory")
    private ConnectionFactory connectionFactory;

    @Resource(name = "jms/nrdbservice/transactionLogQueue")
    private Queue queue;
}


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>
    <ejb>
<!-- posts messages to active mq -->
      <ejb-name>NationalDatabaseLookupServiceBean</ejb-name>

      <mdb-connection-factory>
        <jndi-name>jms/activemqConnectionFactory</jndi-name>
      </mdb-connection-factory>

      <mdb-resource-adapter>
        <resource-adapter-mid>activemq-rar-5.3.0</resource-adapter-mid>
      </mdb-resource-adapter>
    </ejb>

    <ejb>
<!-- receives messages from active mq. works fine. -->


      <ejb-name>NationalDatabaseLookupTransactionLogger</ejb-name>


      <mdb-connection-factory>
        <jndi-name>jms/activemqConnectionFactory</jndi-name>
      </mdb-connection-factory>

      <mdb-resource-adapter>
        <resource-adapter-mid>activemq-rar-5.3.0</resource-adapter-mid>
      </mdb-resource-adapter>
    </ejb>

  </enterprise-beans>
</sun-ejb-jar>

When NationalDatabaseLookupServiceBean gets instantiated I receive following
exception:

[#|2009-12-26T16:39:59.839+0100|SEVERE|glassfishv3.0|com.sun.xml.ws.server.sei.EndpointMethodHandler|_ThreadID=37;_ThreadName=Thread-1;|javax.ejb.EJBException:
javax.ejb.CreateException: Could not create stateless EJB
javax.ejb.EJBException: javax.ejb.EJBException: javax.ejb.CreateException:
Could not create stateless EJB
        at
com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:448)
        at
com.sun.ejb.containers.BaseContainer.getContext(BaseContainer.java:2418)
        at
com.sun.ejb.containers.WebServiceInvocationHandler.invoke(WebServiceInvocationHandler.java:174)
        at $Proxy330.test(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.glassfish.webservices.InvokerImpl.invoke(InvokerImpl.java:78)
        at
org.glassfish.webservices.EjbInvokerImpl.invoke(EjbInvokerImpl.java:78)
        at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
        at
com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
        at
com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:95)
        at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:629)
        at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:588)
        at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:573)
        at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:470)
        at
com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:112)
        at
org.glassfish.webservices.MonitoringPipe.process(MonitoringPipe.java:138)
        at
com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:115)
        at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:629)
        at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:588)
        at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:573)
        at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:470)
        at
com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:112)
        at
com.sun.xml.ws.tx.service.TxServerPipe.process(TxServerPipe.java:306)
        at
com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:115)
        at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:629)
        at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:588)
        at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:573)
        at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:470)
        at
com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:112)
        at
com.sun.enterprise.security.webservices.CommonServerSecurityPipe.processRequest(CommonServerSecurityPipe.java:195)
        at
com.sun.enterprise.security.webservices.CommonServerSecurityPipe.process(CommonServerSecurityPipe.java:127)
        at
com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:115)
        at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:629)
        at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:588)
        at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:573)
        at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:470)
        at
com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:295)
        at
com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:515)
        at
com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:285)
        at
com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:143)
        at
org.glassfish.webservices.Ejb3MessageDispatcher.handlePost(Ejb3MessageDispatcher.java:116)
        at
org.glassfish.webservices.Ejb3MessageDispatcher.invoke(Ejb3MessageDispatcher.java:87)
        at
org.glassfish.webservices.EjbWebServiceServlet.dispatchToEjbEndpoint(EjbWebServiceServlet.java:196)
        at
org.glassfish.webservices.EjbWebServiceServlet.service(EjbWebServiceServlet.java:127)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
        at
com.sun.grizzly.http.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:195)
        at
com.sun.grizzly.http.servlet.FilterChainImpl.invokeFilterChain(FilterChainImpl.java:139)
        at
com.sun.grizzly.http.servlet.ServletAdapter.doService(ServletAdapter.java:376)
        at
com.sun.grizzly.http.servlet.ServletAdapter.service(ServletAdapter.java:329)
        at
com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
        at
com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
        at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
        at
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
        at
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
        at
com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
        at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
        at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
        at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
        at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
        at
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
        at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
        at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
        at
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
        at
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
        at java.lang.Thread.run(Thread.java:637)
Caused by: javax.ejb.EJBException: javax.ejb.CreateException: Could not
create stateless EJB
        at
com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:718)
        at
com.sun.ejb.containers.util.pool.NonBlockingPool.getObject(NonBlockingPool.java:200)
        at
com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:443)
        ... 68 more
Caused by: javax.ejb.CreateException: Could not create stateless EJB
        at
com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:526)
        at
com.sun.ejb.containers.StatelessSessionContainer.access$000(StatelessSessionContainer.java:90)
        at
com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:716)
        ... 70 more
Caused by: com.sun.enterprise.container.common.spi.util.InjectionException:
Exception attempting to inject Unresolved Message-Destination-Ref
jms/nrdbservice/transactionLogQueue_at_java.lang.String_at_null into class
com.aspiro.merlin.components.ndblookupservice.NationalDatabaseLookupServiceBean
        at
com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:614)
        at
com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:384)
        at
com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:168)
        at
com.sun.ejb.containers.BaseContainer.injectEjbInstance(BaseContainer.java:1622)
        at
com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:486)
        ... 72 more
Caused by: java.lang.IllegalArgumentException: Can not set javax.jms.Queue
field
com.aspiro.merlin.components.ndblookupservice.NationalDatabaseLookupServiceBean.queue
to com.sun.enterprise.naming.impl.SerialContext
        at
sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146)
        at
sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150)
        at
sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
        at java.lang.reflect.Field.set(Field.java:657)
        at
com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:565)
        ... 76 more

What can be the problem?


--
Best Regards
Alex