>Hi,
>Even i agree with Bimalesh that the lookup can be done through RMI and
>My simple question , as original poster asked is , is it possible to use
>rmi to lookup the ejb?
>If any body says yes, then how ?
>If not possible then there is no question of debating.
>Leave apart the advantages of lookup by rmi or jndi.

The original question, as initially stated, is a bit ambiguous, so to try
and target the issue with more clarity by phrasing some more precise
questions and giving their answers.

Q: Does the EJB/J2EE spec require application servers to support looking
up EJBs using the java.rmi.Naming and java.rmi.registry.Registry classes?

A: In order to use java.rmi.Naming to look up an EJB (or any RMI object),
there must be an RMI object on the network which implements
java.rmi.registry.Registry.  EJB/J2EE Application servers are NOT required
to host such an object.  Therefore, you can make no assumption that such
an Registry rmi object exists, unless you provide such an object yourself.
On the other hand, there is a requirement for J2EE applicaiton servers to
support JNDI lookup of EJBs, so this is guaranteed to work on all J2EE
certified application servers.


Q: Is it theoretically possible to manually create an RMI registry on the
network, and then look up EJBs with that registry?

A: Yes, it is possible to do this.  You can write your own RMI object
which implements java.rmi.registry.Registry, launch it somewhere on the
network, and use that object to look up your EJBs.  Since this would simply
be a facade to JNDI, and would return the original EJB/RMI stubs, the full
benefits of EJB would still remain in place.  Your EJB clients would still
need the JNDI classes in their classpath though, because on many
application servers, the EJB's RMI stubs are themselves JNDI aware, and may
make use of JNDI to handle load balancing, hot redeploy, failover, etc..


Q: Is there any time when it would make sense to look up EJBs using the
java.rmi.Naming or java.rmi.registry.Registry classes?  Is there any
benefit to doing things this way?

A: I can think of no theoretical nor practical benefits to using RMI's
lookup facilities rather than JNDI to look up EJBs.  And I can think of
dozens of reasons why it would be a bad idea (many of which have already
been listed on this thread).  It simply doesn't make any sense to do this.

So in response to the original question of "Can you use RMI to look up
EJBs", the short answer is "yes, but to ensure portability you have to code
and launch the RMI Registry object yourself."  And there is little to no
benefit to doing this.

Hopefully, this answers your questions,
Doug

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to