users@glassfish.java.net

Re: [Fwd: [embedded] How to unit test an EJB with Maven ?]

From: <glassfish_at_javadesktop.org>
Date: Thu, 03 Sep 2009 05:20:59 PDT

Hi everyone.

I was just trying unit testing an EJB using glassfish-embedded-all version 3.0-b61, maven, junit, but I got two different errors. First of all, this is my test class:

public class UserTest
{
    private static EJBContainer container;
    private static Context ctx;

    @BeforeClass
    public static void initContainer()
    {
        container = EJBContainer.createEJBContainer();
        ctx = container.getContext();
    }

    @AfterClass
    public static void cleanContainer()
    {
        container.close();
    }

    @Test
    public void insertUser() throws NamingException
    {
        UserService userService = (UserService) ctx.lookup("java:global/UserService");
        assertNotNull("User Service cannot be null", userService);

        User user = new User();
        user.setName("Test user");

        userService.create(user);
        assertNotNull("ID shouldn't be null", user.getId());
    }

}

I think there's nothink wrong in this class, but I'm not sure whether the way I create the EJB container and context is fine or I'm doing something wrong. I guess the JNDI name "java:global/UserService" is OK, too?

When I run "maven test" I get two different errors. This is the content of the .\target\surefire-reports\vv.vv2.UserTest.txt file:

-------------------------------------------------------------------------------
Test set: vv.vv2.UserTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 237.422 sec <<< FAILURE!
insertUser(vv.vv2.UserTest) Time elapsed: 0.046 sec <<< ERROR!
javax.naming.NamingException: Lookup failed for 'java:global/UserService' in SerialContext [Root exception is javax.naming.NameNotFoundException: java:global]
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:434)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at vv.vv2.UserTest.insertUser(UserTest.java:46)
        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.InvokeMethod.evaluate(InvokeMethod.java:20)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:44)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
        at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
        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:127)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
        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:345)
        at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
Caused by: javax.naming.NameNotFoundException: java:global
        at com.sun.enterprise.naming.impl.TransientContext.resolveContext(TransientContext.java:252)
        at com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:171)
        at com.sun.enterprise.naming.impl.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:58)
        at com.sun.enterprise.naming.impl.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:100)
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:422)
        ... 31 more



So isn't it OK to refer to the EJB by using "java:global" ? BTW, I don't think it matters, but the UserService class lives in the vv.vv2.services package.



On the other side, the following messages, which don't seem to have nothing to do with the previous stack trace, are displayed in the console:

03-sep-2009 13:44:25 org.glassfish.ejb.embedded.EJBContainerProviderImpl isRequestedEJBModule
INFO: ... is Requested EJB module [glassfish-embedded-all-3.0-b61]: true
03-sep-2009 13:44:25 org.glassfish.ejb.embedded.EJBContainerProviderImpl addEJBModule
INFO: ... Added EJB Module .... glassfish-embedded-all-3.0-b61.jar
03-sep-2009 13:44:27 org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread startConnector
INFO: JMXStartupService: Started JMXConnector, JMXService URL = service:jmx:rmi://XXXXXXXXXXXXXXXXXXXX:8686/jndi/rmi://XXXXXXXXXXXXXXXXXXXX:8686/jmxrmi
Deployment expansion took 80501
03-sep-2009 13:45:54 com.sun.enterprise.transaction.JavaEETransactionManagerSimplified initDelegates
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
03-sep-2009 13:45:54 org.glassfish.admin.monitor.StatsProviderManagerDelegateImpl register
Deployment expansion took 80501
03-sep-2009 13:45:54 com.sun.enterprise.transaction.JavaEETransactionManagerSimplified initDelegates
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
03-sep-2009 13:45:54 org.glassfish.admin.monitor.StatsProviderManagerDelegateImpl register
GRAVE: flashlight registration failed
java.lang.RuntimeException: Invalid probe desc: glassfish:transaction:transaction-service:deactivated
        at org.glassfish.flashlight.impl.client.FlashlightProbeClientMediator.handleListenerAnnotations(FlashlightProbeClientMediator.java:239)
        at org.glassfish.flashlight.impl.client.FlashlightProbeClientMediator.registerJavaListener(FlashlightProbeClientMediator.java:162)
        at org.glassfish.flashlight.impl.client.FlashlightProbeClientMediator.registerListener(FlashlightProbeClientMediator.java:140)
        at org.glassfish.admin.monitor.StatsProviderManagerDelegateImpl.register(StatsProviderManagerDelegateImpl.java:114)
        at org.glassfish.external.probe.provider.StatsProviderManager.register(StatsProviderManager.java:61)
        at com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.initProperties(JavaEETransactionManagerSimplified.java:233)
        at com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.postConstruct(JavaEETransactionManagerSimplified.java:158)
        at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:174)
        at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:89)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:86)
        at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)
        at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
        at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
        at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
        at org.jvnet.hk2.component.Habitat.getComponent(Habitat.java:358)
        at com.sun.hk2.component.AbstractWombImpl$1.getValue(AbstractWombImpl.java:144)
        at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:81)
        at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:170)
        at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:89)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:86)
        at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)
        at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
        at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
        at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
        at org.jvnet.hk2.component.Habitat.getComponent(Habitat.java:358)
        at com.sun.hk2.component.AbstractWombImpl$1.getValue(AbstractWombImpl.java:144)
        at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:81)
        at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:170)
        at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:89)
        at java.security.AccessController.doPrivileged(Native Method)
