tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <david.blev...@visi.com>
Subject Re: JNDI lookup in Tomcat
Date Wed, 08 Oct 2008 20:49:00 GMT

On Oct 8, 2008, at 12:37 PM, Zog wrote:

> I installed the openejb.war in tomcat-6.0.18 and my ear as a  
> collapsed ear.
> When I lookup objects in the JNDI tree, I realized that I can freely  
> look up
> injected resources (I use the <resource-ref> in ejb-jar.xml for ex  
> for data
> sources),
> but non injected are failing - is this normal ?
> Specifically, one of my ejb is doing
> InitialContext ic = new InitialContext(); // Properly initialized  
> with the
> OpenEJB ICfactory
> ic.lookup("openejb/TransactionManager");
> and this always throws a NameNotFoundException.

Hmm.  If it was created with the LocalInitialContextFactory as so..

  Properties properties = new Properties();
  properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,  
"org.apache.openejb.client.LocalInitialContextFactory");

  InitialContext initialContext = new InitialContext(properties);

Then it should definitely work.  If it was done as so...

  InitialContext initialContext = new InitialContext();

Then I'm not as confident that it will work.  We have code in the  
integration to add the "openejb" subcontext into the webapp's jndi  
context, or so I thought.  I added code along these lines, but it's  
been while and I can't recall the details.  Maybe in this second case  
you have to lookup "java:openejb/TransactionManager".

Can you verify which technique you are using?


-David


Mime
View raw message