The Source for Java Technology Collaboration
User: Password:



Ramesh Parthasarathy

Ramesh Parthasarathy's Blog

GlassFish V2 and ActiveMQ 4.1

Posted by rampsarathy on March 19, 2007 at 11:54 PM | Comments (23)

Configure_GenericJMSRA_For_ActiveMQ The previous blog entries showed how JMS providers like Jboss Messaging and MantaRay could be used with GlassFish. ActiveMQ is also one such JMS provider http://activemq.apache.org/ , the following steps describe the configurations required to use ActiveMQ with GlassFish.
  1.  Install GlassFish V2 and ActiveMQ 4.1
    GlassFish V2 : https://glassfish.dev.java.net/downloads/v2-b33e.html
    ActiveMQ 4.1 : http://activemq.apache.org/activemq-410-release.html
  2. Modify the glassfish domain's (default domain is domain1) classpath to add ActiveMQ4.1 jars located in ActiveMQ installation lib directory. The asadmin GUI could be used to modify a domain's classpath. Open a browser and type the url of the application server admin GUI - http://hostname:adminport. Go to Application Server -> JVM Settings -> Path Settings . Add an entry for the jar files shown below [comma-separated as shown below] in the classpath suffix. Restart the application server domain for these changes to take effect.    
      1. activemq-core.jar
      2. activeio.jar
      3. commons-logging.jar
      4. backport-util-concurrent.jar
  3.  Start the Active MQ - please refer to http://activemq.apache.org/run-broker.html    
  4. Create the required destinations : http://activemq.apache.org/how-do-i-create-new-destinations.html shows how destinations can be created in ActiveMQ. 2 queue destinations are required, "Receive" from which we will receive the messages and "Send" to which we will respond back from our MDB. 
  5. Create the jndi bindings : Create a File system JNDI object store to bind ActiveMQ JMS administered objects.  The following link shows a code snippet that creates a FS object store and binds the required ActiveMQ objects to the jndi tree.
                                  http://weblogs.java.net/blog/rampsarathy/archive/Main.java
  6. Create the resource adapter configuration :
    asadmin create-resource-adapter-config --user <adminname> --password <admin password> --property SupportsXA=true:ProviderIntegrationMode=jndi:RMPolicy=OnePerPhysicalConnection:
    JndiProperties=java.naming.factory.initial\\=com.sun.jndi.fscontext.RefFSContextFactory
    java.naming.provider.url\\=file://space/activemqobjects:LogLevel=FINEST genericra
  7. Deploy the resource adapter using the asadmin deploy command, as shown below. In the image above, see Generic JMS RA deployed in the application server.           $ asadmin deploy --user admin --password adminadmin <location of the generic resource adapter rar file>
    Generic JMS RA is present in ${GLASSFISH_HOME}/lib/addons/resourceadapters/genericjmsra/genericra.rar
  8. In order to configure a JMS Connection Factory, using the Generic Resource Adapter for JMS, a Connector connection pool and resources needs to be created in the application server, as shown below.
    #Creates a Connection Pool called inpool and points to XAQCF created in Active MQ
    asadmin create-connector-connection-pool --raname genericra connectiondefinition javax.jms.QueueConnectionFactory --transactionsupport  XATransaction --property ConnectionFactoryJndiName=activemqconnectionfactory inpool
    #Creates a Connection Pool called outpool and points to XATCF created in Active MQ
    asadmin create-connector-connection-pool --raname genericra connectiondefinition javax.jms.QueueConnectionFactory --transactionsupport  XATransaction --property ConnectionFactoryJndiName=activemqconnectionfactory outpool
    #Creates a connector resource named jms/inboundXAQCF and binds this resource to JNDI for applications to use.
    asadmin create-connector-resource --poolname inpool jms/inboundXAQCF
    Note: Though the inbound configuration of the RA happens through the activation specification, a pool has to be created to make sure that the transaction recovery happens when the application restarts. This is because the transaction manager does recovery only for connector resources that are registered in domain.xml.
    #Creates a connector resource named jms/outboundXAQCF and binds this resource to JNDI for applications to use.
    asadmin create-connector-resource --poolname outpool jms/outboundXAQCF
  9. For JMS Destination Resources, an administered object needs to be created. jms/inqueue [pointing to Generic JMS RA and Receive] created in the application server.
    #Creates a javax.jms.Queue Administered Object and binds it to application server's JNDI tree at jms/inqueue and points to inqueue created in ActiveMQ.
    asadmin create-admin-object --raname genericra --restype javax.jms.Queue --property DestinationJndiName=Receive jms/inqueue
    #Creates a javax.jms.Topic Administered Object and binds it to application server's JNDI tree at jms/outqueue and points to outqueue created in ActiveMQ.
    asadmin create-admin-object --raname genericra --restype javax.jms.Queue --property DestinationJndiName=Send  jms/outqueue
  10. Deployment descriptors:
    The deployment descriptors need to take into account the resource adapter and the connection resources that have been created. A sample sun-ejb-jar.xml for a Message Driven Bean that listens to a destination called inqueue  in ActiveMQ, and publishes back reply messages to a destination resource named jms/outqueue  is available here
                http://weblogs.java.net/blog/rampsarathy/archive/sun-ejb-jar.xml
  11. The business logic encoded in Message Driven Bean could then lookup the configured QueueConnectionFactory/Destination resource to create a connection and reply to the received message.

