You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Stephan Bauer <st...@gmx.com> on 2009/12/15 17:28:41 UTC

javax.naming.NameAlreadyBoundException: ParsedName{path=openejb/client/foundation/comp/env, component=env}

Hi,

I am trying to add OpenEJB based unittests to my JEE5 project with 
Stateless EJBs and also an MDB.
After having resolved some classpath issues on my own, I still cannot 
make my testcase work because of the following error during openejb startup:

INFO - Configuring enterprise application: classpath.ear
INFO - Configuring Service(id=Default Stateless Container, 
type=Container, provider-id=Default Stateless Container)
INFO - Auto-creating a container for bean MyDaoBean: 
Container(type=STATELESS, id=Default Stateless Container)
INFO - Configuring Service(id=Default JMS Connection Factory, 
type=Resource, provider-id=Default JMS Connection Factory)
INFO - Auto-creating a Resource with id 'Default JMS Connection Factory' 
of type 'javax.jms.QueueConnectionFactory for 'MessageProducerServiceBean'.
INFO - Configuring Service(id=Default JMS Resource Adapter, 
type=Resource, provider-id=Default JMS Resource Adapter)
INFO - Auto-linking resource-ref 
'com.xxx.service.ejb.impl.MessageProducerServiceBean/cubeCalcQueueConnectionFactory' 
in bean MessageProducerServiceBean to Resource(id=Default JMS Connection 
Factory)
INFO - Configuring Service(id=jms/XXXQueueDestination, type=Resource, 
provider-id=Default Queue)
INFO - Auto-creating a Resource with id 'jms/XXXQueueDestination' of 
type 'javax.jms.Queue for 'MessageProducerServiceBean'.
INFO - Auto-linking resource-env-ref 
'com.xxx.service.ejb.impl.MessageProducerServiceBean/cubeCalcQueueDestination' 
in bean MessageProducerServiceBean to Resource(id=jms/XXXQueueDestination)
INFO - Configuring Service(id=Default MDB Container, type=Container, 
provider-id=Default MDB Container)
INFO - Auto-creating a container for bean MessageConsumerBean: 
Container(type=MESSAGE, id=Default MDB Container)
INFO - Configuring Service(id=MessageConsumerBean, type=Resource, 
provider-id=Default Queue)
INFO - Auto-creating a Resource with id 'MessageConsumerBean' of type 
'javax.jms.Queue for 'MessageConsumerBean'.
INFO - Configuring PersistenceUnit(name=xxx-pu, 
provider=org.hibernate.ejb.HibernatePersistence)
INFO - Auto-creating a Resource with id 'jdbc/xxxDSNonJta' of type 
'DataSource for 'xxx-pu'.
INFO - Configuring Service(id=jdbc/xxxDSNonJta, type=Resource, 
provider-id=jdbc/xxxDS)
INFO - Adjusting PersistenceUnit xxx-pu <non-jta-data-source> to 
Resource ID 'jdbc/xxxDSNonJta' from 'null'
INFO - Enterprise application "classpath.ear" loaded.INFO - Assembling 
app: classpath.ear
INFO - PersistenceUnit(name=xxx-pu, 
provider=org.hibernate.ejb.HibernatePersistence)
....
....
[deploying EJBs successfully]
....
....
INFO - Created Ejb(deployment-id=MessageConsumerBean, 
ejb-name=MessageConsumerBean, container=Default MDB Container)
INFO - Undeploying app: classpath.ear
ERROR - Application could not be deployed:  classpath.ear
org.apache.openejb.OpenEJBException: Creating application failed: 
classpath.ear: ParsedName{path=openejb/client/foundation/comp/env, 
component=env}
    at 
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:666)
    at 
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:449)
    at 
org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:367)
    at 
org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:279)
    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(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    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(Unknown Source)
    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.init(Unknown Source)
    at javax.naming.InitialContext.<init>(Unknown Source)
    at 
com.bmw.sf.cubecalc.facade.AbstractOpenEJBLocalFacadeTestCase.setupInitialContext(AbstractOpenEJBLocalFacadeTestCase.java:59)
    at 
com.bmw.sf.cubecalc.facade.AbstractOpenEJBLocalFacadeTestCase.setUp(AbstractOpenEJBLocalFacadeTestCase.java:23)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at 
org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74)
    at 
org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50)
    at 
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:33)
    at 
org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
    at 
