users@glassfish.java.net

Re: how to use java RMI with clusters and load balancing

From: <glassfish_at_javadesktop.org>
Date: Sun, 04 Jan 2009 02:30:55 PST

Is writing an EJB with a remote interface not that what you want to accomplish? Why would you want to write your own RMI server to serve remote calls?
With EJB, you look it up using JNDI or inject it (but this will work only for managed resources).
So:
1. deploy the EJB in an jar file, which is called an ejb-jar. It is a standard jar with an optional deploymet descriptor and possibly other config files (persistence, for instance)
2. when you deploy the ejb-jar archive, you need a client. A very common scenario is to use the EJB from a servlet, or create a client application that runs in an application client container (supports EJB3 annotations and dependency injection - nice and simple). You can also write a client that is a standard J2SE app, running outside the server, and looks up the EJB using JNDI. all you need to do is to have necessary JNDI settings in your environment and it works.

Pozdro.
[Message sent by forum member 'szczyp' (szczyp)]

http://forums.java.net/jive/thread.jspa?messageID=323963