users@glassfish.java.net

Re: CommunicationException in unit test

From: Marina Vatkina <marina.vatkina_at_oracle.com>
Date: Mon, 10 Sep 2012 16:57:31 -0700

Very strange... ORB shouldn't even be started for a local bean... May be
there are remote beans in the path?

-marina

Herr Dominik Grupp wrote:
> Hello,
>
> using non-embedded glassfish I am trying to run a HelloWorld unit test using the embedded glassfish. However, I get the below exception. See below for pom and classes. What can I do to solve that problem?
>
> WARNUNG: IOP00100006: Class com.sun.ejb.containers.JavaGlobalJndiNamingObjectProxy is not Serializable
> org.omg.CORBA.BAD_PARAM: WARNUNG: IOP00100006: Class com.sun.ejb.containers.JavaGlobalJndiNamingObjectProxy is not Serializable vmcid: SUN minor code: 6 completed: Maybe
> 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 com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:248)
> at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:95)
> at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.handleFullLogging(WrapperGenerator.java:387)
> at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.access$400(WrapperGenerator.java:107)
> at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator$2.invoke(WrapperGenerator.java:511)
> at com.sun.corba.ee.spi.orbutil.proxy.CompositeInvocationHandlerImpl.invoke(CompositeInvocationHandlerImpl.java:99)
> at $Proxy89.notSerializable(Unknown Source)
> at com.sun.corba.ee.impl.orbutil.ORBUtility.throwNotSerializableForCorba(ORBUtility.java:783)
> at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.writeAny(Util.java:361)
> at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl$10.write(DynamicMethodMarshallerImpl.java:307)
> at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl.writeArguments(DynamicMethodMarshallerImpl.java:466)
> at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:198)
> at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
> at com.sun.corba.ee.impl.presentation.rmi.codegen.CodegenStubBase.invoke(CodegenStubBase.java:227)
> at com.sun.enterprise.naming.impl._SerialContextProvider_DynamicStub.rebind(com/sun/enterprise/naming/impl/_SerialContextProvider_DynamicStub.java)
> at com.sun.enterprise.naming.impl.SerialContext.rebind(SerialContext.java:707)
> at com.sun.enterprise.naming.impl.SerialContext.rebind(SerialContext.java:724)
> at javax.naming.InitialContext.rebind(InitialContext.java:412)
> at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.publishObject(GlassfishNamingManagerImpl.java:206)
> at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.publishObject(GlassfishNamingManagerImpl.java:189)
> at com.sun.ejb.containers.BaseContainer$JndiInfo.publish(BaseContainer.java:5629)
> at com.sun.ejb.containers.BaseContainer.initializeHome(BaseContainer.java:1540)
> at com.sun.ejb.containers.StatelessSessionContainer.initializeHome(StatelessSessionContainer.java:202)
> at com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:167)
> at org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:230)
> at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:305)
> at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:108)
> at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:186)
> at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:264)
> at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:460)
> at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
> at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)
> at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)
> at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)
> at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)
> at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
> at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)
> at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)
> at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:129)
> at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:105)
> at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:140)
> at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:134)
> at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:127)
> at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)
> at de.exim.HelloWorldTest.setUpClass(HelloWorldTest.java:25)
> 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:45)
> at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
> at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
> at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
> at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
> at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)
> at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
> 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.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
> at $Proxy0.invoke(Unknown Source)
> at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
> at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
> at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
> 08.09.2012 14:44:30 org.glassfish.internal.data.ModuleInfo load
> SCHWERWIEGEND: Exception while invoking class org.glassfish.ejb.startup.EjbDeployer load method
> java.lang.RuntimeException: EJB Container initialization error
> at org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:242)
> at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:305)
> at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:108)
> at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:186)
> at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:264)
> at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:460)
> at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
> at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)
> at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)
> at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)
> at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)
> at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
> at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)
> at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)
> at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:129)
> at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:105)
> at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:140)
> at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:134)
> at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:127)
> at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)
> at de.exim.HelloWorldTest.setUpClass(HelloWorldTest.java:25)
> 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:45)
> at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
> at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
> at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
> at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
> at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)
> at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
> 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.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
> at $Proxy0.invoke(Unknown Source)
> at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
> at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
> at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
> Caused by: java.lang.RuntimeException: Error while binding JNDI name java:global/classes/HelloWorld!de.exim.HelloWorld for EJB HelloWorld
> at com.sun.ejb.containers.BaseContainer.initializeHome(BaseContainer.java:1553)
> at com.sun.ejb.containers.StatelessSessionContainer.initializeHome(StatelessSessionContainer.java:202)
> at com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:167)
> at org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:230)
> ... 42 more
> Caused by: javax.naming.CommunicationException: java.rmi.MarshalException: CORBA BAD_PARAM 1398079494 Maybe; nested exception is:
> java.io.NotSerializableException: WARNUNG: IOP00100006: Class com.sun.ejb.containers.JavaGlobalJndiNamingObjectProxy is not Serializable
> at com.sun.enterprise.naming.impl.SerialContext.rebind(SerialContext.java:709)
> at com.sun.enterprise.naming.impl.SerialContext.rebind(SerialContext.java:724)
> at javax.naming.InitialContext.rebind(InitialContext.java:412)
> at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.publishObject(GlassfishNamingManagerImpl.java:206)
> at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.publishObject(GlassfishNamingManagerImpl.java:189)
> at com.sun.ejb.containers.BaseContainer$JndiInfo.publish(BaseContainer.java:5629)
> at com.sun.ejb.containers.BaseContainer.initializeHome(BaseContainer.java:1540)
> ... 45 more
>
>
>
>
> pom.xml
>
> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
> <modelVersion>4.0.0</modelVersion>
>
> <groupId>de.exim</groupId>
> <artifactId>aa</artifactId>
> <version>1.0-SNAPSHOT</version>
> <packaging>war</packaging>
>
> <properties>
> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
> <maven.build.timestamp.format>yyyyMMdd'T'HHmmss</maven.build.timestamp.format>
> <glassfish.home>/Users/grudom/Programme/glassfish</glassfish.home>
> <eclipselink.version>2.4.0</eclipselink.version>
> <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
> </properties>
>
> <name>aa</name>
>
> <repositories>
> <repository>
> <id>EclipseLink</id>
> <url>http://download.eclipse.org/rt/eclipselink/maven.repo</url>
> </repository>
> </repositories>
>
> <pluginRepositories>
> <pluginRepository>
> <id>Glassfish</id>
> <url>http://download.java.net/maven/glassfish/</url>
> </pluginRepository>
> </pluginRepositories>
>
> <dependencies>
> <dependency>
> <groupId>junit</groupId>
> <artifactId>junit</artifactId>
> <version>4.10</version>
> <scope>test</scope>
> </dependency>
> <dependency>
> <groupId>org.glassfish.extras</groupId>
> <artifactId>glassfish-embedded-static-shell</artifactId>
> <version>${project.version}</version>
> <scope>system</scope>
> <systemPath>
> ${glassfish.home}/glassfish/lib/embedded/glassfish-embedded-static-shell.jar
> </systemPath>
> </dependency>
> <dependency>
> <groupId>javax</groupId>
> <artifactId>javaee-api</artifactId>
> <version>6.0</version>
> <scope>provided</scope>
> </dependency>
> </dependencies>
>
> <build>
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-compiler-plugin</artifactId>
> <version>2.3.2</version>
> <configuration>
> <source>1.6</source>
> <target>1.6</target>
> <compilerArguments>
> <endorseddirs>${endorsed.dir}</endorseddirs>
> </compilerArguments>
> </configuration>
> </plugin>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-war-plugin</artifactId>
> <version>2.1.1</version>
> <configuration>
> <failOnMissingWebXml>false</failOnMissingWebXml>
> </configuration>
> </plugin>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-dependency-plugin</artifactId>
> <version>2.1</version>
> <executions>
> <execution>
> <phase>validate</phase>
> <goals>
> <goal>copy</goal>
> </goals>
> <configuration>
> <outputDirectory>${endorsed.dir}</outputDirectory>
> <silent>true</silent>
> <artifactItems>
> <artifactItem>
> <groupId>javax</groupId>
> <artifactId>javaee-endorsed-api</artifactId>
> <version>6.0</version>
> <type>jar</type>
> </artifactItem>
> </artifactItems>
> </configuration>
> </execution>
> </executions>
> </plugin>
> </plugins>
> </build>
>
> </project>
>
>
>
>
> HelloWorld.java
>
> package de.exim;
>
> import javax.ejb.Stateless;
>
> @Stateless
> public class HelloWorld {
>
> public String printHelloWorld() {
> return "Hello World";
> }
>
> }
>
>
> HelloWorldTest.java
>
>
> package de.exim;
>
> import javax.ejb.embeddable.EJBContainer;
> import javax.naming.Context;
> import javax.naming.NamingException;
> import org.junit.AfterClass;
> import static org.junit.Assert.*;
> import org.junit.BeforeClass;
> import org.junit.Test;
>
> public class HelloWorldTest {
>
> public HelloWorldTest() {
> }
> private static EJBContainer container;
> private static Context ctx;
> private static HelloWorld hw;
>
> @BeforeClass
> public static void setUpClass() throws NamingException {
> container = EJBContainer.createEJBContainer();
> ctx = container.getContext();
> hw = (HelloWorld) ctx.lookup("java:global/classes/HelloWorld");
> }
>
> @AfterClass
> public static void tearDownClass() {
> if (container != null) {
> container.close();
> }
> }
>
> @Test
> public void testBookCoursePositive() {
> assertEquals(hw.printHelloWorld(), "Hello World");
> }
> }
>
> Mike