org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
    at 
org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
    at 
org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
    at 
org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
    at 
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
    at 
org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
    at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
    at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: javax.naming.NameAlreadyBoundException: 
ParsedName{path=openejb/client/foundation/comp/env, component=env}
    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: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.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:295)
    at 
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:618)
    ... 40 more

Can anybody help me interpreting this error?

Many thanks in advance,
Stephan Bauer


Re: javax.naming.NameAlreadyBoundException: ParsedName{path=openejb/client/foundation/comp/env, component=env}

Posted by David Blevins <da...@visi.com>.
On Jan 4, 2010, at 10:32 PM, David Blevins wrote:

>
> On Dec 15, 2009, at 10:25 PM, Stephan Bauer wrote:
>
>> Nevertheless I would be interested in knowing why these jar files  
>> get reflected in the JNDI in that "client" namespace...
>
> Just an FYI, this is high on my list of issues to look into.   
> Basically it's due to jar files being added as Application Clients  
> because they fit that definition per the Java EE spec (i.e. they  
> have a Main-Class entry in the MANIFEST.MF).  I had thought that we  
> tightened this up while in an embedded mode so that you had to also  
> have a META-INF/application-client.xml file to qualify, but it seems  
> that needs to be revisited.

An FYI that this issue was fixed:

   OPENEJB-1130: Stricter ClientModule classpath discovery prevents  
