5 Replies Latest reply on Aug 27, 2009 10:13 AM by marrrck

    HornetQ with openejb/geronimo


      I'm trying to run hornetq inside openejb/geronimo for unit testing the mdbs normally deployed in JBoss, but I'm running into a little trouble. I'm sure I'm just missing some configuration file or something. Openejb supports JCA, so I have dropped the hornetq-ra.rar file into my classpath, and it is being automatically discovered by openejb. Unfortunately it throws this exception. I've tried adding all the other hornetq jars to the classpath, and also setting


      to point to the stand-alone/non-clustered configuration dir in the 2.0.0.BETA5 distribution. But I always get the below exception (I've included some possibly relevant log messages as well)

      INFO - Configuring Service(id=hornetq-raRA, type=Resource, provider-id=hornetq-raRA)
      INFO - Configuring Service(id=hornetq-ra, type=Resource, provider-id=hornetq-ra)
      INFO - Configuring Service(id=hornetq-ra, type=Container, provider-id=Default MDB Container)
      Aug 26, 2009 6:34:51 PM org.hornetq.core.logging.Logger info
      INFO: HornetQ resource adaptor started
      Aug 26, 2009 6:34:53 PM org.hornetq.core.logging.Logger error
      SEVERE: Unabler to start activation
      javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
      at javax.naming.InitialContext.getEnvironment(InitialContext.java:525)
      at org.hornetq.ra.inflow.HornetQActivation.setupDestination(HornetQActivation.java:390)
      at org.hornetq.ra.inflow.HornetQActivation.setup(HornetQActivation.java:286)
      at org.hornetq.ra.inflow.HornetQActivation$SetupActivation.run(HornetQActivation.java:498)
      at org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:290)
      at org.apache.geronimo.connector.work.pool.NamedRunnable.run(NamedRunnable.java:32)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:619)

        • 1. Re: HornetQ with openejb/geronimo

          Forgot the last sentence of my post: What am I doing wrong?

          • 2. Re: HornetQ with openejb/geronimo

            We never tested it with openejb.

            The new InitialContext() is looking for a jndi.properties.

            Maybe this would need some code changes to run there.

            We would love to have you as a contributor if you make it run on openejb.

            • 3. Re: HornetQ with openejb/geronimo

              ok Thanks. I guess I'll poke around the source then...

              • 4. Re: HornetQ with openejb/geronimo

                The JCA adapter should work with Geronimo, if Geronimo is JEE compliant.

                Firstly - where did you start your HornetQ server? Did you configure the JCA adapter to point at your started HornetQ server?

                Andy Taylor should be able to help you in configuring it properly. Also the user manual goes into a lot of detail on how to do this.

                • 5. Re: HornetQ with openejb/geronimo

                  Actually adding the jndi.properties file that Clebert mentioned to my classpath resolved my error. It seems like to integrate with openejb you just need the hornetq-ra.rar and the jndi.properties file in the classpath. Openejb discovers any JCA resource adapters in the classpath and tries to start them up automatically. Now based on the logging I am seeing openejb is starting HornetQ and adding my MDBs to a container called hornet-ra.

                  I haven't actually got an actual unit test together to trigger the mdb, so I will update this thread again at that point, but so far so good.

                  Thanks for all the help!