Thin (ner) standalone client for enterprise application

First, a little background :

I am working on an enterprise application (ear) with an EJB module and Application Client module. I also use hibernate JPA for persistence and swingx for the GUI. These are the only third parties. This application is deployed to Glassfish.

Everything went fine until I deployed my application for the first time and started to launch it using Java Web Start. I got into the main road blockers - JWS does not like hibernate3.jar, complains that it is not signed, although this is so. I described the problem here if you are interested. In any case, this may be due to this unresolved error in the JVM. There are other things that I don't like about JWS, but that doesn't matter now.

Modern approaches

  • Given this problem, I thought that I was deploying the application myself (I plan to write some kind of auto-update so that everything synchronizes). Therefore, I followed the instructions here , and everything was cool, except that the application container that I need to deploy for the client is about 40 MB !!! . It's too much!

  • Okay, so I said that I would close the application container by creating a standalone client, doing an EJB search through JNDI and turning on only the minimum.

And here I am stuck!

This is the JNDI search I am using:

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) I thought that if I turn on appserv-rt.jar and javaee.jar, that should be enough. Apparently, I need other things from GF ... The question is, what is the minimum minimum I need to deploy to the client in order to get the EJB job?

2) Why do I need to include all the dependencies of the ejb module (for example, sleep mode libraries) ?. I do not use anywhere in my client from hibernate ...

Thanks for reading this long post!

EDIT:

Some information about my environment:

  • Java 1.6.0_21
  • Gf 3.0.1
  • Windows (XP / 2003/7)
+3
source share
3 answers

Think about how to use WebServices to connect your desktop application to the application server. From Java EE 6, this is much simpler because you can simply annotate some bean session (not so sure about the details) to become a web service. This is a thin solution, and connections can be made using http (s), so standard ports 80/443 should not be blocked on private or corporate networks.

+1
source

You should be able to get rid of many dependencies if you split ejb into separate modules, i.e. interfaces and implementation banks.
impl and client banks should depend on intf, and then the client should no longer have a dependency on sleep mode. I found maven to be a very useful set of tools for separating and managing dependencies and creating jnlp files, deployment descriptors, signing jar files, etc.

There may be duplicate signatures in the hibernate jar file, and you may need to unsigned first, and then reconcile.

Why don't you consider a browser-based interface, such as gwt or vaadin or jboss, or a gate or gravel or tapestry, or one of many others. Then you don’t have to worry about getting the correct version of java installed on your iether computer.

+1
source

This is a complete list of client glass fish cans 3:

 auto-depends.jar deployment-common.jar glassfish-corba-internal-api.jar internal-api.jar management-api.jar bean-validator.jar dol.jar glassfish-corba-newtimer.jar javax.ejb.jar orb-connector.jar common-util.jar ejb-container.jar glassfish-corba-omgapi.jar javax.jms.jar orb-iiop.jar config-api.jar ejb.security.jar glassfish-corba-orb.jar javax.resource.jar security.jar config-types.jar glassfish-api.jar glassfish-corba-orbgeneric.jar javax.servlet.jar ssl-impl.jar config.jar glassfish-corba-asm.jar glassfish-naming.jar javax.transaction.jar transaction-internal-api.jar connectors-internal-api.jar glassfish-corba-codegen.jar gmbal.jar jta.jar container-common.jar glassfish-corba-csiv2-idl.jar hk2-core.jar kernel.jar 
+1
source

Source: https://habr.com/ru/post/1489010/


All Articles