users@glassfish.java.net

Re: Embedded EJBContainer fails to instantiate when SSB is also a WebService

From: Bhakti Mehta <bhakti.mehta_at_oracle.com>
Date: Tue, 30 Aug 2011 12:41:49 -0700

I checked with Marina too and as of now this is not supported for
Embedded EjbContainer and Stateless Webservice . I think when packaged
in a war we had a bug in 3.1 which was causing it to behave as a webapp
and I suspect may be that is why it is working in 3.1 when packaged in war.
Regards,
Bhakti

N W wrote:
> I've been running unit/integration testing using the GF embedded EJB container with GF v3.1 (bld 43) and that has been working fine. That is until I added a new local stateless session bean which is also annotated with @WebService. When I added that new EJB existing tests which don't even use that new bean fail to create the embedded container.
>
> The embedded container is initialized and created like so:
>
> Map<String, Object> p = new HashMap<String, Object>();
> p.put(EJBContainer.APP_NAME, "foo");
> p.put(EJBContainer.MODULES, new File("out/production/FOO"));
> p.put("org.glassfish.ejb.embedded.glassfish.installation.root", "C:/glassfish3/glassfish");
> ejbC = EJBContainer.createEJBContainer(p);
>
> The exception I get when createEJBContainer(p) is called is:
>
> SEVERE: EJB6001:Caught exception instantiating EmbeddedContainer.
> javax.ejb.EJBException: Failed to deploy EJB modules - see log for details
> at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:145)
> at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:132)
> at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:127)
>
>
> When deployed in production the app is packaged as a single WAR and everything works fine. Is this a bug or am overlooking some additional configuration step for the embedded container now that I have introduced this @Stateless/_at_WebService class?
>
> Thanks,
>
> -Noah
>
>