EJB远程应用程序客户端
我正在启动一个新的企业项目,并使用 Glassfish 3
作为应用程序服务器,使用 NetBeans 6.9
作为 IDE
。我有一些 EJB
,我想从桌面 Swing
应用程序远程访问它们。 AFAIK 有两种选择 - 要么使用普通的 JNDI 查找,要么在应用程序客户端容器中运行 Swing 应用程序并使用 @EJB 注释。我成功地尝试了第一个选项,但我必须复制所有 glassfish
库来满足依赖项(大约 50MB,我认为这不正常)。现在我尝试第二种选择。在 NetBeans 中,我创建一个新的企业应用程序客户端项目,将 EJB 项目添加为依赖项并按运行。我收到以下异常:类型为 [ejb] 和类型 [appclient] 的嗅探器不应同时声明存档
。现在,如果我删除应用程序客户端的项目属性中 EJB 项目旁边的 package
复选框,我的远程接口会出现不同的 ClassNotFound
异常。
我感觉有点卡住了:( 一些更有经验的人可以告诉我他们如何使用 Glassfish 3
远程访问他们的 EJB?正如我上面所写的,我成功地使用了第一个选项,但 50MB 是我认为对于一个简单的客户端来说太多了。
您在远程服务器上有 ejbs
中的业务逻辑,您会选择什么方法进行部署和远程访问?
编辑:如果 祝
你一切顺利,佩塔尔
I am starting a new enterprise project and use Glassfish 3
as an application server and NetBeans 6.9
as an IDE
. I have some EJBs
which I want to access remotely from a desktop Swing
application. AFAIK there are two options - either use plain JNDI
lookup or run the Swing
application in an application-client container and use @EJB
annotations. I tried successfully the first option but I had to copy all glassfish
libraries to satisfy the dependencies(about 50MB, which I don't find normal). Now I try the second option. In NetBeans
, I create a new Enterprise Application Client
project, add the EJB project as a dependency and press run. I get the following exception: Sniffers with type [ejb] and type [appclient] should not claim the archive at the same time
. Now if I remove the package
checkbox, next to the EJB project in the Project properties of application client, I get a different ClassNotFound
exception of my remote interface.
I feel kind of stuck:( Could some more experienced guys, tell me how do they access their EJBs remotely, using Glassfish 3
? As I have written above, I succeed with the first option, but 50MB are too much in my opinion for a simple client.
Edit: What approach would you choose for deployment and remote access from the client, if you have the business logic in ejbs
on a remote server?
Thanks for any suggestions you have!
Wish you all the best, Petar
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为针对您的情况,最好的方法是在您的服务器中创建一个 Servlet(或其他一些简单的组件),并让这个家伙与您的 EJB 对话。如果您选择这种情况,您将隔离您的客户端/服务器通信和业务逻辑实现。
I think the best approach in your case is to create a Servlet (or some other light simple component) in your server and make this guy talk to your EJB. If you choose this case, you will isolate your client/server comunication and your business logic implementation.