possible NameAlreadyBoundException
   [ https://issues.apache.org/jira/browse/OPENEJB-1130 ]

New 3.1.3-SNAPSHOT builds available here:

  http://repository.apache.org/snapshots/org/apache/openejb/openejb-standalone/3.1.3-SNAPSHOT

-David


Re: javax.naming.NameAlreadyBoundException: ParsedName{path=openejb/client/foundation/comp/env, component=env}

Posted by David Blevins <da...@visi.com>.
On Dec 15, 2009, at 10:25 PM, Stephan Bauer wrote:

> Nevertheless I would be interested in knowing why these jar files  
> get reflected in the JNDI in that "client" namespace...

Just an FYI, this is high on my list of issues to look into.   
Basically it's due to jar files being added as Application Clients  
because they fit that definition per the Java EE spec (i.e. they have  
a Main-Class entry in the MANIFEST.MF).  I had thought that we  
tightened this up while in an embedded mode so that you had to also  
have a META-INF/application-client.xml file to qualify, but it seems  
that needs to be revisited.


-David


Re: javax.naming.NameAlreadyBoundException: ParsedName{path=openejb/client/foundation/comp/env, component=env}

Posted by Stephan Bauer <st...@gmx.com>.
Hi,

sorry for disturbing. I solved the problem myself. The key issue was, 
that I had some utility jar files more than once physically in my 
different jee5 projects (modules).
I have fixed that so that every jar is only in one central location from 
which all projects refer to them.

Nevertheless I would be interested in knowing why these jar files get 
reflected in the JNDI in that "client" namespace...

Stephan

Stephan Bauer schrieb:
> Hi,
>
> I am trying to add OpenEJB based unittests to my JEE5 project with 
> Stateless EJBs and also an MDB.
> After having resolved some classpath issues on my own, I still cannot 
> make my testcase work because of the following error during openejb 
> startup:
>
> INFO - Configuring enterprise application: classpath.ear
> INFO - Configuring Service(id=Default Stateless Container, 
> type=Container, provider-id=Default Stateless Container)
> INFO - Auto-creating a container for bean MyDaoBean: 
> Container(type=STATELESS, id=Default Stateless Container)
> INFO - Configuring Service(id=Default JMS Connection Factory, 
> type=Resource, provider-id=Default JMS Connection Factory)
> INFO - Auto-creating a Resource with id 'Default JMS Connection 
> Factory' of type 'javax.jms.QueueConnectionFactory for 
> 'MessageProducerServiceBean'.
> INFO - Configuring Service(id=Default JMS Resource Adapter, 
> type=Resource, provider-id=Default JMS Resource Adapter)
> INFO - Auto-linking resource-ref 
> 'com.xxx.service.ejb.impl.MessageProducerServiceBean/cubeCalcQueueConnectionFactory' 
> in bean MessageProducerServiceBean to Resource(id=Default JMS 
> Connection Factory)
> INFO - Configuring Service(id=jms/XXXQueueDestination, type=Resource, 
> provider-id=Default Queue)
> INFO - Auto-creating a Resource with id 'jms/XXXQueueDestination' of 
> type 'javax.jms.Queue for 'MessageProducerServiceBean'.
> INFO - Auto-linking resource-env-ref 
> 'com.xxx.service.ejb.impl.MessageProducerServiceBean/cubeCalcQueueDestination' 
> in bean MessageProducerServiceBean to 
> Resource(id=jms/XXXQueueDestination)
> INFO - Configuring Service(id=Default MDB Container, type=Container, 
> provider-id=Default MDB Container)
> INFO - Auto-creating a container for bean MessageConsumerBean: 
> Container(type=MESSAGE, id=Default MDB Container)
> INFO - Configuring Service(id=MessageConsumerBean, type=Resource, 
> provider-id=Default Queue)
> INFO - Auto-creating a Resource with id 'MessageConsumerBean' of type 
> 'javax.jms.Queue for 'MessageConsumerBean'.
> INFO - Configuring PersistenceUnit(name=xxx-pu, 
> provider=org.hibernate.ejb.HibernatePersistence)
> INFO - Auto-creating a Resource with id 'jdbc/xxxDSNonJta' of type 
> 'DataSource for 'xxx-pu'.
> INFO - Configuring Service(id=jdbc/xxxDSNonJta, type=Resource, 
> provider-id=jdbc/xxxDS)
> INFO - Adjusting PersistenceUnit xxx-pu <non-jta-data-source> to 
> Resource ID 'jdbc/xxxDSNonJta' from 'null'
> INFO - Enterprise application "classpath.ear" loaded.INFO - Assembling 
> app: classpath.ear
> INFO - PersistenceUnit(name=xxx-pu, 
> provider=org.hibernate.ejb.HibernatePersistence)
> ....
> ....
> [deploying EJBs successfully]
> ....
> ....
> INFO - Created Ejb(deployment-id=MessageConsumerBean, 
> ejb-name=MessageConsumerBean, container=Default MDB Container)
> INFO - Undeploying app: classpath.ear
> ERROR - Application could not be deployed:  classpath.ear
> org.apache.openejb.OpenEJBException: Creating application failed: 
> classpath.ear: ParsedName{path=openejb/client/foundation/comp/env, 
> component=env}
>    at 
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:666) 
>
>    at 
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:449) 
>
>    at 
> org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:367) 
>
>    at 
> org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:279)
>    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(Unknown Source)
>    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>    at java.lang.reflect.Method.invoke(Unknown Source)
>    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(Unknown Source)
>    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
>    at javax.naming.InitialContext.init(Unknown Source)
>    at javax.naming.InitialContext.<init>(Unknown Source)
>    at 
> com.bmw.sf.cubecalc.facade.AbstractOpenEJBLocalFacadeTestCase.setupInitialContext(AbstractOpenEJBLocalFacadeTestCase.java:59) 
>
>    at 
> com.bmw.sf.cubecalc.facade.AbstractOpenEJBLocalFacadeTestCase.setUp(AbstractOpenEJBLocalFacadeTestCase.java:23) 
>
>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>    at java.lang.reflect.Method.invoke(Unknown Source)
>    at 
> org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74) 
>
>    at 
> org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50) 
>
>    at 
> org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:33) 
>
>    at 
> org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75) 
>
>    at 
> org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
>    at 
> org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66) 
>
>    at 
> org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35) 
>
>    at 
> org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42) 
>
>    at 
> org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34) 
>
>    at 
> org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
>    at 
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45) 
>
>    at 
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) 
>
>    at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) 
>
>    at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) 
>
>    at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) 
>
>    at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) 
>
> Caused by: javax.naming.NameAlreadyBoundException: 
> ParsedName{path=openejb/client/foundation/comp/env, component=env}
>    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: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.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:295)
>    at 
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:618) 
>
>    ... 40 more
>
> Can anybody help me interpreting this error?
>
> Many thanks in advance,
> Stephan Bauer


-- 
Stephan Bauer
Dipl. Inform. (FH) / Freiberuflicher System Architekt
Lessingstr. 5
94315 Straubing
Deutschland
eMail 1: sb@softwarebuero-straubing.de
eMail 2: stephan.bauer@gmx.com
Tel.: +49 9421 9299386
Mobil: +49 171 7878621 
http://www.softwarebuero-straubing.de