>>Started EJB Container Service....: server
        at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:86)
        at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)
>>EjbContainerUtil: com.sun.ejb.containers.EjbContainerUtilImpl_at_e5f0d2
        at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
        at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
        at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
        at org.glassfish.internal.data.EngineInfo.getContainer(EngineInfo.java:78)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.startContainers(ApplicationLifecycle.java:680)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:434)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:235)
        at org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:191)
        at org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:151)
        at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:98)
        at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:124)
        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)
        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:78)
        at vv.vv2.UserTest.initContainer(UserTest.java:32)
        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:127)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
        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:345)
        at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
03-sep-2009 13:45:54 com.sun.enterprise.security.SecurityLifecycle <init>
INFO: security.secmgroff
03-sep-2009 13:45:54 org.glassfish.api.ActionReport failure
GRAVE: Exception while deploying the app
org.jvnet.hk2.component.UnsatisfiedDepedencyException: Unsatisfied dependency exception : private com.sun.enterprise.security.ssl.SSLUtils com.sun.enterprise.security.SecurityLifecycle.sslUtils
        at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:102)
        at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:170)
        at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:89)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:86)
        at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)
        at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
        at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
        at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
        at com.sun.enterprise.security.SecuritySniffer.setup(SecuritySniffer.java:105)
        at com.sun.enterprise.v3.server.ContainerStarter.startContainer(ContainerStarter.java:101)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainer(ApplicationLifecycle.java:667)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:424)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:235)
        at org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:191)
        at org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:151)
        at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:98)
        at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:124)
        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)
        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:78)
        at vv.vv2.UserTest.initContainer(UserTest.java:32)
        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:127)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
        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:345)
        at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
Caused by: org.jvnet.hk2.component.ComponentException: Injection failed on com.sun.enterprise.server.pluggable.SecuritySupport com.sun.enterprise.security.ssl.SSLUtils.secSupp
        at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:107)
        at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:170)
        at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:89)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:86)
        at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)
        at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
        at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
        at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
        at org.jvnet.hk2.component.Habitat.getBy(Habitat.java:599)
        at org.jvnet.hk2.component.Habitat.getByType(Habitat.java:580)
        at com.sun.hk2.component.AbstractWombImpl$1.getValue(AbstractWombImpl.java:149)
        at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:81)
        ... 40 more
Caused by: java.lang.IllegalStateException: java.io.EOFException
        at com.sun.enterprise.security.ssl.SecuritySupportImpl.loadStores(SecuritySupportImpl.java:156)
        at com.sun.enterprise.security.ssl.SecuritySupportImpl.initJKS(SecuritySupportImpl.java:107)
        at com.sun.enterprise.security.ssl.SecuritySupportImpl.<init>(SecuritySupportImpl.java:86)
        at com.sun.enterprise.security.ssl.SecuritySupportImpl.<init>(SecuritySupportImpl.java:81)
        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.hk2.component.ConstructorWomb.create(ConstructorWomb.java:72)
        at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:71)
        at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
        at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
        at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
        at org.jvnet.hk2.component.Habitat.getComponent(Habitat.java:358)
        at com.sun.hk2.component.AbstractWombImpl$1.getValue(AbstractWombImpl.java:144)
        at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:81)
        ... 52 more
Caused by: java.io.EOFException
        at java.io.DataInputStream.readInt(DataInputStream.java:375)
        at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:628)
        at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:38)
        at java.security.KeyStore.load(KeyStore.java:1185)
        at com.sun.enterprise.security.ssl.SecuritySupportImpl.loadKS(SecuritySupportImpl.java:194)
        at com.sun.enterprise.security.ssl.SecuritySupportImpl.loadStores(SecuritySupportImpl.java:147)
        ... 69 more
