You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by bleathem <bl...@gmail.com> on 2010/03/18 16:41:10 UTC

Integration tests using maven and OpenEJB broke with a recent OpenEJB-SANPSHOT release

I run my integration tests using maven, JUnit, and OpenEJB 3.1.3-SNAPSHOT. 
The EJB-jar I am testing uses MDB's, so I configure ActiveMQ along with
OpenEJB in a JUnit TestSuite.  This worked well, until a recent update to
the OpenEJB 3.13-SNAPSHOT, when I started getting an exception saying
OpenEJB was "Unable to load ActiveMQFactory".

Here is the test Suite that sets up the OpenEJB and ActiveMQ environments:

public class TestSuite {
    static public Context context;
    
    @BeforeClass
    public static void setUp() throws Exception {
        System.out.println("Setting Up.");
        Properties p = new Properties();
        p.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
        p.put("jdbc/adminDB2", "new://Resource?type=DataSource");
        p.put("jdbc/adminDB2.JdbcDriver",
"com.ibm.as400.access.AS400JDBCDriver");
        p.put("jdbc/adminDB2.JdbcUrl", "jdbc:as400://server.domain;date
format=iso;libraries=TRIUMFTEST");
        p.put("jdbc/adminDB2.JtaManaged", "true");
        p.put("jdbc/adminDB2.username", "username");
        p.put("jdbc/adminDB2.password", "password");

        p.put("Default JMS Resource Adapter",
"new://Resource?type=ActiveMQResourceAdapter");
        p.put("jms/QueueConnectionFactory",
"new://Resource?type=QueueConnectionFactory");
        p.put("jms/DataMigrationQueue", "new://Resource?type=Queue");

        //p.put("openejb.home", ".");

        p.setProperty(Context.SECURITY_PRINCIPAL, "test");
        p.setProperty(Context.SECURITY_CREDENTIALS, "test");
        p.setProperty("openejb.authentication.realmName",
"PropertiesLogin"); // optional

        context = new InitialContext(p);
        System.out.println("Set up OpenEjb.");
    }

    @AfterClass
    public static void tearDown() throws Exception {
        context.close();
        System.out.println("OpenEjb Torn down.");
    }
}


Here is the Stacktrace:

javax.naming.NamingException: Attempted to load OpenEJB. OpenEJB has
encountered a fatal error and cannot be started: The Assembler encountered
an unexpected error while attempting to build the container system.: null
[Root exception is org.apache.openejb.OpenEJBException: OpenEJB has
encountered a fatal error and cannot be started: The Assembler encountered
an unexpected error while attempting to build the container system.: null]
        at
org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:55)
        at
org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:42)
        at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
        at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
        at javax.naming.InitialContext.init(InitialContext.java:223)
        at javax.naming.InitialContext.<init>(InitialContext.java:197)
        at ca.triumf.mis.hr.TestSuite.setUp(TestSuite.java:66)
        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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
        at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
        at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
        at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
        at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
        at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
        at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
        at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:165)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:107)
        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.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:289)
        at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1005)
Caused by: org.apache.openejb.OpenEJBException: OpenEJB has encountered a
fatal error and cannot be started: The Assembler encountered an unexpected
error while attempting to build the container system.: null
        at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:132)
        at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:60)
        at org.apache.openejb.OpenEJB.init(OpenEJB.java:271)
        at org.apache.openejb.OpenEJB.init(OpenEJB.java:250)
        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.apache.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java:36)
        at
org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:71)
        at
org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:53)
        ... 26 more
Caused by: java.lang.ExceptionInInitializerError
        at
org.apache.openejb.resource.activemq.ActiveMQResourceAdapter.start(ActiveMQResourceAdapter.java:122)
        at
org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:1139)
        at
org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:357)
        at
org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:280)
        at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:125)
        ... 36 more
Caused by: java.lang.RuntimeException: Unable to load ActiveMQFactory
        at
org.apache.openejb.resource.activemq.ActiveMQFactory.<clinit>(ActiveMQFactory.java:46)
        ... 41 more


Additionally, I get a warning message that ActiveMQ cannot find any log4j
appenders:

log4j:WARN No appenders could be found for logger
(org.apache.openejb.resource.activemq.ActiveMQResourceAdapter).
log4j:WARN Please initialize the log4j system properly.


But I don't know if those warnings are significant (log4j was also not
configured when this setup was working).

I would appreciate some insight on how to get this working again, thanks in
advance!

Brian Leathem

-- 
View this message in context: http://n4.nabble.com/Integration-tests-using-maven-and-OpenEJB-broke-with-a-recent-OpenEJB-SANPSHOT-release-tp1598156p1598156.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: [english 100%] Re: Integration tests using maven and OpenEJBbroke with a recentOpenEJB-SANPSHOT release

Posted by Andy <an...@orprovision.com>.
On 30.03.2010 18:01, bleathem wrote:
> On 03/30/2010 05:08 AM, AndyG [via OpenEJB] wrote:
>    
>> You are missing the ActiveMQ (either 4.x 'or' 5.x) jars from the
>> openejb snapshot in your classpath.
>>      
> Yep, that was it thanks.  I had pinned my ActiveMQ maven dependency to
> activemp-core 4.1.2 many moons ago, in order to get my tests to run.
> Now, having removed this version pinning, my tests now work again.
>
> Thanks for your help.
>
> Brian
>
>    
You're welcome :-)

____________
Virus checked by G Data AntiVirus
Version: AVA 19.10742 dated 30.03.2010


Re: Integration tests using maven and OpenEJB broke with a recent OpenEJB-SANPSHOT release

Posted by bleathem <bl...@gmail.com>.
On 03/30/2010 05:08 AM, AndyG [via OpenEJB] wrote:
> You are missing the ActiveMQ (either 4.x 'or' 5.x) jars from the 
> openejb snapshot in your classpath.

Yep, that was it thanks.  I had pinned my ActiveMQ maven dependency to 
activemp-core 4.1.2 many moons ago, in order to get my tests to run.  
Now, having removed this version pinning, my tests now work again.

Thanks for your help.

Brian

-- 
View this message in context: http://n4.nabble.com/Integration-tests-using-maven-and-OpenEJB-broke-with-a-recent-OpenEJB-SANPSHOT-release-tp1598156p1745432.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Integration tests using maven and OpenEJB broke with a recent OpenEJB-SANPSHOT release

Posted by AndyG <an...@orprovision.com>.
You are missing the ActiveMQ (either 4.x 'or' 5.x) jars from the openejb
snapshot in your classpath.
-- 
View this message in context: http://n4.nabble.com/Integration-tests-using-maven-and-OpenEJB-broke-with-a-recent-OpenEJB-SANPSHOT-release-tp1598156p1745104.html
Sent from the OpenEJB User mailing list archive at Nabble.com.