如何从不同的JVM中的独立Java程序调用EJB [英] How to call EJB from Standalone java program in diffrent JVM

查看:91
本文介绍了如何从不同的JVM中的独立Java程序调用EJB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用具有glassfish服务器的NETbeans IDE开发了EJB。我可以从独立的java中调用它,只有这个java项目是在NETbeans下开发的,并且运行在相同的JRE下。但是我需要知道如何在不同的jre中运行它。
我找不到很多帮助这个。有什么建议么? (或相关的链接)
谢谢,

解决方案

为了从远程JVM调用EJB, / p>


  • 使用@Remote注释EJB


  • 一个带有接口的jar并将其放在您的client-vm的类路径中


  • 使用JNDI为了从服务器获取EJB存根上的引用。 p>


  • 对于JNDI,您需要依赖于容器的实现(例如,如果JBoss的jboss-client-all.jar应该足够了(我不记住确切的名字,但是你已经得到了点,我想)




一旦你对整体概念感到满意和定义,阅读这个例子,我觉得它的手足够
示例



希望这有助于


I have developed EJB using NETbeans IDE having glassfish server. I can call it from standalone java, only if this java project is developed under NETbeans and run under same JRE. But I need to find out how to run it in different jre's. I could not find much help on this one. Any suggestions? (or related links would do) Thanks,

解决方案

In order to call EJB from remote JVM, you should

  • Use @Remote annotation on you EJB

  • Supply a jar with interfaces and put it in the classpath of you client-vm

  • Use JNDI in order to obtain a reference on the EJB stub from server.

  • For JNDI you'll need an implementation that depends on container (for example, if its JBoss jboss-client-all.jar should be enough (I don't remember the exact name but you've got the point, I think)

Once you feel comfortable with the overall notions and definitions, read this example, I think its handy enough Example

Hope this helps

这篇关于如何从不同的JVM中的独立Java程序调用EJB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