aspose file tools*
The moose likes JBoss/WildFly and the fly likes problem: Deployment of same EJB components with different JNDI name. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "problem: Deployment of same EJB components with different JNDI name. " Watch "problem: Deployment of same EJB components with different JNDI name. " New topic
Author

problem: Deployment of same EJB components with different JNDI name.

Shayan Shah
Greenhorn

Joined: Aug 28, 2009
Posts: 25

Hi.

I an writing an ejb module for two different clients. This ejb module will be replicated for each client running on same application server instance. Only configurations will be changed for each client, rest will be same. Now I have made two copies of the module. I have given all the ejb's name against the specific client like
in copy for client1, I have named it like



and for client2, i have named it like



I am deploying it on JBoss AS 5.1.0. Now I am facing problems in this strategy. Its makes problems in JNDI naming. Is this the right strategy for this kind of situation and I am doing something wrong?? or I will have to follow some other strategy??

Thanks
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10048
    
163

Shayan Shah wrote:


I am deploying it on JBoss AS 5.1.0. Now I am facing problems in this strategy. Its makes problems in JNDI naming.


What problems are you running into? Please post the details, including any exception stacktrace.

[My Blog] [JavaRanch Journal]
Shayan Shah
Greenhorn

Joined: Aug 28, 2009
Posts: 25
I have created a test project by name of "TestProject". It has a package "com" that contsains the ejb "MyBean" with statelessa annotaion as "@Stateless(name="C1MyBean")".
now I copied the project with name as "TestProject2" and annotated the ejb "MyBean" as "@Stateless(name="C2MyBean")".
When i deploy it, the jboss log shows

