企业应用的瘦(ner)独立客户端 [英] Thin(ner) standalone client for Enterprise Application

查看:125
本文介绍了企业应用的瘦(ner)独立客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先有一点背景

我正在使用EJB模块和应用程序客户端模块。我还使用hibernate JPA进行持久化,而对于GUI则使用swingx。那些是唯一的第三方atm。此应用程序部署在Glassfish上。

I'm working on an enterprise application (ear) with an EJB module & an Application Client module. I also use hibernate JPA for persistence, and swingx for GUI. Those are the only third parties atm. This application is deployed on Glassfish.

一直进行得很好,直到我第一次部署我的应用程序,并尝试通过Java Web Start启动它。我打了主要的阻拦者 - JWS不喜欢hibernate3.jar,抱怨它没有签名,虽然是。如果您有兴趣,我已经描述了这里的问题。无论如何,它可能与JVM中的此未解决的错误有关。还有其他一些我不喜欢JWS,但现在没关系。

Everything was going well until I deployed my application for the first time and tried starting it by Java Web Start. I've hit major road blockers - JWS doesn't like hibernate3.jar, complains it's not signed, although it is. I've described the problem here if you're interested. Anyway it might be related to this unresolved bug in JVM. There are other things I don't like about JWS but that doesn't matter now.

当前方法


  • 鉴于这个问题,我以为我会自己部署应用程序(我打算写一些自动更新程序来保持所有的同步)。所以我按照这里,一切都很酷,除了我需要部署到客户端的应用程序容器在 40 MB !!! 之外。这样太多了!

  • Given this problem I thought I'd deploy the application myself (I plan to write some kind of auto-updater to keep everything synchronized). So I followed the instructions from here and everything was cool, except the fact that the application container I need to deploy to the client is around 40 MB!!!. That's way too much!

好的,所以我说我会删除应用程序容器,创建一个独立的客户端通过JNDI执行EJB查找,并且只包括

Ok, so I said I'll drop the application container, create a standalone client do the EJB lookup through JNDI and include only the minimum.

这里我被卡住了

这是我使用的JNDI查找:

This is the JNDI lookup I use:

Properties prop = new Properties();
prop.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.enterprise.naming.SerialInitContextFactory");
prop.put("org.omg.CORBA.ORBInitialHost", "bogdan-pc");
prop.put("org.omg.CORBA.ORBInitialPort", "3700");
try {
  InitialContext ctx = new InitialContext(prop);

  DatabaseCacheEJBRemote service = (DatabaseCacheEJBRemote) ctx.lookup("ejbs.DatabaseCacheEJBRemote");
  System.out.println("count: " + service.getProductionCount());

} catch (NamingException ex) {
  Logger.getLogger(MyFrame.class.getName()).log(Level.SEVERE, null, ex);
}

1)我以为如果我包括appserv-rt.jar& javaee.jar应该够了显然,我需要GF的其他东西...这个问题将是我需要部署到客户端以获得EJB查找工作的最低限度。

1) I thought that if I include appserv-rt.jar & javaee.jar should be enough. Apparently I need other stuff from GF... The question would be what is the bare minimum I need to deploy to the client to get EJB's lookup working?

2)为什么我需要包括所有的ejb-module依赖项(像hibernate库)吗?我没有在我的客户端的任何地方使用hibernate ...

2) Why do I need to include all the ejb-module dependencies (like hibernate libraries)?. I'm not using anywhere in my client stuff from hibernate...

感谢您阅读这篇长篇文章!

Thanks for reading this long post!

编辑

有关我的环境的一些细节:

Some details about my environment:


  • Java 1.6.0_21

  • GF 3.0.1

  • Windows(XP / 2003/7)

推荐答案

想想使用WebServices将桌面应用程序连接到应用程序服务器。从Java EE 6开始,这很容易,因为您可以注释一些会话bean(不太确定细节)成为Web服务。这是一个薄的解决方案,连接可以完成抛出http(s),所以标准端口80/443不应该在私有或公司网络中被阻止。

Think about using WebServices to connect your desktop application to application server. From Java EE 6 this is much easier, because you can just annotate some session bean (not so sure about details) to become a web service. It is a "thin" solution and connections can be done throw http(s) so standard ports 80/443 shouldn't be blocked in private or corporate networks.

这篇关于企业应用的瘦(ner)独立客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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