How to lookup ejb on JBoss AS 7.x

*爱你&永不变心* 提交于 2019-12-22 00:17:12

问题


I try ejb lookup for jndi name. That ejb is same jboss server then is success. But ejb is other jboss server then is failed. My source code:

Hashtable<String, String> env = new Hashtable<String, String>();
env.put("java.naming.provider.url","jnp://192.168.100.10:8484");
env.put("java.naming.factory.initial",
                "org.jboss.as.naming.InitialContextFactory");
env.put("java.naming.factory.url.pkgs",
                "org.jboss.as.naming.interfaces.java");
env.put("java.naming.security.principal", "Admin");
env.put("java.naming.security.credentials",
            "password");
Context context = new InitialContext(env);
IMyLogic infoLogic = (IMyLogic) context.lookUp("java:global/MyApplication/MyModule/MyLogic!org.test.interfaces.IMyLogic");

IMyLogic ejb 192.168.100.10 jboss as 7.1 deployed. I try lookup 192.168.100.15 jboss as 7.1. Thanks.


回答1:


You should use this guide to make remote invocations to an EJB from a standalone client:

https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI

Or if you are in another JBoss instance, then use the accompanying article:

https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+server+instance



来源:https://stackoverflow.com/questions/10545043/how-to-lookup-ejb-on-jboss-as-7-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!