16:06:30,887 INFO [JBossASKernel] Created KernelDeployment for: TestProject.jar
16:06:30,888 INFO [JBossASKernel] installing bean: jboss.j2ee:jar=TestProject.jar,name=C1MyBean,service=EJB3
16:06:30,888 INFO [JBossASKernel] with dependencies:
16:06:30,888 INFO [JBossASKernel] and demands:
16:06:30,888 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService
16:06:30,888 INFO [JBossASKernel] and supplies:
16:06:30,888 INFO [JBossASKernel] jndi:C1MyBean/local
16:06:30,888 INFO [JBossASKernel] Class:com.MyBeanLocal
16:06:30,888 INFO [JBossASKernel] jndi:C1MyBean/remote
16:06:30,888 INFO [JBossASKernel] jndi:C1MyBean/local-com.MyBeanLocal
16:06:30,888 INFO [JBossASKernel] Added bean(jboss.j2ee:jar=TestProject.jar,name=C1MyBean,service=EJB3) to KernelDeployment of: TestProject.jar
16:06:30,889 INFO [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@184b82e{name=jboss.j2ee:jar=TestProject.jar,name=C1MyBean,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
16:06:30,936 INFO [SessionSpecContainer] Starting jboss.j2ee:jar=TestProject.jar,name=C1MyBean,service=EJB3
16:06:30,936 INFO [EJBContainer] STARTED EJB: com.MyBean ejbName: C1MyBean
16:06:30,943 INFO [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:

C1MyBean/local - EJB3.x Default Local Business Interface
C1MyBean/local-com.MyBeanLocal - EJB3.x Local Business Interface

16:06:41,163 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@3051863{vfszip:/home/shayan/applications/jboss-5.1.0.GA/server/default/deploy/TestProject2.jar/}
16:06:41,163 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@3051863{vfszip:/home/shayan/applications/jboss-5.1.0.GA/server/default/deploy/TestProject2.jar/}
16:06:41,164 WARN [Ejb3AnnotationHandler] JBMETA-4: did not find any bean meta data for annotation bean C2MyBean, will create some
16:06:41,172 INFO [JBossASKernel] Created KernelDeployment for: TestProject2.jar
16:06:41,172 INFO [JBossASKernel] installing bean: jboss.j2ee:jar=TestProject2.jar,name=C2MyBean,service=EJB3
16:06:41,172 INFO [JBossASKernel] with dependencies:
16:06:41,172 INFO [JBossASKernel] and demands:
16:06:41,172 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService
16:06:41,172 INFO [JBossASKernel] and supplies:
16:06:41,172 INFO [JBossASKernel] Class:com.MyBeanLocal
16:06:41,172 INFO [JBossASKernel] Added bean(jboss.j2ee:jar=TestProject2.jar,name=C2MyBean,service=EJB3) to KernelDeployment of: TestProject2.jar
16:06:41,173 INFO [JBossASKernel] installing bean: jboss.j2ee:jar=TestProject2.jar,name=C1MyBean,service=EJB3
16:06:41,173 INFO [JBossASKernel] with dependencies:
16:06:41,173 INFO [JBossASKernel] and demands:
16:06:41,173 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService
16:06:41,173 INFO [JBossASKernel] and supplies:
16:06:41,173 INFO [JBossASKernel] jndi:C1MyBean/local
16:06:41,173 INFO [JBossASKernel] Class:com.MyBeanLocal
16:06:41,173 INFO [JBossASKernel] jndi:C1MyBean/remote
16:06:41,173 INFO [JBossASKernel] jndi:C1MyBean/local-com.MyBeanLocal
16:06:41,173 INFO [JBossASKernel] Added bean(jboss.j2ee:jar=TestProject2.jar,name=C1MyBean,service=EJB3) to KernelDeployment of: TestProject2.jar
16:06:41,174 INFO [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@a8fc2d{name=jboss.j2ee:jar=TestProject2.jar,name=C2MyBean,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
16:06:41,174 INFO [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@1b576f8{name=jboss.j2ee:jar=TestProject2.jar,name=C1MyBean,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
16:06:41,200 INFO [SessionSpecContainer] Starting jboss.j2ee:jar=TestProject2.jar,name=C2MyBean,service=EJB3
16:06:41,200 INFO [EJBContainer] STARTED EJB: com.MyBean ejbName: C2MyBean
16:06:41,200 INFO [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:


16:06:41,226 INFO [SessionSpecContainer] Starting jboss.j2ee:jar=TestProject2.jar,name=C1MyBean,service=EJB3
16:06:41,226 INFO [EJBContainer] STARTED EJB: com.MyBean ejbName: C1MyBean
16:06:41,232 INFO [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:

C1MyBean/local - EJB3.x Default Local Business Interface
C1MyBean/local-com.MyBeanLocal - EJB3.x Local Business Interface

16:06:41,244 INFO [SessionSpecContainer] Stopping jboss.j2ee:jar=TestProject2.jar,name=C1MyBean,service=EJB3
16:06:41,273 INFO [EJBContainer] STOPPED EJB: com.MyBean ejbName: C1MyBean
16:06:41,273 ERROR [AbstractKernelController] Error installing to Start: name=jboss.j2ee:jar=TestProject2.jar,name=C1MyBean,service=EJB3 state=Create
java.lang.RuntimeException: Could not bind Reference Class Name: Proxy for: com.MyBeanLocal
Type: ProxyFactoryKey
Content: ProxyFactory/TestProject2/C1MyBean/C1MyBean/local
Type: EJB Container Name
Content: jboss.j2ee:jar=TestProject2.jar,name=C1MyBean,service=EJB3
Type: Proxy Factory is Local
Content: true
Type: Local Business Interface
Content: com.MyBeanLocal
into JNDI at "C1MyBean/local"
at org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase.bind(JndiSessionRegistrarBase.java:915)
at org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase.bind(JndiSessionRegistrarBase.java:895)
at org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase.bind(JndiSessionRegistrarBase.java:884)
at org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase.bindEjb(JndiSessionRegistrarBase.java:151)
at org.jboss.ejb3.session.SessionContainer.lockedStart(SessionContainer.java:210)
at org.jboss.ejb3.session.SessionSpecContainer.lockedStart(SessionSpecContainer.java:577)
at org.jboss.ejb3.stateless.StatelessContainer.lockedStart(StatelessContainer.java:192)
at org.jboss.ejb3.EJBContainer.start(EJBContainer.java:884)
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.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)
at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:241)
at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:109)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:70)
at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221)
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:774)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:121)
at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:51)
at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:362)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:255)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: javax.naming.NameAlreadyBoundException: local
at org.jnp.server.NamingServer.bind(NamingServer.java:209)
at org.jnp.server.NamingServer.bind(NamingServer.java:167)
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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
at org.jnp.server.NamingServer_Stub.bind(Unknown Source)
at org.jnp.interfaces.NamingContext.bind(NamingContext.java:650)
at org.jnp.interfaces.NamingContext.bind(NamingContext.java:611)
at org.jboss.util.naming.Util.bind(Util.java:105)
at org.jboss.util.naming.Util.bind(Util.java:91)
at org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase.bind(JndiSessionRegistrarBase.java:910)
... 61 more
16:06:41,304 WARN [WebServiceDeployerEJB] Ingore ejb deployment with null classname: org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData@f141cab{C2MyBean}
16:06:41,308 WARN [HDScanner] Failed to process changes
org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