03-sep-2009 13:45:54 com.sun.enterprise.security.SecurityLifecycle <init>
INFO: security.secmgroff
03-sep-2009 13:45:54 org.glassfish.api.ActionReport failure
GRAVE: Exception while deploying the app
org.jvnet.hk2.component.UnsatisfiedDepedencyException: Unsatisfied dependency exception : private com.sun.enterprise.security.ssl.SSLUtils com.sun.enterprise.security.SecurityLifecycle.sslUtils
        at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:102)
        at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:170)
        at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:89)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:86)
        at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)
        at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
        at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
        at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
        at com.sun.enterprise.security.SecuritySniffer.setup(SecuritySniffer.java:105)
        at com.sun.enterprise.v3.server.ContainerStarter.startContainer(ContainerStarter.java:101)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainer(ApplicationLifecycle.java:667)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:424)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:235)
        at org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:191)
        at org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:151)
        at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:98)
        at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:124)
        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)
        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:78)
        at vv.vv2.UserTest.initContainer(UserTest.java:32)
        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:127)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
        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:345)
        at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
Caused by: org.jvnet.hk2.component.ComponentException: Injection failed on com.sun.enterprise.server.pluggable.SecuritySupport com.sun.enterprise.security.ssl.SSLUtils.secSupp
        at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:107)
        at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:170)
        at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:89)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:86)
        at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)
        at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
        at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
        at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
        at org.jvnet.hk2.component.Habitat.getBy(Habitat.java:599)
        at org.jvnet.hk2.component.Habitat.getByType(Habitat.java:580)
        at com.sun.hk2.component.AbstractWombImpl$1.getValue(AbstractWombImpl.java:149)
        at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:81)
        ... 40 more
Caused by: java.lang.IllegalStateException: java.io.EOFException
        at com.sun.enterprise.security.ssl.SecuritySupportImpl.loadStores(SecuritySupportImpl.java:156)
        at com.sun.enterprise.security.ssl.SecuritySupportImpl.initJKS(SecuritySupportImpl.java:107)
        at com.sun.enterprise.security.ssl.SecuritySupportImpl.<init>(SecuritySupportImpl.java:86)
        at com.sun.enterprise.security.ssl.SecuritySupportImpl.<init>(SecuritySupportImpl.java:81)
        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.hk2.component.ConstructorWomb.create(ConstructorWomb.java:72)
        at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:71)
        at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
        at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
        at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
        at org.jvnet.hk2.component.Habitat.getComponent(Habitat.java:358)
        at com.sun.hk2.component.AbstractWombImpl$1.getValue(AbstractWombImpl.java:144)
        at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:81)
        ... 52 more
Caused by: java.io.EOFException
        at java.io.DataInputStream.readInt(DataInputStream.java:375)
        at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:628)
        at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:38)
        at java.security.KeyStore.load(KeyStore.java:1185)
        at com.sun.enterprise.security.ssl.SecuritySupportImpl.loadKS(SecuritySupportImpl.java:194)
        at com.sun.enterprise.security.ssl.SecuritySupportImpl.loadStores(SecuritySupportImpl.java:147)
        ... 69 more
delete XXXXXXXXXXXXXXXXXXXX\gfembed3284689916518051156tmp = true
03-sep-2009 13:45:55 org.glassfish.ejb.embedded.EJBContainerImpl getContext
INFO: IN getContext()
03-sep-2009 13:45:55 org.glassfish.ejb.embedded.EJBContainerImpl close
Deleting recursively XXXXXXXXXXXXXXXXXXXX\gfembed3284689916518051156tmp
INFO: IN close()
03-sep-2009 13:45:55 org.glassfish.admin.mbeanserver.JMXStartupService shutdown
INFO: JMXStartupService: shutting down AMX and JMX
03-sep-2009 13:45:55 org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread shutdown
INFO: JMXStartupService: Stopped JMXConnectorServer: service:jmx:rmi://XXXXXXXXXXXXXXXXXXXX:8686/jndi/rmi://XXXXXXXXXXXXXXXXXXXX:8686/jmxrmi
03-sep-2009 13:45:55 AppServerStartup run
INFO: [Thread[GlassFish Kernel Main Thread,5,main]] exiting
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 237.422 sec <<< FAILURE!

Results :

Tests in error:
  insertUser(vv.vv2.UserTest)

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------



I guess the naming error is the root of the others? I'm a bit confused here.


So the question is, is everything OK in the test class, or I'm doing something wrong? Is glassfish-embedded-all ready for this? Do I have to initialize the EJB context somehow for the naming to work?


Thanks in advance,
J.
[Message sent by forum member 'jayeff' (jforns_at_gmail.com)]

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