-
1. Re: Map the remote EJB to the global JNDI name in JBoss 7
wdfink Apr 27, 2012 1:58 AM (in response to hipa)What version (AS7.x) of JBoss do you use? And how do you deploy?
With EJB3.1 the JNDI names are standardized.
If you try to access a remote EJB you have to use this, maybe you configure the first part via resource or system property.
In case of local EJB it should work if you use @EJB without or with attributes name/mappedName/lookup.
There is an open issue with mappedName so I'm not 100% sure what to set, I'll check it if I find a timeslot
-
2. Re: Map the remote EJB to the global JNDI name in JBoss 7
hipa Apr 27, 2012 3:32 AM (in response to wdfink)What version (AS7.x) of JBoss do you use?
7.1.1.Final
And how do you deploy?
What do you mean? Just an archived EAR or an exploded EAR.
With EJB3.1 the JNDI names are standardized.
If you try to access a remote EJB you have to use this, maybe you configure the first part via resource or system property.
All I need is just to configure remote EJB JNDI names (ejb: scheme URIs) outside of the application. So the best approach may be to map remote EJBs to java:comp/env. Is it possible?
-
3. Re: Map the remote EJB to the global JNDI name in JBoss 7
wdfink Apr 27, 2012 3:58 AM (in response to hipa)I meant whether you have different servers or deploy at the same.
On the same server I would prefer Local calls and this should work with the @EJB annotation.
-
4. Re: Map the remote EJB to the global JNDI name in JBoss 7
hipa Apr 27, 2012 4:04 AM (in response to wdfink)Wolf-Dieter Fink wrote:
I meant whether you have different servers or deploy at the same.
It's not known to the application. The JNDI name of this EJB may be java:global... in case when it's deployed on the same server or ejb:... if it's deployed on the another server.
-
5. Re: Map the remote EJB to the global JNDI name in JBoss 7
hipa Apr 28, 2012 6:07 AM (in response to hipa)I've found the solution here https://docs.jboss.org/author/display/AS71/JNDI+Reference
You can bind a remote EJB to local JNDI name in server configuration xml
<subsystem xmlns="urn:jboss:domain:naming:1.1" > <bindings> <lookup name="java:global/test" lookup="ejb:app/module/distinct/name!View" /> </bindings> </subsystem>
-
6. Re: Map the remote EJB to the global JNDI name in JBoss 7
wdfink Apr 28, 2012 8:53 AM (in response to hipa)Hey that's a cool solution
-
7. Re: Map the remote EJB to the global JNDI name in JBoss 7
jamesviet Jul 19, 2013 5:44 AM (in response to wdfink)Hi va,
When I applied your proposal, I met some error.
My bean is: LoginService, i have LoginServiceImpl implement LoginService
@Stateless()
@Remote(LoginService.class)
@Interceptors({InterceptorTest.class})
@EJB (name ="java:global/LoginService", beanInterface = LoginService.class)
public class LoginServiceImpl implements LoginService{
In stanalone.xml
<subsystem xmlns="urn:jboss:domain:naming:1.1">
<bindings>
<lookup name="java:global/LoginService" lookup="java:global/LoginService"/>
</bindings>
</subsystem>
When deploy my app, server log thrown error:
16:30:42,306 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.unit."jboss7-server-demo-app-1.0-SNAPSHOT.sar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."jboss7-server-demo-app-1.0-SNAPSHOT.sar".INSTALL: Failed to process phase INSTALL of deployment "jboss7-server-demo-app-1.0-SNAPSHOT.sar"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_05]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_05]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_05]
Caused by: java.lang.NullPointerException
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.addJndiBinding(ModuleJndiBindingProcessor.java:261)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor$1.handle(ModuleJndiBindingProcessor.java:194)
at org.jboss.as.ee.component.ClassDescriptionTraversal.run(ClassDescriptionTraversal.java:54)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.processClassConfigurations(ModuleJndiBindingProcessor.java:162)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:155)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 5 more
PS: when I used
String name = "ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + interfaceName;
I can invoke bean successfully. But when I try by @EJB, i can not deploy my app.
Could you please give me your idea?
-
8. Re: Map the remote EJB to the global JNDI name in JBoss 7
sfcoy Jul 19, 2013 6:03 AM (in response to jamesviet)The name element of the @javax.ejb.EJB annotation is should not be a JNDI name.