DEPLOYMENTS MISSING DEPENDENCIES:
Deployment "jboss.j2ee:jar=TestProject2.jar,name=C1MyBean,service=EJB3_endpoint" is missing the following dependencies:
Dependency "jboss.j2ee:jar=TestProject2.jar,name=C1MyBean,service=EJB3" (should be in state "Configured", but is actually in state "**ERROR**")

DEPLOYMENTS IN ERROR:
Deployment "jboss.j2ee:jar=TestProject2.jar,name=C1MyBean,service=EJB3" is in error due to the following reason(s): **ERROR**, javax.naming.NameAlreadyBoundException: local

at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:993)
at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:939)
at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:873)
at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.checkComplete(MainDeployerAdapter.java:128)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:369)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:255)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10048
    
163

Are you packaging any ejb-jar.xml or jboss.xml files in the deployments? If yes, what are their contents?

Also, while posting xml, logs or code, remember to wrap it in code block and use the Preview button to ensure that it's properly formatted.
Shayan Shah
Greenhorn

Joined: Aug 28, 2009
Posts: 25
oh, sorry, fogot to format the log...
and No. I am not packaging any ejb-jar.xml or jboss.xml file.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10048
    
163

installing bean: jboss.j2ee:jar=TestProject2.jar,name=C1MyBean,service=EJB3


For some reason a bean named C1MyBean is being found in TestProject2.jar. You'll have to check whether there are any classes marking some bean as C1MyBean in TestProject2.jar.
Shayan Shah
Greenhorn

Joined: Aug 28, 2009
Posts: 25
This is the problem I am totally unable to understand. Their is only and only one bean in each module. both with different name. How "C1MyBean" is found in the second module. Is there any chance that same package name of two seperate ejb's causes such problems?? as here both the ejb's are in package in "com", though they are in two seperate modules.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10048
    
163

This is the problem I am totally unable to understand. Their is only and only one bean in each module. both with different name. How "C1MyBean" is found in the second module. Is there any chance that same package name of two seperate ejb's causes such problems?? as here both the ejb's are in package in "com", though they are in two seperate modules.


Looks like a classloading issue. Have you added a jboss.xml to isolate the two deployments? See these wiki articles for details:

http://community.jboss.org/wiki/JbossClassLoadingUseCases
http://community.jboss.org/wiki/ClassLoadingConfiguration
Shayan Shah
Greenhorn

Joined: Aug 28, 2009
Posts: 25
problem solved by isolating both the deployments by jboss.xml. but now another problem has arisen. These two separate deployments will also communication with each other. that is C1MyBean will lookup C2MyBean and send some request to it. but the lookup fails. so then what is the possible solution for this problem?? I was of the guess that their would be no problem as I am accessing by JNDI name. I also tested it by using remote interface but no use. the exception that is thrown is

Shayan Shah
Greenhorn

Joined: Aug 28, 2009
Posts: 25
This exception means that isolation of deployments also effects jndi lookups/naming or the way components are accessed. I have googled this problem but so far, could not get any solution.
Abhishekh Padmanabhan
Greenhorn

Joined: Sep 26, 2006
Posts: 5
Did you ever find a solution to this problem. We are running into the same issue with JBoss 5.1 and I am sure this was not an issue with JBoss 4.2.3.

The ejb appears to be installed but its just the jndi name that appears to be a problem as there is namespace collision in the jndi global namespace.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem: Deployment of same EJB components with different JNDI name.