tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tt...@ticnet.com
Subject Re: ejb-ref/EjbRef/EjbFactory implementation
Date Tue, 13 Mar 2001 22:52:48 GMT

I am very interested in this implementation.  I have been trying to use the
tomcat context to get a reference to an EJB in another machine (running
Jboss).  
In my investigation, the <ejb-link> is the most important field in
<ejb-ref> when there are multiple machines because it defines the full URL
to the EJB 
(schema://machine.url:port/published.ejb.name).  
The NamingManager should be able to use the schema to find the
URLContextFactory.  And the 'machine.url:port' for the connection.

The <home> <remote> and other tags are useful, when the EJB containter is
sharing the same JVM as jakarta (and thus the same name space).

Please send me more details of your implementation.
Thanks, Tim

Arnaud Level writes:

> Hi everyone,
> I'm working on the implementation of the EjbFactory class (Tomcat 4.0).
> According to what I've understand, this class is used when the lookup
> method is called from a Servlet (or jsp).
> e.g: Context ctx = new InitialContext();
>       ctx.lookup("java:comp\MyEjb");
> If the ejb-ref tag has been defined in the web.xml file, Tomcat is able
> to find the EjbFactory (through the EjbRef saved for MyEjb). Then what
> can this Factory do ?
> It delegates the job to the Ejb server in its getObjectInstance method:
>     - by creating a new InitialContext (with the factory class of my Ejb
> server as env parameter).
>    - by calling the lookup method of the newly created context and
> returning the resulting value.
> If this is correct, what the point to define the home,remote and
> ejb-link (in the web.xml file) value since they are not passed to the
> Ejb server which will use the one defined in its own web.xml file. So
> the question is what are those value (defined in the web.xml file of
> read by Tomcat) used for ?
> Am I misundertanding something ?
> Any help is appreciated.
> Thank you.
> Arnaud Level.
> 
> This is a basic way to implement it but it shows the idea:
> e.g: EjbFactory.java
>   public Object getObjectInstance(Object obj, Name name, Context
> nameCtx,
>                                     Hashtable environment)
>         throws NamingException {
> 
>         if (obj instanceof EjbRef) {
>             Reference ref = (Reference) obj;
>             Hashtable table = new Hashtable(2);
>             table.put(Context.INITIAL_CONTEXT_FACTORY,
> "com...MyEjbServerCtxFactory");
>            javax.naming.InitialContext initCtx = new
> javax.naming.InitialContext(table);
>            return initCtx.lookup("MyEjb"); //
>         }
>         return null;
> 
>     }
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, email: tomcat-dev-help@jakarta.apache.org


Mime
View raw message