The MDB sample is here The descriptors are : sun-ejb-jar.xml
ejb-jar.xml

Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • I'm trying to use ActiveMQ 4.1.0 queues (deployed in Geronimo) and make them available inside of GlassFish. Can you explain step #5? Why do you need to create File system JNDI object store to bind ActiveMQ JMS administered objects? Also, what are you supposed to do with the code snippet?

    Posted by: rbiresch on June 22, 2007 at 08:01 AM

  • The code segment is a java program that binds objects to a file system JNDI.
    There are 2 ways through which generic jms ra can use JMS objects, one by looking up any JMS administered objects that have been created and bound to a JNDI or by using JavaBean mode where you have to provide the implementation clases for the queues, topics and connection factories (Active MQ classes) and generic ra will instantiate thee through reflection.
    What i have described is using JNDI and thats why you need an object store,
    you could also refer this link that also shows you how
    http://www.nixstyle.net/moin/TechInfo/ActivemqGenericraGlassfishNotes

    Posted by: rampsarathy on June 24, 2007 at 12:22 AM

  • Thanks for the explanation. I'm getting a timeout error accessing http://www.nixstyle.net/moin/TechInfo/ActivemqGenericraGlassfishNotes. I'm wondering if I have ActiveMQ as my JMS provider in an application server (i.e. Geronimo) then theoretically I should be able to bind my queues to the JNDI tree within Geronimo, correct? This would eliminate the need for a file system JNDI.

    Posted by: rbiresch on June 25, 2007 at 06:54 AM

  • Yes, you should be able to use Geronimo's jndi , but i have not tried this.
    Please ensure the following

    1. In Step 6, you would have to configure the context factory and provider url as per geronimo docs
    2. You have to make the geronimo jnid implementation classes (jar files ) available to generic jms ra, you could do that through step 2.

    Posted by: rampsarathy on June 25, 2007 at 07:19 AM

  • Ok, I've decided to put Geronimo aside for now and just walk through your steps to get this working exactly how you have describe it. I had to use the web admin console for steps 6 through 9 because of syntax errors in all the asadmin lines. Hopefully I didn't miss anything. I've created a simple MDB in NetBeans 6.0(M9) and I've used the sun-ejb-jar.xml file in step 10. However, when I deploy the MDB in GlassFish I get the following exception:

    ADM1006:Uploading the file to:[/tmp/s1astempdomain1server254960956/GlassFishActiveMQSampleMDB.jar]
    Exception occured in J2EEC Phasejava.lang.IllegalArgumentException: This bean [MyMDBBean] has no resource reference by the name of [jms/outboundXAQCF]
    com.sun.enterprise.deployment.backend.IASDeploymentException: Error loading deployment descriptors for module [GlassFishActiveMQSampleMDB] -- This bean [MyMDBBean] has no resource reference by the name of [jms/outboundXAQCF]
    at com.sun.enterprise.deployment.backend.Deployer.loadDescriptors(Deployer.java:364)
    at com.sun.enterprise.deployment.backend.ModuleDeployer.loadDescriptors(ModuleDeployer.java:410)
    at com.sun.enterprise.deployment.backend.EjbModuleDeployer.deploy(EjbModuleDeployer.java:127)
    at com.sun.enterprise.deployment.backend.ModuleDeployer.doRequestFinish(ModuleDeployer.java:166)
    at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:174)
    at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95)
    at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:892)
    at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:266)
    at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:761)
    at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:174)
    at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:210)
    Caused by: java.lang.IllegalArgumentException: This bean [MyMDBBean] has no resource reference by the name of [jms/outboundXAQCF]
    at com.sun.enterprise.deployment.EjbDescriptor.getResourceReferenceByName(EjbDescriptor.java:1539)
    at com.sun.enterprise.deployment.node.runtime.ResourceRefNode.setElementValue(ResourceRefNode.java:86)
    at com.sun.enterprise.deployment.node.SaxParserHandler.endElement(SaxParserHandler.java:435)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLNSDTDValidator.endNamespaceScope(XMLNSDTDValidator.java:260)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2059)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:932)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
    at com.sun.enterprise.deployment.io.DeploymentDescriptorFile.read(DeploymentDescriptorFile.java:279)
    at com.sun.enterprise.deployment.archivist.Archivist.readRuntimeDeploymentDescriptor(Archivist.java:514)
    at com.sun.enterprise.deployment.archivist.ApplicationArchivist.openArchive(ApplicationArchivist.java:773)
    at com.sun.enterprise.deployment.archivist.ApplicationArchivist.openArchive(ApplicationArchivist.java:731)
    at com.sun.enterprise.deployment.backend.Deployer.loadDescriptors(Deployer.java:329)
    ... 10 more


    Though the exception says "This bean [MyMDBBean] has no resource reference by the name of [jms/outboundXAQCF]" I can see jms/outboundXAQCF in the Connection Factories. Any thoughts?

    btw...NetBeans 6.0(M9) installed Sun Java System Application Server 9.1 (build b41d-beta2), according to the admin console. I assume this is GlassFish?

    Posted by: rbiresch on June 27, 2007 at 09:40 AM

  • does your ejb-jar.xml has the resource-ref (i know it is present in sun-ejb-jar.xml)
    if not could you please add it to ejb-jar.xml

    -
    jms/outboundXAQCF
    jms/outboundXAQCF

    -
    jms/outqueue
    jms/outqueue

    Posted by: rampsarathy on June 27, 2007 at 09:51 AM

  • I'm using EJB 3.0 annotations, which are new to me. I believe I can annotate the resource-ref with @Resource. Now I'm trying to figure out how that can be done in my MDB.

    Posted by: rbiresch on June 27, 2007 at 10:49 AM

  • I finally got my MDB to deploy. I had to use @MessageDriven(name = "jms/outqueue") annotation *without* your sun-ejb-jar.xml. I used the default (basically empty) sun-ejb-jar.xml. Now I can see the MDB under EJB Modules however, I'm getting an exception (CORE5020: Error while loading ejb module
    ADM1075:Error on listening event:[Error while loading EJB module [GlassFishActiveMQSampleMDB]. Please refer to the server log for more details. ]). I'm wondering if GlassFish is able to access ActiveMQ. Is there a way to test the configuration without deploying an MDB? Like through JMX or some queue browser?

    Posted by: rbiresch on June 27, 2007 at 11:44 AM

  • you need your sun-ejb-jar.xml for the following reasons

    1. There is no annotation to specify that you want to use the generic jms resource adapter instead of the default jms resource adapter present in glassfish, So now in your case the MDB uses the default resource adapter and would connect to the Open MQ that is bundled and started with glassfish and not Active MQ.

    Also the activation spec properties need to be present , anyways you would need the sun-ejb-jar.xml

    did you try putting the sun-ejb-jar in the Project/src/conf folder, in netbeans

    Posted by: rampsarathy on June 27, 2007 at 07:38 PM

  • Can you post your code and descriptors for the MDB?

    Posted by: rbiresch on June 28, 2007 at 07:05 AM

  • The MDB is
    http://weblogs.java.net/blog/rampsarathy/archive/ActiveMQTestBean.java

    The descriptors are
    http://weblogs.java.net/blog/rampsarathy/archive/activemq/sun-ejb-jar.xml
    http://weblogs.java.net/blog/rampsarathy/archive/activemq/ejb-jar.xml

    Posted by: rampsarathy on July 02, 2007 at 03:33 AM

  • Thanks for posting the code. It looks the problem I'm having has to do with a java.lang.ClassCastException: javax.naming.Reference. The JNDI lookup seems to be working however when it gets to setting the properties on the reference class for the Receive queue it gets the ClassCastException...from the server log:

    Type: java.naming.provider.url
    Content: tcp://localhost:61616
    parseToProperties:null delimited:, seperator:=
    parseToProperties:java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory,java.naming.provider.url=file:///tmp/activemqobjects delimited:, seperator:=
    PropertyValuePair : java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory, separator:=
    Property : java.naming.factory.initial:com.sun.jndi.fscontext.RefFSContextFactory
    PropertyValuePair : java.naming.provider.url=file:///tmp/activemqobjects, separator:=
    Property : java.naming.provider.url:file:///tmp/activemqobjects
    Properties passed to InitialContext :: {java.naming.provider.url=file:///tmp/activemqobjects, java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory}
    Looking the JNDI name :Receive
    Created the object based on class :javax.naming.Reference
    About to set properties on Reference Class Name: org.apache.activemq.command.ActiveMQQueue
    Type: physicalName
    Content: Receive
    parseToProperties:null delimited:, seperator:=
    java.lang.ClassCastException: javax.naming.Reference
    at com.sun.genericra.inbound.EndpointConsumer.initializeAdministeredObjects(EndpointConsumer.java:334)
    at com.sun.genericra.inbound.EndpointConsumer.(EndpointConsumer.java:74)
    at com.sun.genericra.GenericJMSRA.endpointActivation(GenericJMSRA.java:214)
    at com.sun.enterprise.connectors.inflow.ConnectorMessageBeanClient.setup(ConnectorMessageBeanClient.java:239)
    at com.sun.ejb.containers.MessageBeanContainer.(MessageBeanContainer.java:193)
    at com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:267)
    at com.sun.enterprise.server.AbstractLoader.loadEjbs(AbstractLoader.java:518)
    at com.sun.enterprise.server.EJBModuleLoader.doLoad(EJBModuleLoader.java:158)
    at com.sun.enterprise.server.AbstractLoader.load(AbstractLoader.java:226)
    at com.sun.enterprise.server.AbstractManager.load(AbstractManager.java:212)
    at com.sun.enterprise.server.ApplicationLifecycle.onStartup(ApplicationLifecycle.java:198)
    at com.sun.enterprise.server.ApplicationServer.onStartup(ApplicationServer.java:332)
    at com.sun.enterprise.server.ondemand.OnDemandServer.onStartup(OnDemandServer.java:112)
    at com.sun.enterprise.server.PEMain.run(PEMain.java:381)
    at com.sun.enterprise.server.PEMain.main(PEMain.java:308)
    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:585)
    at com.sun.enterprise.server.PELaunch.main(PELaunch.java:274)
    MDB00017: [ActiveMQTestBean]: Exception in creating message-driven bean container: [java.lang.Exception]
    java.lang.Exception
    java.lang.Exception
    at com.sun.enterprise.connectors.inflow.ConnectorMessageBeanClient.setup(ConnectorMessageBeanClient.java:248)
    at com.sun.ejb.containers.MessageBeanContainer.(MessageBeanContainer.java:193)
    at com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:267)
    at com.sun.enterprise.server.AbstractLoader.loadEjbs(AbstractLoader.java:518)
    at com.sun.enterprise.server.EJBModuleLoader.doLoad(EJBModuleLoader.java:158)
    at com.sun.enterprise.server.AbstractLoader.load(AbstractLoader.java:226)
    at com.sun.enterprise.server.AbstractManager.load(AbstractManager.java:212)
    at com.sun.enterprise.server.ApplicationLifecycle.onStartup(ApplicationLifecycle.java:198)
    at com.sun.enterprise.server.ApplicationServer.onStartup(ApplicationServer.java:332)
    at com.sun.enterprise.server.ondemand.OnDemandServer.onStartup(OnDemandServer.java:112)
    at com.sun.enterprise.server.PEMain.run(PEMain.java:381)
    at com.sun.enterprise.server.PEMain.main(PEMain.java:308)
    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:585)
    at com.sun.enterprise.server.PELaunch.main(PELaunch.java:274)
    Caused by: java.lang.ClassCastException: javax.naming.Reference
    at com.sun.genericra.inbound.EndpointConsumer.initializeAdministeredObjects(EndpointConsumer.java:334)
    at com.sun.genericra.inbound.EndpointConsumer.(EndpointConsumer.java:74)
    at com.sun.genericra.GenericJMSRA.endpointActivation(GenericJMSRA.java:214)
    at com.sun.enterprise.connectors.inflow.ConnectorMessageBeanClient.setup(ConnectorMessageBeanClient.java:239)
    ... 16 more


    Any thoughts? The classpath suffix has been set like you specified in step #2.

    Posted by: rbiresch on July 02, 2007 at 01:16 PM

  • After you set your clasapath suffix in Step 2 , please verify the domain.xml configuration
    its should be under GFHOME/domains/domain1/config.
    Open this file and check for the classpath-suffix element under your server config (server-config).
    If you are on windows the classpath separator should be ";" if you are on unix/linux/solaris then it should be "":".
    If this is not the case please modify it, save and restart the domain

    Posted by: rampsarathy on July 02, 2007 at 07:34 PM

  • That was the problem...I'm running on Ubuntu Feisty and I had to change the ";" to ":" in the classpath-suffix. I appreciate all your help. If you curious, I'm currently implementing a use case in Chariot Solutions SOA Lab and I blog (http://soatechlab.blogspot.com/) about my experience.

    Posted by: rbiresch on July 03, 2007 at 07:32 AM

  • Would you be trying with Geronimo JNDI, please send me a pointer if you happen to write a blog about this (using generic jms ra).
    You could use generic jms ra to integrate almost any JMS compliant MQ provider with glassfish, we have tried to document most of them through the genericjmsra project site.
    Do let me know if you have any issues.

    Posted by: rampsarathy on July 04, 2007 at 06:44 AM

  • At some point I'll try using Geronimo's JNDI with generic jms ra and will let you know. Curious, have you tried using org.apache.activemq.jndi.ActiveMQInitialContextFactory instead of com.sun.jndi.fscontext.RefFSContextFactory for the initial context factory? I've used org.apache.activemq.jndi.ActiveMQInitialContextFactory in a JMS MQ client and it works fine. The benefit would be not have to build and maintain the .bindings file for the FS context factory.
    I have one more request, could you create a EJB 3.0 MDB (with annotations) of your example? I've tried a few times but keep getting validation errors with no resource specified in my MDB for jms/outqueue. I need to move on some I'm using your J2EE 1.4 MDB.

    Posted by: rbiresch on July 04, 2007 at 09:29 AM

  • No, i have not tried this org.apache.activemq.jndi.ActiveMQInitialContextFactory
    But if the required classes are present , there should'nt be any issues here.

    Its not possible to use EJB 3 annotations and use a custom resource adapter. Please remember that if you want to use generic jms ra, then you have to specify it in your descriptor using element, and there is no annotation for this (standard or sun specific).
    Its possible to supply the activation spec through annotation but not the resource adapter you want to use

    Posted by: rampsarathy on July 04, 2007 at 08:02 PM

  • Occasionally I get javax.transaction.SystemExceptions in the GlassFish log when starting the server and my MDB is trying to process messages on the source queue
    [Destination]Destination Jndi Name is set as AlertInboundCallQueue
    Preparing inbound transaction with ID 72626972657363682D6C6170746F702C7365727665722C50333730302C0002000000881D969B72626972657363682D6C6170746F702C7365727665722C5033373030
    Prepared inbound transactionw with ID 72626972657363682D6C6170746F702C7365727665722C50333730302C0002000000881D969B72626972657363682D6C6170746F702C7365727665722C5033373030
    JTS5031: Exception [org.omg.CORBA.INTERNAL: vmcid: 0x0 minor code: 0 completed: Maybe] on Resource [commit one phase] operation.
    MDB00037: [ActiveMQMDB:ActiveMQTestBean]: Message-driven bean invocation exception: [javax.ejb.EJBException: Unable to complete container-managed transaction.; nested exception is: javax.transaction.SystemException: org.omg.CORBA.INTERNAL: JTS5031: Exception [org.omg.CORBA.INTERNAL: vmcid: 0x0 minor code: 0 completed: Maybe] on Resource [commit one phase] operation. vmcid: 0x0 minor code: 0 completed: No]
    javax.ejb.EJBException
    javax.ejb.EJBException: Unable to complete container-managed transaction.; nested exception is: javax.transaction.SystemException: org.omg.CORBA.INTERNAL: JTS5031: Exception [org.omg.CORBA.INTERNAL: vmcid: 0x0 minor code: 0 completed: Maybe] on Resource [commit one phase] operation. vmcid: 0x0 minor code: 0 completed: No
    javax.transaction.SystemException: org.omg.CORBA.INTERNAL: JTS5031: Exception [org.omg.CORBA.INTERNAL: vmcid: 0x0 minor code: 0 completed: Maybe] on Resource [commit one phase] operation. vmcid: 0x0 minor code: 0 completed: No
    at com.sun.jts.jta.TransactionManagerImpl.commit(TransactionManagerImpl.java:308)
    at com.sun.enterprise.distributedtx.J2EETransactionManagerImpl.commit(J2EETransactionManagerImpl.java:990)
    at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.commit(J2EETransactionManagerOpt.java:384)
    at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3736)
    at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3515)
    at com.sun.ejb.containers.MessageBeanContainer.afterMessageDeliveryInternal(MessageBeanContainer.java:1111)
    at com.sun.ejb.containers.MessageBeanContainer.afterMessageDelivery(MessageBeanContainer.java:1082)
    at com.sun.ejb.containers.MessageBeanListenerImpl.afterMessageDelivery(MessageBeanListenerImpl.java:66)
    at com.sun.enterprise.connectors.inflow.MessageEndpointInvocationHandler.invoke(MessageEndpointInvocationHandler.java:126)
    at $Proxy18.afterDelivery(Unknown Source)
    at com.sun.genericra.inbound.InboundJmsResource.releaseEndpoint(InboundJmsResource.java:182)
    at com.sun.genericra.inbound.WorkImpl.run(WorkImpl.java:57)
    at com.sun.enterprise.connectors.work.OneWork.doWork(OneWork.java:63)
    at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:502)
    javax.ejb.EJBException: Unable to complete container-managed transaction.; nested exception is: javax.transaction.SystemException: org.omg.CORBA.INTERNAL: JTS5031: Exception [org.omg.CORBA.INTERNAL: vmcid: 0x0 minor code: 0 completed: Maybe] on Resource [commit one phase] operation. vmcid: 0x0 minor code: 0 completed: No
    at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3747)
    at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3515)
    at com.sun.ejb.containers.MessageBeanContainer.afterMessageDeliveryInternal(MessageBeanContainer.java:1111)
    at com.sun.ejb.containers.MessageBeanContainer.afterMessageDelivery(MessageBeanContainer.java:1082)
    at com.sun.ejb.containers.MessageBeanListenerImpl.afterMessageDelivery(MessageBeanListenerImpl.java:66)
    at com.sun.enterprise.connectors.inflow.MessageEndpointInvocationHandler.invoke(MessageEndpointInvocationHandler.java:126)
    at $Proxy18.afterDelivery(Unknown Source)
    at com.sun.genericra.inbound.InboundJmsResource.releaseEndpoint(InboundJmsResource.java:182)
    at com.sun.genericra.inbound.WorkImpl.run(WorkImpl.java:57)
    at com.sun.enterprise.connectors.work.OneWork.doWork(OneWork.java:63)
    at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:502)
    InboundJMSResource: released endpoint :
    Freed the resource now

    Any ideas?

    Posted by: rbiresch on July 06, 2007 at 05:58 AM


  • Using ksh93 on Solaris, I finally got this to work:

    asadmin create-resource-adapter-config --user admin --property SupportsXA=true:ProviderIntegrationMode=jndi:RMPolicy=OnePerPhysicalConnection:JndiProperties=java.naming.factory.initial\\=com.sun.jndi.fscontext.RefFSContextFactory,java.naming.provider.url\\=file\\:exportappservers/jndi-fs/activemq:LogLevel=FINEST genericra

    Hint: the : (colon) in the file:/// URL needs to be escaped as asadmin uses it as a property separator. It took me a number of goes and much hair pulling to figure this out.

    Posted by: lloy0076 on October 02, 2007 at 03:33 PM

  • Hi Ramesh,
    I am new to GlassFish, hence would appreciate your guidance in setting up GlassFish with ActiveMQ. Before stating the problem, let me give a brief overview of how I have structured my code.

    1. I have written 4 java classes that uses generic JMS methods/specifications and not specific to any of the implementations.

    2. I have used a jndi.properties file which contains the following contents:
    a) java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
    b) java.naming.provider.url = tcp://localhost:61616
    I also use this properties file to define a queue, a topic, topicconnectionfactory and a queueconnectionfactory.

    3. I use the lookup mechanism in my code and run ActiveMQ Broker on my machine to execute the code (without any container) and it is working absolutely fine.

    4. I tried to run this code with GlassFish by deploying the .class files and .properties file as a .WAR file and have invoked these class files through a .jsp file. Part of the functionality is working fine.

    I believe that when I am running the code using GlassFish, it is not using ActiveMQ defined in jndi.properties file and is rather using "OpenMQ" implementation which comes default with GlassFish. Am I right? Hence I tried to use the steps mentioned by you to integrate ActiveMQ with GlassFish.

    1. I am able to execute the first 4 steps. I don't think I require to do execute the 5th step, since I am already using jndi.properties file.
    2. In the 6th step, when I am trying to execute,

    C:\Program Files\GlassFish\glassfish\lib>asadmin create-resource-adapter-config
    --user admin --property ProviderIntegrationMode=jndi:RMPolicy=OnePerPhysicalConn
    ection:JndiProperties=java.naming.factory.initial:java.naming.provider.url = tcp
    ://localhost:61616 genericra

    I am getting the following error:
    CLI019 Invalid number of operands. Number of operands should be equal to 1.
    Could you please help me out so that I can proceed further. Also please note that the command does not take --password as an option, rather it asks for --passwordfile. So not too sure how to figure out that.

    Hope to get your reply soon.

    Posted by: rs26 on May 05, 2008 at 08:13 AM

  • Hi ,
    You have to escape the ":" and "/" in the "tcp ://localhost:61616 "
    it should be "tcp \:\/\/localhost:61616"

    Posted by: rampsarathy on May 05, 2008 at 08:03 PM

  • or rather tcp \:\/\/localhost\:61616

    Posted by: rampsarathy on May 05, 2008 at 08:04 PM

  • Thanks. It worked.

    One question, do we need to start ActiveMQ separately? Can't it be started through GlassFish container as soon as GlassFish container is started?

    Posted by: rs26 on May 07, 2008 at 04:58 AM



Only logged in users may post comments. Login Here.


Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds