Jac*_*Ant 8 java jboss ejb remote-server wildfly-8
我正在尝试调用部署在远程服务器上的无状态EJB.我可以从我的本地JBoss环境调用bean,但是当我将其更改remote.connection.default.host为远程机器的主机时,我的客户端代码不起作用.
这是我的jboss-ejb-client.properties:
endpoint.name=client-endpoint
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connections=default
remote.connection.default.host=SERVERIP/HOSTNAME
remote.connection.default.port=8080
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.connection.default.username=username
remote.connection.default.password=Password
Run Code Online (Sandbox Code Playgroud)
我的客户端代码如下所示:
Properties properties = new Properties();
properties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
String jndi = "jndi_name";
Context context = new InitialContext(properties);
obj = context.lookup(jndi);
Run Code Online (Sandbox Code Playgroud)
请帮忙.
谢谢大家.插口.
Ale*_*ühl -2
通常在 Java EE 中,您让容器执行查找而不是您自己执行。来自Java EE 6 教程:
\n\n\n\n\n要通过依赖项注入获取对企业 Bean 的远程业务接口的引用,请使用 javax.ejb.EJB 注释并指定企业 Bean\xe2\x80\x99s 远程业务接口\n 名称:
\n\n\n
@EJB Example example;
如果必须是 JNDI 查找,请查看此 JBoss 教程- 虽然它适用于版本 7,但也许它对您的情况有帮助。
\n| 归档时间: |
|
| 查看次数: |
9443 次 |
| 最近记录: |