不同 WebSphere 服务器上的 EJB JNDI 查找
我有两个单独安装的 WebSphere。 (实际上,其中一个是带有 EJB 3.0 和 Web 服务功能包的 WebSphere Application Server V6.1,另一个服务器是 WebSphere ESB Server V6.2)。 不过,我知道 ESB 实际上是构建在 WAS 之上的,因此它具有常规 WAS 服务器所具有的所有配置设置。
在我的 ESB 服务器中,我尝试公开一个以 EJB 3.0 编写的服务,该服务将部署到 WAS 6.1 服务器。 我的问题不是如何让 EJB 2.1 调用调用 EJB 3.0。 我们已经这么做了。 我的问题是如何跨物理虚拟机进行调用。 WebSphere Application Server 在 ESB 服务器的自己的单元/节点/服务器中运行。 根据我在 IBM 文档中读到的内容,可以在 WAS 上设置名称空间绑定以指向另一个 WAS 实例上的远程 EJB。 因此,您可以使用 JNDI 来查找一个 WAS 实例上实际驻留在另一个 WAS 实例中的 bean。 此方法的优点在于您想要的 EJB 的位置被抽象到容器级别,并且您不必在更改服务器等情况下拖动访问 bean 所需的 IP 地址和端口的属性文件您只需对远程 EJB 进行标准 JNDI 查找即可获得结果。
听起来好像可以做到。 (请参阅以下链接: http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/tnam_view_bindings。 html)尤其要关注 EJB 和间接命名空间绑定上的链接。
但有一段时间我一直对此感到头疼。 这说得通。 看起来是可以做到的。 间接命名空间绑定看起来最有前途。 但我无法让它正常工作。 我的 ESB 服务器一直抱怨在我要求的上下文中找不到 comp/env/ejb。 对此非常疑惑。
只是想知道以前是否有人做过这样的事情。 您能给我一个具体的例子来说明您如何在 WAS 中进行设置吗? 任何帮助表示赞赏
I have two separate installs of WebSphere. (Actually one is WebSphere Application Server V6.1 with EJB 3.0 and Web Services feature packs, and the other server is WebSphere ESB Server V6.2). However, I know that ESB is really built on top of WAS, so it has all the configuration settings that a regualr WAS server has.
In my ESB server, I am trying to expose a service written as EJB 3.0 that will be deployed to the WAS 6.1 server. My question is not how to get EJB 2.1 calls to call into an EJB 3.0. We've done that already. My question is how to call across physical VM's. The WebSphere Application Server is running in its own cell/node/server from the ESB Server. From what I've read in IBM documentation, it is possible to set up a namespace binding on WAS to point to a remote EJB on another WAS instance. Thus you could use JNDI to lookup a bean on one WAS instance that really resides in another WAS instance. The beauty of this method is the location of the EJB you want is abstracted to the container level, and you don't have to drag around properties files of the IP addresses and ports that you need to access the bean should it change servers, etc. You just make a standard JNDI lookup to a remote EJB and you get it.
Sounds like it can be done. (See the following links:
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/tnam_view_bindings.html) Especially follow the links on EJB and Indirect namespace bindings.
But I've been hitting my head against this for a while. It makes sense. It looks like it can be done. And the Indirect namespace binding looks the most promising. But I can't get it to work quite right. My ESB server keeps complaining about not finding comp/env/ejb in the context in which I am asking for it. Very puzzled by this one.
Just wondering if anybody has done this kind of thing before. Can you give me a concrete example of how you set this up in WAS to do so? Any help is appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
嗯,此后我与 IBM 讨论了如何做到这一点,并对他们的回答感到惊讶。他们回答说,如果您要在同一服务器或服务器集群内的 EJB 之间进行 EJB 对话,则可以通过 IIOP 使用 EJB RMI。通过 JNDI,可以抽象出 Bean 实际运行的位置(在集群环境中)。
如果您要从一台服务器(或服务器集群)转移到另一台服务器(或服务器集群),无论目标和源是否位于同一单元中,IBM 建议您使用消息传递或 Web 服务。他们认为这是应用程序之间更好的抽象方法,可以防止它们彼此“捆绑”。他们确实说过您可以让 EJB 通过 CORBA 与 RMI 对话,但表示只有在绝对必要时才这样做。当然,您需要知道通过 CORBA 进入的 IP 和端口号(如果在集群环境中,还需要知道每个集群成员的时间)。
这再次让我感到惊讶,但确实有道理。我只是想与全世界分享这些想法,特别是如果您正在使用 WebSphere。
Well, I have since talked with IBM on how to do this and was surprised by their answer. They answered that if you are talking EJB to EJB within the same server or server cluster, then use EJB RMI via IIOP. With JNDI this abstracts where the bean is actually running (in a clustered environment).
If you are going from one server (or server cluster) across into a different server (or server cluster) regardless of whether or not the target and source are in the same cell, IBM recommended that you use messaging or web services. They felt that was a better method of abstraction between applications to keep them from being "tied" to each other. They did say that you could get EJB's to talk RMI via CORBA, but said to do that ONLY if absolutely necessary. And of course, you would need to know the IP and port number for coming in over CORBA (and that times each cluster member if in a clustered environment).
Again, this kind of surprised me, but it does make sense. Just thought I'd share these thoughts with the world, especially if you are working with WebSphere.
如何从tomcat查找
how to lookup from tomcat
我遇到了同样的问题。 在尝试包含所有 websphere 和 ibm orb jar 后,在 ibm 找到了这篇文章
如何使用 Oracle JDK 客户端在 WebSphere Application Server 中查找 EJB 和其他资源 - http://www-01.ibm.com/support/docview.wss?uid=swg21382740
基本上使用 CNCtxFactory 而不是 WsnInitialContextFactory
I was stuck with the same problem. After trying to include all the websphere and ibm orb jars found this article at ibm
How to lookup an EJB and other Resources in WebSphere Application Server using a Oracle JDK client - http://www-01.ibm.com/support/docview.wss?uid=swg21382740
basically used the CNCtxFactory instead of WsnInitialContextFactory