users@glassfish.java.net

Re: Test EJB app with JUnit and maven-embedded-glassfish-plugin

From: <glassfish_at_javadesktop.org>
Date: Mon, 18 Oct 2010 10:41:27 PDT

Have you checked https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html ?

My guess is you either need to include a dependency on gf-client.jar to make the InitialContext() with no args work, or you need to set the javax.naming.factory.initial property explicitly.

When I started doing my first integration tests with Glassfish 3.x, I also tried working with the maven-embedded-glassfish-plugin in the same way you did, but among other things, I had issues with the Surefire classloader, so now I'm launching Embedded Glassfish directly in my JUnit tests.

I've factored out some helper classes for setting up the test environment which are now available from http://code.google.com/p/jeeunit/.

The JBoss Arquillian project has a similar approach on a larger scale.

HTH;
Harald
[Message sent by forum member 'hwellmann']

http://forums.java.net/jive/thread.jspa?messageID=485489