-
1. Re: Cyclic dependency in EJB3 not resolved by JIRA EJBTHREE-
jaikiran Jun 7, 2008 4:26 AM (in response to omerlin)"omerlin" wrote:
We have the problem in both 4.2.2 & 5.0Beta3 versions.
We have currently no solution,no working workaround.
Remove the class level @EJBs declaration. And let your beans look like this:Hello1Bean class: @Stateless public class Hello1Bean implements Hello1 { @IgnoreDependency @EJB(name="ejb/Hello2") private Hello2 hello; } Hello2Bean Class : @Stateless public class Hello2LocalBean implements Hello2Local { @IgnoreDependency @EJB(name="ejb/Hello1") private Hello1 hello; }
Whatever, you are trying to do with the @EJBs at the class level can be achieved by this change. -
2. Re: Cyclic dependency in EJB3 not resolved by JIRA EJBTHREE-
nouredine13 Jun 8, 2008 2:58 PM (in response to omerlin)hi Olivier, i have posted the same problem here: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=136978
I will try this proposal, i hope that it will work ! -
3. Re: Cyclic dependency in EJB3 not resolved by JIRA EJBTHREE-
nouredine13 Jun 9, 2008 4:08 AM (in response to omerlin)
this does not work when the interface has several implementations, in this case the following error is generated:
could not resolve global JNDI name for @EJB for container Hello1Bean : reference class: com.gemalto.session.Hello2Local ejbLink: duplicated in cyclic.jar
the question is: how to not use the declaration of reference with EJBs when the interface has several implementations?
Thank's -
4. Re: Cyclic dependency in EJB3 not resolved by JIRA EJBTHREE-
jaikiran Jun 9, 2008 4:20 AM (in response to omerlin)Please post the entire exception stacktrace. Also post the bean definitions(with annotations) that you are using (the interface and the multiple implementations).
-
5. Re: Cyclic dependency in EJB3 not resolved by JIRA EJBTHREE-
jaikiran Jun 9, 2008 4:44 AM (in response to omerlin)"Nouredine13" wrote:
this does not work when the interface has several implementations, in this case the following error is generated:
could not resolve global JNDI name for @EJB for container Hello1Bean : reference class: com.gemalto.session.Hello2Local ejbLink: duplicated in cyclic.jar
the question is: how to not use the declaration of reference with EJBs when the interface has several implementations?
Thank's
I think i understand what you are saying. If you have multiple (bean) implementations for the same interface, you can inject the beans as follows:Hello1Bean class: @Stateless public class Hello1Bean implements Hello1 { @IgnoreDependency @EJB(name="ejb/Hello2",beanName="Hello2Bean") private Hello2 hello; } Hello2Bean Class : @Stateless public class Hello2LocalBean implements Hello2Local { @IgnoreDependency @EJB(name="ejb/Hello1",beanName="Hello1Bean") private Hello1 hello; }
Note, the use of beanName in the @EJB annotation at field level. If this still does not solve your problem, then post back with the details. -
6. Re: Cyclic dependency in EJB3 not resolved by JIRA EJBTHREE-
nouredine13 Jun 9, 2008 4:45 AM (in response to omerlin)the bean definition that i'm using :
Hello1Bean class:
@Stateless
public class Hello1Bean implements Hello1 {
@IgnoreDependency
@EJB(name="ejb/Hello2Local")
private Hello2Local hello;
}
Hello2LocalBean Class :
@Stateless
public class Hello2LocalBean implements Hello2Local {
@IgnoreDependency
@EJB(name="ejb/Hello1")
private Hello1 hello;
}
Hello2Bean Class :
@Stateless
public class Hello2Bean implements Hello2Local {
@IgnoreDependency
@EJB(name="ejb/Hello1")
private Hello1 hello;
}
we say that the interface Hello2Local has two implementations : Hello2LocalBean and Hello2Bean, and in this case, the entire exception stackrace is :
10:43:24,090 WARN [ServiceController] Problem starting service jboss.j2ee:jar=cyclic.jar,name=Hello1Bean,service=EJB3
java.lang.RuntimeException: could not resolve global JNDI name for @EJB for container Hello1Bean: reference class: Hello2Local ejbLink: duplicated in cyclic.jar
at org.jboss.injection.EjbEncInjector.inject(EjbEncInjector.java:88)
at org.jboss.ejb3.EJBContainer.start(EJBContainer.java:566)
at org.jboss.ejb3.SessionContainer.start(SessionContainer.java:154)
at org.jboss.ejb3.stateless.StatelessContainer.start(StatelessContainer.java:102)
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.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:103)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
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.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy101.start(Unknown Source)
at org.jboss.ejb3.JmxKernelAbstraction.install(JmxKernelAbstraction.java:120)
at org.jboss.ejb3.Ejb3Deployment.registerEJBContainer(Ejb3Deployment.java:301)
at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:362)
at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:91)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
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.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy33.start(Unknown Source)
at org.jboss.ejb3.EJB3Deployer.start(EJB3Deployer.java:512)
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.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:87)
at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy34.start(Unknown Source)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy9.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
10:43:24,090 INFO [EJB3Deployer] Deployed: file:/C:/Program Files/jboss-4.2.2.GA/jboss-4.2.2.GA/server/default/deploy/cyclic.jar
10:43:24,090 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
--- MBeans waiting for other MBeans ---
ObjectName: jboss.j2ee:jar=cyclic.jar,name=Hello1Bean,service=EJB3
State: FAILED
Reason: java.lang.RuntimeException: could not resolve global JNDI name for @EJB for container Hello1Bean: reference class: com.gemalto.api.session.Hello2Local ejbLink: duplicated in cyclic.jar
--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboss.j2ee:jar=cyclic.jar,name=Hello1Bean,service=EJB3
State: FAILED
Reason: java.lang.RuntimeException: could not resolve global JNDI name for @EJB for container Hello1Bean: reference class: com.gemalto.api.session.Hello2Local ejbLink: duplicated in cyclic.jar
Thank's -
7. Re: Cyclic dependency in EJB3 not resolved by JIRA EJBTHREE-
nouredine13 Jun 9, 2008 4:50 AM (in response to omerlin)
I tried your suggestion, and I think it works quite well.
Thank you.