Posted by ljnelson
on April 7, 2010 at 1:12 PM PDT
So many articles about EJBContainer, so many that don't work!
There's a great article here (http://www.adam-bien.com/roller/abien/entry/embedding_ejb_3_1_container ) showing how to get an EJB 3.1 container running. It claims that no further configuration is necessary. This implies I don't have to set up a filesystem, or tell the testing machinery where to create the embedded EJB container, or anything. That's great; so I don't. I just say EJBContainer.createEJBContainer() and off I go.
(It starts up, I should add, barfs out several SEVERE messages that look alarming concerning the fact that it doesn't know where its directory is, even though I'm told I don't have to supply one.)
When I fire up a similar JUnit test under Maven, lo and behold Glassfish comes up, tells me no modules were found (!!), and then, understandably, fails when I attempt to do any lookup--any at all, including of "java:", "java:global", etc.--since nothing got installed in it. So much for no further configuration necessary!
Another article here (http://blogs.sun.com/alexismp/entry/testing_ejb_3_1_s ) implies that EJBs that are found at container startup time will be deployed. What does that mean? Do I have to package up an ejb-jar? Can't I leave my classes in their maven directories (target/classes, target/test-classes)? What's going on here? Isn't this configuration? Shouldn't my code get found, as described in the article? If not, where are the steps I need to perform so that Glassfish finds my stuff?
So, having read these two articles and the product documentation, I still can't figure out how to test my EJB. What piece of documentation should I read next?