Unfortunately in all of my research (looking at Deployment in J2EE,
WebLogic, Websphere and JRun) you must rely, to some degree, on the
container for their preferred JNDI lookup scheme.

For instance, the J2EE implements it this way:
        Context initial = new InitialContext();
        Object objref = initial.lookup("BeanAliasFromDeployTool");

Whereas, WebLogic uses:

        Hashtable env = new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY, 
                "weblogic.jndi.TengahInitialContextFactory");
        try{
        ctx = new InitialContext(env);
        ...
        }

Essentially, you're going to have to depend on the eventual deployment
target/container in order to implement the proper JNDI naming service.  Of
course, if you wanted to abstract this out and use some sort of abstract
interface, I guess you could defer this logic to run-time as opposed to
compile time.

FWIW!
John

-----Original Message-----
From: Marcelo Bellezo [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 20, 2000 9:46 AM
To: [EMAIL PROTECTED]
Subject: Re: [JRun-Talk] Non-Jrun specific way to get local
EJBHomeObject?



--------------6ED25E030EAEA17BAD906021
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,

good point, to you have portability, use the following:

Context context = new InitialContext();
UserHome userHome =
(UserHome)context.lookup("java:comp/env/ejb/sample10a.UserHome");
final User user = userHome.findByPrimaryKey(name);

But it only worked inside another EJB, I tryed it on a servlet and it
doesn't worked.

Regard's

Marcelo Bellezo

"Rhodes, Phillip C." wrote:

> In JRun examples, they have the following code snippet that will get the
> local EJBHome object for this bean.
>  final User user =
>
((UserHome)ResourceManager.getLocalEJBHome("sample10a.UserHome")).findByPrim
> aryKey(name);
>
> Although I love JRun :)  I would like my code to not depend upon the
> container.  If I have already have an existing javax.ejb.SessionContext
> object, how may I use this to objtain a reference to a local ejb home
> object?
>
> Thanks.
>
> Phillip Rhodes
> [EMAIL PROTECTED]
> Alcoa eCommerce
> https://www.ALCOADIRECT.COM
> 826B Two Allegheny Center Pittsburgh, PA  15212
> (412) 553-4900  (phone)  (412) 553-2484 (fax)
>
>
----------------------------------------------------------------------------
--
> Archives: http://www.egroups.com/group/jrun-interest/
> Unsubscribe:
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
> or send a message to [EMAIL PROTECTED] with
'unsubscribe' in the body.

--------------6ED25E030EAEA17BAD906021
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi,
<p>good point, to you have portability, use the following:
<p>Context context = new InitialContext();
<br>UserHome userHome =
(UserHome)context.lookup("java:comp/env/ejb/sample10a.UserHome");
<br>final User user = userHome.findByPrimaryKey(name);
<p>But it only worked inside another EJB, I tryed it on a servlet and it
doesn't worked.
<p>Regard's
<p>Marcelo Bellezo
<p>"Rhodes, Phillip C." wrote:
<blockquote TYPE=CITE>In JRun examples, they have the following code snippet
that will get the
<br>local EJBHome object for this bean.
<br>&nbsp;final User user =
<br>((UserHome)ResourceManager.getLocalEJBHome("sample10a.UserHome")).findBy
Prim
<br>aryKey(name);
<p>Although I love JRun :)&nbsp; I would like my code to not depend upon
the
<br>container.&nbsp; If I have already have an existing
javax.ejb.SessionContext
<br>object, how may I use this to objtain a reference to a local ejb home
<br>object?
<p>Thanks.
<p>Phillip Rhodes
<br>[EMAIL PROTECTED]
<br>Alcoa eCommerce
<br><a href="https://www.ALCOADIRECT.COM">https://www.ALCOADIRECT.COM</a>
<br>826B Two Allegheny Center Pittsburgh, PA&nbsp; 15212
<br>(412) 553-4900&nbsp; (phone)&nbsp; (412) 553-2484 (fax)
<p>-------------------------------------------------------------------------
-----
<br>Archives: <a
href="http://www.egroups.com/group/jrun-interest/">http://www.egroups.com/gr
oup/jrun-interest/</a>
<br>Unsubscribe: <a
href="http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_t
alk">http://www.houseoffusion.com/index.cfm?sidebar=lists&amp;body=lists/jru
n_talk</a>
<br>or send a message to [EMAIL PROTECTED] with
'unsubscribe'
in the body.</blockquote>
</html>

--------------6ED25E030EAEA17BAD906021--

----------------------------------------------------------------------------
--
Archives: http://www.egroups.com/group/jrun-interest/
Unsubscribe:
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe'
in the body.
------------------------------------------------------------------------------
Archives: http://www.egroups.com/group/jrun-interest/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the 
body.

Reply via email to