tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vishwanath Krishnamurthi <tovishwan...@gmail.com>
Subject Re: How to change the id "Default MDB Container"?
Date Fri, 11 Oct 2013 19:08:18 GMT
Hi,

Usually in JUnit, you'd create the EJBContainer once, for all the test
methods. i.e in Junit4, terms, in @BeforeClass method.

Here, since you've placed the createEJBContainer() call in setUp() method,
that'd get invoked for every test method. Unless you do a
EJBContainer.close() in the tearDown(), these "NameAlreadyBoundExceptions"
would occur. (But well, creating and destroying the container for each test
is a waste of time)

So to avoid this issue, you could simply place the createEJBContainer()
call in the @BeforeClass method.

-Vishwa

On Fri, Oct 11, 2013 at 11:16 PM, bodhayanc <
Bodhayan.Chakraborty@travelport.com> wrote:

> Hi,
>
> I am new to OpenEJB. I am trying to prepare JUnit test case for a IBM JMS
> Service. My ejb-jar.xml is as below;
>
> ejb-jar.xml <http://openejb.979440.n4.nabble.com/file/n4665551/ejb-jar.xml
> >
>
> I am getting javax.naming.NameAlreadyBoundException while invoking
> EJBContainer.createEJBContainer() from the JUnit test cases setUp() method.
> I am hoping if I can override the name "Default MDB Container" for each
> MDB,
> the problem would be fixed. But, I don't know how to do that. Can anyone
> please help me?
>
> Apache OpenEJB 4.0.0-beta-2    build: 20120115-08:26
> http://openejb.apache.org/
> INFO - openejb.home =
> C:\WAS_Workspace\SOAUCWAS06JMSAsyncMsgThruSyncHttpServiceProject
> INFO - openejb.base =
> C:\WAS_Workspace\SOAUCWAS06JMSAsyncMsgThruSyncHttpServiceProject
> INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
> 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 EjbModule in classpath:
>
> C:\WAS_Workspace\SOAUCWAS06JMSAsyncMsgThruSyncHttpServiceProject\target\classes
> INFO - Searched 13 classpath urls in 1085 milliseconds.  Average 83
> milliseconds per url.
> INFO - Beginning load:
>
> C:\WAS_Workspace\SOAUCWAS06JMSAsyncMsgThruSyncHttpServiceProject\target\classes
> INFO - Configuring enterprise application:
> C:\WAS_Workspace\SOAUCWAS06JMSAsyncMsgThruSyncHttpServiceProject
> java.lang.RuntimeException: WebServicesJMSRouter1
>         at
>
> org.apache.openejb.config.rules.CheckClasses.validate(CheckClasses.java:118)
>         at
>
> org.apache.openejb.config.rules.ValidationBase.validate(ValidationBase.java:45)
>         at
> org.apache.openejb.config.AppValidator.validate(AppValidator.java:88)
>         at
> org.apache.openejb.config.ValidateModules.deploy(ValidateModules.java:29)
>         at
>
> org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:263)
>         at
>
> org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:693)
>         at
>
> org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:267)
>         at
> javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:56)
>         at
> javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:43)
>         at
>
> com.travelport.soa.svcs.poc.LocationJmsServiceBindingImplTest.setUp(LocationJmsServiceBindingImplTest.java:30)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
>         at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
>         at java.lang.reflect.Method.invoke(Method.java:613)
>         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.runners.ParentRunner.run(ParentRunner.java:300)
>         at
>
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
>         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: java.lang.NullPointerException
>         at
>
> org.apache.openejb.config.rules.CheckClasses.check_hasEjbClass(CheckClasses.java:218)
>         at
> org.apache.openejb.config.rules.CheckClasses.validate(CheckClasses.java:78)
>         ... 24 more
> Retrieving document at
>
> 'file:/C:/WAS_Workspace/SOAUCWAS06JMSAsyncMsgThruSyncHttpServiceProject/target/classes/META-INF/wsdl/'.
> Retrieving schema at 'LocationService.xsd', relative to
>
> 'file:/C:/WAS_Workspace/SOAUCWAS06JMSAsyncMsgThruSyncHttpServiceProject/target/classes/META-INF/wsdl/'.
> INFO - Configuring Service(id=Default MDB Container, type=Container,
> provider-id=Default MDB Container)
> INFO - Auto-creating a container for bean WebServicesJMSRouter1:
> Container(type=MESSAGE, id=Default MDB Container)
> INFO - Configuring Service(id=Default JMS Resource Adapter, type=Resource,
> provider-id=Default JMS Resource Adapter)
> INFO - Configuring Service(id=jms/WebServicesReplyQCF, type=Resource,
> provider-id=Default JMS Connection Factory)
> INFO - Auto-creating a Resource with id 'jms/WebServicesReplyQCF' of type
> 'javax.jms.QueueConnectionFactory for 'WebServicesJMSRouter1'.
> WARN - Property "destination" not supported by "jms/WebServicesReplyQCF"
> INFO - Auto-linking resource-env-ref 'jms/WebServicesReplyQCF' in bean
> WebServicesJMSRouter1 to Resource(id=jms/WebServicesReplyQCF)
> INFO - Configuring Service(id=Default MDB Container, type=Container,
> provider-id=Default MDB Container)
> INFO - Auto-creating a container for bean WebServicesJMSRouter2:
> Container(type=MESSAGE, id=Default MDB Container)
> WARN - configureApplication.loadFailed
> org.apache.openejb.OpenEJBException: Cannot bind Container with id Default
> MDB Container : ParsedName{path=openejb/Container/Default MDB Container,
> component=Default MDB Container}
>         at
>
> org.apache.openejb.assembler.classic.Assembler.bindService(Assembler.java:1357)
>         at
>
> org.apache.openejb.assembler.classic.Assembler.createContainer(Assembler.java:1337)
>         at
>
> org.apache.openejb.config.ConfigurationFactory.install(ConfigurationFactory.java:288)
>         at
> org.apache.openejb.config.AutoConfig.createContainer(AutoConfig.java:1002)
>         at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:798)
>         at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:174)
>         at
>
> org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:263)
>         at
>
> org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:693)
>         at
>
> org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:267)
>         at
> javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:56)
>         at
> javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:43)
>         at
>
> com.travelport.soa.svcs.poc.LocationJmsServiceBindingImplTest.setUp(LocationJmsServiceBindingImplTest.java:30)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
>         at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
>         at java.lang.reflect.Method.invoke(Method.java:613)
>         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.runners.ParentRunner.run(ParentRunner.java:300)
>         at
>
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
>         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:
> ParsedName{path=openejb/Container/Default MDB Container, component=Default
> MDB Container}*
>         at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:146)
>         at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:130)
>         at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:156)
>         at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:162)
>         at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:130)
>         at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:156)
>         at
> org.apache.openejb.core.ivm.naming.IvmContext.bind(IvmContext.java:300)
>         at
>
> org.apache.openejb.assembler.classic.Assembler.bindService(Assembler.java:1355)
>         ... 26 more
> INFO - Stopping ResourceAdapter: Default JMS Resource Adapter
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/How-to-change-the-id-Default-MDB-Container-tp4665551.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message