We have an existing application deployed to a JBoss server. I'm trying to use Openejb 3.1.1 to do unit testing on a stateless session bean that contains our services. I added code to my unit test to initialize the context as shown in the examples, but whenever I try to run the JUnit test I get the following console output:
Apache OpenEJB 3.1.1 build: 20090530-06:18 http://openejb.apache.org/ INFO - openejb.home = my eclipse workspace path/myApp INFO - openejb.base = my eclipse workspace path/myApp INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service) INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager) INFO - Found ClientModule in classpath: /usr/local/dst/jboss/4.2.2.GA/server/lib/jboss-remoting.jar INFO - Found ClientModule in classpath: /usr/local/dst/jboss/4.2.2.GA/server/lib/jboss-cache-jdk50.jar INFO - Found ClientModule in classpath: /usr/local/dst/jboss/4.2.2.GA/server/esb/deploy/jbossesb.sar/lib/milyn-smooks-ejc-1.2.1.jar INFO - Found ClientModule in classpath: /home/pbuchheit/workspace.galileo/insight-lib/jbossesb-rosetta.jar INFO - Found ClientModule in classpath: /usr/local/dst/jboss/4.2.2.GA/server/lib/javassist.jar INFO - Found ClientModule in classpath: /usr/local/dst/jboss/4.2.2.GA/server/esb/deploy/jbossesb.sar/lib/jbossesb-config-model-1.0.1.jar INFO - Found ClientModule in classpath: /usr/local/dst/jboss/4.2.2.GA/server/esb/deploy/jbrules.esb/core-3.2.3.v_686_R32x.jar INFO - Found ClientModule in classpath: /usr/local/dst/jboss/4.2.2.GA/server/lib/jtds-1.2.jar INFO - Found ClientModule in classpath: /usr/local/dst/jboss/4.2.2.GA/server/lib/bsh.jar INFO - Found ClientModule in classpath: /usr/local/dst/jboss/4.2.2.GA/server/esb/deploy/soap.esb/jaxb-xjc-2.1.4.jar INFO - Found ClientModule in classpath: /usr/local/dst/jboss/4.2.2.GA/server/esb/lib/h2-1.0.68.jar INFO - Found ClientModule in classpath: /usr/local/etc/openejb-3.1.1/lib/xml-resolver-1.2.jar INFO - Found ClientModule in classpath: /usr/local/dst/jboss/4.2.2.GA/server/esb/deploy/jbossesb.sar/lib/mvel-1.3.3-java1.5.jar INFO - Found ClientModule in classpath: /usr/local/dst/jboss/4.2.2.GA/lib/endorsed/serializer.jar INFO - Found ClientModule in classpath: /usr/local/dst/jboss/4.2.2.GA/server/dev/deploy/jboss-bean.deployer/jboss-microcontainer.jar INFO - Found ClientModule in classpath: /usr/local/dst/jboss/4.2.2.GA/server/lib/jgroups.jar INFO - Found ClientModule in classpath: /usr/local/dst/jboss/4.2.2.GA/server/esb/deploy/jbossesb.sar/lib/jbossesb-rosetta.jar INFO - Found ClientModule in classpath: /usr/local/dst/jboss/4.2.2.GA/server/esb/deploy/jbossesb.sar/lib/freemarker-2.3.11.jar INFO - Found ClientModule in classpath: /usr/local/dst/jboss/4.2.2.GA/server/esb/deploy/jbossesb.sar/lib/mvel2-2.0.12.jar INFO - Found ClientModule in classpath: /usr/local/dst/jboss/4.2.2.GA/server/esb/deploy/jbossesb.sar/lib/jbossesb-config-model-1.1.0.jar INFO - Found ClientModule in classpath: /usr/local/dst/jboss/4.2.2.GA/lib/endorsed/xalan.jar INFO - Found ClientModule in classpath: /usr/local/dst/jboss/4.2.2.GA/server/lib/jboss-serialization.jar INFO - Found ClientModule in classpath: /usr/local/dst/jboss/4.2.2.GA/server/lib/iText-2.1.6.jar INFO - Found ClientModule in classpath: /usr/local/dst/jboss/4.2.2.GA/server/esb/deploy/jbrules.esb/jxl-2.4.2.jar INFO - Beginning load: /usr/local/dst/jboss/4.2.2.GA/server/lib/jboss-remoting.jar INFO - Beginning load: /usr/local/dst/jboss/4.2.2.GA/server/lib/jboss-cache-jdk50.jar INFO - Beginning load: /usr/local/dst/jboss/4.2.2.GA/server/esb/deploy/jbossesb.sar/lib/milyn-smooks-ejc-1.2.1.jar INFO - Beginning load: /home/pbuchheit/workspace.galileo/insight-lib/jbossesb-rosetta.jar INFO - Beginning load: /usr/local/dst/jboss/4.2.2.GA/server/lib/javassist.jar INFO - Beginning load: /usr/local/dst/jboss/4.2.2.GA/server/esb/deploy/jbossesb.sar/lib/jbossesb-config-model-1.0.1.jar INFO - Beginning load: /usr/local/dst/jboss/4.2.2.GA/server/esb/deploy/jbrules.esb/core-3.2.3.v_686_R32x.jar INFO - Beginning load: /usr/local/dst/jboss/4.2.2.GA/server/lib/jtds-1.2.jar INFO - Beginning load: /usr/local/dst/jboss/4.2.2.GA/server/lib/bsh.jar INFO - Beginning load: /usr/local/dst/jboss/4.2.2.GA/server/esb/deploy/soap.esb/jaxb-xjc-2.1.4.jar INFO - Beginning load: /usr/local/dst/jboss/4.2.2.GA/server/esb/lib/h2-1.0.68.jar INFO - Beginning load: /usr/local/etc/openejb-3.1.1/lib/xml-resolver-1.2.jar INFO - Beginning load: /usr/local/dst/jboss/4.2.2.GA/server/esb/deploy/jbossesb.sar/lib/mvel-1.3.3-java1.5.jar INFO - Beginning load: /usr/local/dst/jboss/4.2.2.GA/lib/endorsed/serializer.jar INFO - Beginning load: /usr/local/dst/jboss/4.2.2.GA/server/dev/deploy/jboss-bean.deployer/jboss-microcontainer.jar INFO - Beginning load: /usr/local/dst/jboss/4.2.2.GA/server/lib/jgroups.jar INFO - Beginning load: /usr/local/dst/jboss/4.2.2.GA/server/esb/deploy/jbossesb.sar/lib/jbossesb-rosetta.jar INFO - Beginning load: /usr/local/dst/jboss/4.2.2.GA/server/esb/deploy/jbossesb.sar/lib/freemarker-2.3.11.jar INFO - Beginning load: /usr/local/dst/jboss/4.2.2.GA/server/esb/deploy/jbossesb.sar/lib/mvel2-2.0.12.jar INFO - Beginning load: /usr/local/dst/jboss/4.2.2.GA/server/esb/deploy/jbossesb.sar/lib/jbossesb-config-model-1.1.0.jar INFO - Beginning load: /usr/local/dst/jboss/4.2.2.GA/lib/endorsed/xalan.jar INFO - Beginning load: /usr/local/dst/jboss/4.2.2.GA/server/lib/jboss-serialization.jar INFO - Beginning load: /usr/local/dst/jboss/4.2.2.GA/server/lib/iText-2.1.6.jar INFO - Beginning load: /usr/local/dst/jboss/4.2.2.GA/server/esb/deploy/jbrules.esb/jxl-2.4.2.jar INFO - Configuring enterprise application: classpath.ear WARN - No application-client.xml found assuming annotations present: classpath.ear, module: jboss-remoting.jar WARN - No application-client.xml found assuming annotations present: classpath.ear, module: jboss-cache-jdk50.jar WARN - No application-client.xml found assuming annotations present: classpath.ear, module: milyn-smooks-ejc-1.2.1.jar WARN - No application-client.xml found assuming annotations present: classpath.ear, module: jbossesb-rosetta.jar WARN - No application-client.xml found assuming annotations present: classpath.ear, module: javassist.jar WARN - No application-client.xml found assuming annotations present: classpath.ear, module: jbossesb-config-model-1.0.1.jar WARN - No application-client.xml found assuming annotations present: classpath.ear, module: core-3.2.3.v_686_R32x.jar WARN - No application-client.xml found assuming annotations present: classpath.ear, module: jtds-1.2.jar WARN - No application-client.xml found assuming annotations present: classpath.ear, module: bsh.jar WARN - No application-client.xml found assuming annotations present: classpath.ear, module: jaxb-xjc-2.1.4.jar WARN - No application-client.xml found assuming annotations present: classpath.ear, module: h2-1.0.68.jar WARN - No application-client.xml found assuming annotations present: classpath.ear, module: xml-resolver-1.2.jar WARN - No application-client.xml found assuming annotations present: classpath.ear, module: mvel-1.3.3-java1.5.jar WARN - No application-client.xml found assuming annotations present: classpath.ear, module: serializer.jar WARN - No application-client.xml found assuming annotations present: classpath.ear, module: jboss-microcontainer.jar WARN - No application-client.xml found assuming annotations present: classpath.ear, module: jgroups.jar WARN - No application-client.xml found assuming annotations present: classpath.ear, module: jbossesb-rosetta.jar WARN - No application-client.xml found assuming annotations present: classpath.ear, module: freemarker-2.3.11.jar WARN - No application-client.xml found assuming annotations present: classpath.ear, module: mvel2-2.0.12.jar WARN - No application-client.xml found assuming annotations present: classpath.ear, module: jbossesb-config-model-1.1.0.jar WARN - No application-client.xml found assuming annotations present: classpath.ear, module: xalan.jar WARN - No application-client.xml found assuming annotations present: classpath.ear, module: jboss-serialization.jar WARN - No application-client.xml found assuming annotations present: classpath.ear, module: iText-2.1.6.jar WARN - No application-client.xml found assuming annotations present: classpath.ear, module: jxl-2.4.2.jar INFO - Enterprise application "classpath.ear" loaded. INFO - Assembling app: classpath.ear INFO - Undeploying app: classpath.ear ERROR - Application could not be deployed: classpath.ear org.apache.openejb.OpenEJBException: Creating application failed: classpath.ear: null at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:658) at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:442) at org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:360) at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:272) at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:137) at org.apache.openejb.OpenEJB.init(OpenEJB.java:286) at org.apache.openejb.OpenEJB.init(OpenEJB.java:265) 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.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java:36) at org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:71) at org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:53) at org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:42) at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288) at javax.naming.InitialContext.init(InitialContext.java:223) at javax.naming.InitialContext.<init>(InitialContext.java:197) at com.tura.insight.adhoc.service.ColorBreakQueryExecuteTest.init(ColorBreakQueryExecuteTest.java:58) 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.internal.runners.MethodRoadie.runBefores(MethodRoadie.java:122) at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:86) at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77) at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42) at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88) at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51) at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44) at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37) at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: javax.naming.NameAlreadyBoundException at org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:96) at org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:90) at org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:90) at org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:105) at org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:111) at org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:90) at org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:105) at org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:105) at org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:90) at org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:105) at org.apache.openejb.core.ivm.naming.IvmContext.bind(IvmContext.java:300) at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:611) ... 39 more I've tried everything I can think of to get around this problem but nothing works. If anyone knows what could be causing this please let me know. -- View this message in context: http://www.nabble.com/NameAlreadyBoundException-When-Running-From-JUnit-tp24904402p24904402.html Sent from the OpenEJB User mailing list archive at Nabble.com.