简体   繁体   English

如何从部署到JBoss EAP 6的Web应用程序访问部署到GlassFish 2服务器的EJB?

[英]How to access EJB deployed to GlassFish 2 server from web app deployed to JBoss EAP 6?

We're migrating our web app from GF 2.1.1 (Java 6) to JBoss EAP 6.3.0 (Java 7) and need to use one EJB from GF for some time until it will migrate to JBoss too. 我们正在将Web应用程序从GF 2.1.1(Java 6)迁移到JBoss EAP 6.3.0(Java 7),并且需要一段时间使用GF中的一个EJB,直到它也迁移到JBoss。

1 - Previously we just used GF's External JNDI resource to connect to this EJB: 1-以前我们只是使用GF的External JNDI资源连接到此EJB:

<external-jndi-resource enabled="true"
    factory-class="com.sun.enterprise.naming.SerialInitContextFactory"
    jndi-lookup-name="ejb/NameOfEJB" jndi-name="ejb/NameOfEJB"
    object-type="user" res-type="name.of.ejb.interfaces.NameOfEJB">
  <property name="org.omg.CORBA.ORBInitialPort" value="3700"/>
  <property name="org.omg.CORBA.ORBInitialHost" value="hostname.of.ejb"/>
</external-jndi-resource>

I couldn't find anything similar to this on JB yet. 我在JB上找不到与此类似的东西。

2 - I tried to reach this EJB through the code using GF's implementation: 2-我尝试使用GF的实现通过代码访问此EJB:

Properties props = new Properties();
props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
props.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
props.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
props.setProperty("org.omg.CORBA.ORBInitialHost", zoneHost);
props.setProperty("org.omg.CORBA.ORBInitialPort", zonePort);
InitialContext ic = new InitialContext(props);
Object obj = ic.lookup("ejb/NameOfEJB");

But I couldn't get rid of all the Exceptions, that JB started throwing when I tried to add GF's libs (appserv-rt.jar...) needed to use this approach. 但是我无法摆脱所有异常,当我尝试添加使用这种方法所需的GF的libs(appserv-rt.jar ...)时,JB开始抛出异常。

3 - I also tried to reach this EJB through the code using JB's implementation: 3-我还尝试使用JB的实现通过代码来访问此EJB:

Properties props = new Properties();
props.setProperty("java.naming.factory.initial", "org.jboss.naming.remote.client.InitialContextFactory");
props.setProperty("java.naming.factory.url.pkgs", "org.jboss.ejb.client.naming");
props.put("jboss.naming.client.ejb.context", true);
props.setProperty(Context.PROVIDER_URL, "remote://" + zoneHost+ ":" + zonePort);
// also tried to add Context.SECURITY_PRINCIPAL and CREDENTIALS properties, but they didn't change anything
InitialContext ic = new InitialContext(props);
Object obj = ic.lookup("ejb/NameOfEJB");

Which resulted in timeout after 5 seconds. 5秒后导致超时。

Can something like (1) be done in JBoss? 可以在JBoss中完成类似(1)的操作吗? That would be the best option. 那将是最好的选择。

Is GF approach (2) even possible from JBoss? JBoss甚至可以使用GF方法(2)吗?

If I need to use JB approach (3), then what am I doing wrong? 如果我需要使用JB方法(3),那我在做什么错呢?

Your first 2 approaches are wrong, since they're Glassfish dependent, and you wish to connect from JBoss to Glassfish. 您的前两种方法是错误的,因为它们依赖于Glassfish,并且您希望从JBoss连接 Glassfish。

The last approach seems to be somewhat correct, according to the documentation. 根据文档 ,最后一种方法似乎有些正确

I would first check out that the host/port is accessible and also turn on all possible logging to see what's going on. 我首先要检查主机/端口是否可访问,还要打开所有可能的日志记录以查看发生了什么。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从独立客户端访问部署在JBoss 7.1.1上的WAR中的@Remote EJB - access @Remote EJB deployed in WAR on JBoss 7.1.1 from standalone client 在Jboss 4.2.3中部署了EJB3。 我们如何访问它? - Deployed EJB3 in Jboss 4.2.3. How do we access it? 如何从 java Se 连接到部署在 glassfish 上的远程 Ejb? - How to connect to remote Ejb that deployed on glassfish from java Se? 部署在JBOSS上的EJB的端点 - Endpoint for an EJB deployed on JBOSS 如何从已部署的Web应用程序访问本地文件系统上的文件? - how to access files on local file system from deployed web app? JBoss Application Server:从另一台机器访问已部署的Web应用程序 - JBoss Application Server: Accessing deployed web application from another machine 从BB仿真器访问部署在本地jboss服务器上的Web服务 - Access webservices deployed on a local jboss server from bb simulator 如何从部署到Websphere 6.1的EJB访问身份验证别名 - How to access authentication alias from EJB deployed to Websphere 6.1 是否可以以某种方式从部署在BEA AquaLogic Service Bus上的业务服务调用部署在JBoss上的EJB? - Is it possible to call in some way an EJB deployed on JBoss from a Business Service deployed on BEA AquaLogic Service Bus? 如何从 Jboss EAP 6.4 中部署的所有战争的 manifest.mf 文件中获取实现版本详细信息 - How to get implementation version details from manifest.mf file from all the war deployed in Jboss EAP 6.4
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM