users@glassfish.java.net

Re: Embedded GlassFish - No EJBContainer available with multiple JUnit tests

From: Antonio Goncalves <antonio.mailing_at_gmail.com>
Date: Tue, 28 Sep 2010 16:02:08 +0200

I don't get it. When I use EJBContainer I thought the glassfish-embedded-all
jar file was enough and self explanatory. So I'm not using any external
domain.xml or keystore, I actually thought it was bundled inside the jar
(but I haven't checked it myself). Does this mean I need to install the full
GlassFish server as well as using the glassfish-embedded-all jar ?

2010/9/28 Major Péter <majorpetya_at_sch.bme.hu>

> Hi,
>
> from the iiop.cannot_find_keyalias message I would think, that the IIOP
> SSL couldn't be initialized, because the provided alias for the private
> key isn't available in the keystore, check your domain.xml and your
> keystore.jks.
>
> Regards,
> Peter
>
> 2010-09-28 15:37 keltezéssel, Antonio Goncalves írta:
> > Hi Marina,
> >
> > I've tried with 3.1-b21, 3.1-b20, 3.1-b19 (after I stopped because
> > download is long) but in this case no tests at all pass. I have the
> > following exception. Do I have to do something different from the 3.0.1
> ?:
> >
> > java.lang.RuntimeException: java.util.MissingResourceException: Can't
> > find resource for bundle java.util.PropertyResourceBundle, key
> > iiop.cannot_find_keyalias
> > at
> >
> com.sun.enterprise.iiop.security.IIOPSSLUtilImpl.getKeyManagers(IIOPSSLUtilImpl.java:115)
> > at
> >
> org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.init(IIOPSSLSocketFactory.java:246)
> > at
> >
> org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.<init>(IIOPSSLSocketFactory.java:148)
> > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> > at
> >
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> > at
> >
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> > at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> > at java.lang.Class.newInstance0(Class.java:355)
> > at java.lang.Class.newInstance(Class.java:308)
> > at com.sun.corba.ee.impl.orb.ParserTable$4.operate(ParserTable.java:750)
> > at
> >
> com.sun.corba.ee.impl.orb.NormalParserAction.apply(NormalParserAction.java:62)
> > at com.sun.corba.ee.spi.orb.PropertyParser.parse(PropertyParser.java:85)
> > at com.sun.corba.ee.spi.orb.ParserImplBase.init(ParserImplBase.java:85)
> > at
> >
> com.sun.corba.ee.impl.orb.ORBDataParserImpl.<init>(ORBDataParserImpl.java:496)
> > at com.sun.corba.ee.impl.orb.ORBImpl.postInit(ORBImpl.java:542)
> > at com.sun.corba.ee.impl.orb.ORBImpl.set_parameters(ORBImpl.java:689)
> > at com.sun.corba.ee.impl.orb.ORBImpl.setParameters(ORBImpl.java:676)
> > at com.sun.corba.ee.spi.osgi.ORBFactory.initialize(ORBFactory.java:107)
> > at
> >
> org.glassfish.enterprise.iiop.impl.GlassFishORBManager.initORB(GlassFishORBManager.java:576)
> > at
> >
> org.glassfish.enterprise.iiop.impl.GlassFishORBManager.getORB(GlassFishORBManager.java:262)
> > at
> >
> org.glassfish.enterprise.iiop.impl.GlassFishORBFactoryImpl.createORB(GlassFishORBFactoryImpl.java:93)
> > at
> >
> org.glassfish.enterprise.iiop.api.GlassFishORBHelper.getORB(GlassFishORBHelper.java:120)
> > at
> >
> org.glassfish.enterprise.iiop.api.GlassFishORBHelper.getProtocolManager(GlassFishORBHelper.java:187)
> > at
> >
> com.sun.ejb.containers.BaseContainer.initializeProtocolManager(BaseContainer.java:816)
> > at com.sun.ejb.containers.BaseContainer.<init>(BaseContainer.java:564)
> > at
> >
> com.sun.ejb.containers.StatelessSessionContainer.<init>(StatelessSessionContainer.java:155)
> > at
> >
> com.sun.ejb.containers.StatelessSessionContainer.<init>(StatelessSessionContainer.java:149)
> > at
> >
> com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:105)
> > at
> >
> org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:230)
> > at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:256)
> > at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:97)
> > at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:174)
> > at
> >
> org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:239)
> > at
> >
> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:401)
> > at
> >
> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:221)
> > at
> >
> org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:193)
> > at
> >
> org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:142)
> > at
> >
> org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:137)
> > at
> >
> org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:128)
> > at
> >
> javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:120)
> > at
> >
> org.beginningee6.book.chapter07.ex01.ItemEJB01Test.initContainer(ItemEJB01Test.java:39)
> > 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:236)
> > at org.junit.runners.Suite.runChild(Suite.java:128)
> > at org.junit.runners.Suite.runChild(Suite.java:24)
> > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
> > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
> > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
> > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
> > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
> > at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
> > at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
> > at
> >
> com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:94)
> > at
> >
> com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:192)
> > at
> com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:64)
> > 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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
> > Caused by: java.util.MissingResourceException: Can't find resource for
> > bundle java.util.PropertyResourceBundle, key iiop.cannot_find_keyalias
> > at java.util.ResourceBundle.getObject(ResourceBundle.java:374)
> > at java.util.ResourceBundle.getString(ResourceBundle.java:334)
> > at
> >
> com.sun.enterprise.iiop.security.IIOPSSLUtilImpl.getFormatMessage(IIOPSSLUtilImpl.java:135)
> > at
> >
> com.sun.enterprise.iiop.security.IIOPSSLUtilImpl.getKeyManagers(IIOPSSLUtilImpl.java:96)
> > ... 67 more
> > 28 sept. 2010 14:51:18 com.sun.corba.ee.impl.orb.ParserTable$4 operate
> > ATTENTION: "IOP02410214: (DATA_CONVERSION)
> > org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory is not a valid
> > custom socket factory"
> > org.omg.CORBA.DATA_CONVERSION: vmcid: SUN minor code: 214 completed:
> No
> > at
> >
> com.sun.corba.ee.impl.logging.ORBUtilSystemException.badCustomSocketFactory(ORBUtilSystemException.java:4852)
> > at
> >
> com.sun.corba.ee.impl.logging.ORBUtilSystemException.badCustomSocketFactory(ORBUtilSystemException.java:4871)
> > at com.sun.corba.ee.impl.orb.ParserTable$4.operate(ParserTable.java:758)
> > at
> >
> com.sun.corba.ee.impl.orb.NormalParserAction.apply(NormalParserAction.java:62)
> > at com.sun.corba.ee.spi.orb.PropertyParser.parse(PropertyParser.java:85)
> > at com.sun.corba.ee.spi.orb.ParserImplBase.init(ParserImplBase.java:85)
> > at
> >
> com.sun.corba.ee.impl.orb.ORBDataParserImpl.<init>(ORBDataParserImpl.java:496)
> > at com.sun.corba.ee.impl.orb.ORBImpl.postInit(ORBImpl.java:542)
> > at com.sun.corba.ee.impl.orb.ORBImpl.set_parameters(ORBImpl.java:689)
> > at com.sun.corba.ee.impl.orb.ORBImpl.setParameters(ORBImpl.java:676)
> > at com.sun.corba.ee.spi.osgi.ORBFactory.initialize(ORBFactory.java:107)
> > at
> >
> org.glassfish.enterprise.iiop.impl.GlassFishORBManager.initORB(GlassFishORBManager.java:576)
> > at
> >
> org.glassfish.enterprise.iiop.impl.GlassFishORBManager.getORB(GlassFishORBManager.java:262)
> > at
> >
> org.glassfish.enterprise.iiop.impl.GlassFishORBFactoryImpl.createORB(GlassFishORBFactoryImpl.java:93)
> > at
> >
> org.glassfish.enterprise.iiop.api.GlassFishORBHelper.getORB(GlassFishORBHelper.java:120)
> > at
> >
> org.glassfish.enterprise.iiop.api.GlassFishORBHelper.getProtocolManager(GlassFishORBHelper.java:187)
> > at
> >
> com.sun.ejb.containers.BaseContainer.initializeProtocolManager(BaseContainer.java:816)
> > at com.sun.ejb.containers.BaseContainer.<init>(BaseContainer.java:564)
> > at
> >
> com.sun.ejb.containers.StatelessSessionContainer.<init>(StatelessSessionContainer.java:155)
> > at
> >
> com.sun.ejb.containers.StatelessSessionContainer.<init>(StatelessSessionContainer.java:149)
> > at
> >
> com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:105)
> > at
> >
> org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:230)
> > at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:256)
> > at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:97)
> > at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:174)
> > at
> >
> org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:239)
> > at
> >
> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:401)
> > at
> >
> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:221)
> > at
> >
> org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:193)
> > at
> >
> org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:142)
> > at
> >
> org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:137)
> > at
> >
> org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:128)
> > at
> >
> javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:120)
> > at
> >
> org.beginningee6.book.chapter07.ex01.ItemEJB01Test.initContainer(ItemEJB01Test.java:39)
> > 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:236)
> > at org.junit.runners.Suite.runChild(Suite.java:128)
> > at org.junit.runners.Suite.runChild(Suite.java:24)
> > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
> > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
> > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
> > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
> > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
> > at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
> > at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
> > at
> >
> com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:94)
> > at
> >
> com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:192)
> > at
> com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:64)
> > 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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
> >
> >
> > Any idea ?
> > Thanks,
> > Antonio
> >
> > 2010/9/27 Marina Vatkina <marina.vatkina_at_oracle.com
> > <mailto:marina.vatkina_at_oracle.com>>
> >
> > Hi Antonio,
> >
> > There is a known problem with using JPA with more than one
> > EJBContainer.createEJBContainer call in the same VM. Otherwise, the
> > console log should give some message on what went wrong (but try the
> > recent builds because they don't have a bug of suppressing
> > deployment errors).
> >
> > Regards,
> > -marina
> >
> >
> > Antonio Goncalves wrote:
> >
> > Hi,
> >
> > I have several JUnit test classes to test my EJBs. Taken one by
> > one, each test passes (they use JPA, Derby and so on). But when
> > I run all the tests (either with my IDE, Maven or
> > @RunWith(Suite.class) @Suite.SuiteClasses({...})) I have a No
> > EJBContainer provider available (see stack trace below). In
> > fact, the first test passes and all the following don't. I think
> > it could be because I'm not cleaning the embbed container
> > correctly between tests. Here is what I do on each test class :
> >
> >
> > public class ItemEJB01Test {
> >
> > private static EJBContainer ec;
> > private static Context ctx;
> >
> >
> > @BeforeClass
> > public static void initContainer() throws Exception {
> > Map<String, Object> properties = new HashMap<String,
> > Object>();
> > properties.put(EJBContainer.MODULES, new
> > File("target/classes"));
> > *ec = EJBContainer.createEJBContainer(properties);
> > <---- This is where is breaks*
> > ctx = ec.getContext();
> > }
> >
> > @AfterClass
> > public static void closeContainer() throws Exception {
> > if (ctx != null)
> > ctx.close();
> > if (ec != null)
> > ec.close();
> > }
> > ...
> > ...
> > }
> >
> >
> > I'm using :
> >
> > <dependency>
> > <groupId>org.glassfish.extras</groupId>
> > <artifactId>glassfish-embedded-all</artifactId>
> > <version>*3.0.1-b20*</version>
> > </dependency>
> > </dependencies>
> >
> >
> > Any idea ?
> > Thanks,
> > Antonio
> >
> >
> > javax.ejb.EJBException: No EJBContainer provider available
> > The following providers:
> > org.glassfish.ejb.embedded.EJBContainerProviderImpl
> > Returned null from createEJBContainer call.
> >
> > at
> >
> javax.ejb.embeddable.EJBContainer.reportError(EJBContainer.java:186)
> > at
> >
> javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:121)
> > at
> >
> org.beginningee6.book.chapter07.ex03.ShoppingCartEJB03Test.initContainer(ShoppingCartEJB03Test.java:40)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> > at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > 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:236)
> > at org.junit.runners.Suite.runChild(Suite.java:128)
> > at org.junit.runners.Suite.runChild(Suite.java:24)
> > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
> > at
> org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
> > at
> org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
> > at
> org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
> > at
> org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
> > at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
> > at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
> > at
> >
> com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:94)
> > at
> >
> com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:192)
> > at
> >
> com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:64)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> > at
> >
> com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> > <mailto:users-unsubscribe_at_glassfish.dev.java.net>
> > For additional commands, e-mail: users-help_at_glassfish.dev.java.net
> > <mailto:users-help_at_glassfish.dev.java.net>
> >
> >
> >
> >
> > --
> > --
> > Antonio Goncalves (antonio.goncalves_at_gmail.com
> > <mailto:antonio.goncalves_at_gmail.com>)
> > Software architect
> >
> > Web site : www.antoniogoncalves.org <http://www.antoniogoncalves.org>
> > Blog: agoncal.wordpress.com <http://agoncal.wordpress.com>
> > Feed: feeds2.feedburner.com/AntonioGoncalves
> > <http://feeds2.feedburner.com/AntonioGoncalves>
> > Paris JUG leader : www.parisjug.org <http://www.parisjug.org>
> > LinkedIn: www.linkedin.com/in/agoncal <
> http://www.linkedin.com/in/agoncal>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>


-- 
--
Antonio Goncalves (antonio.goncalves_at_gmail.com)
Software architect
Web site : www.antoniogoncalves.org
Blog: agoncal.wordpress.com
Feed: feeds2.feedburner.com/AntonioGoncalves
Paris JUG leader : www.parisjug.org
LinkedIn: www.linkedin.com/in/agoncal