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 NameNotFoundException
Date Tue, 13 May 2008 17:50:10 GMT

On May 13, 2008, at 2:26 AM, Bård Magnus Kvalheim wrote:

> Hi David, thanks for you reply.
>
> My comments below...
>
> 2008/5/13 David Blevins <david.blevins@visi.com>:
>
>>
>> On May 11, 2008, at 4:03 PM, Bård Magnus Kvalheim wrote:
>>
>> Hi,
>>>
>>> I'm new to ejb and just started experimenting with openejb tomcat  
>>> plugin
>>> Tomcat: 5.5.26
>>> OpenEJB 3.0
>>>
>>>
>>> So far the openejb plugin is looking good. Setup completed and I've
>>> successfully deplyed the webapp example as well.
>>>
>>> I deployed my own war (Collapsed ear) containing a Stateless session
>>> bean.
>>> This is the same as the calculator example.
>>>
>>> The logs say:
>>> 2008-05-12 00:12:09,700 - INFO - Jndi(name=CalculatorLocal) -->
>>> Ejb(deployment-id=Calculator)
>>> 2008-05-12 00:12:09,700 - INFO - Created Ejb(deployment- 
>>> id=Calculator,
>>> ejb-name=Calculator, container=My Stateless Container)
>>>
>>> Browing the OpenEJB JNDI Namespace Browser I can see my ejb, but I  
>>> get
>>> FAIL
>>> when I try to inspect. (The ejb's from webapp example is also  
>>> shown and
>>> fail
>>> just the same way, so perhaps this is expected).
>>>
>>
>> Fixing up that FAIL issue now, thanks!
>
>
> Great! You guys work fast :-)
>
>>
>>
>> Anyways, trying to use the bean in client app, which is another war  
>> in
>>> same
>>> tomcat, I get "javax.naming.NameNotFoundException" no matter what  
>>> I do.
>>>
>>> I've tried jndi names:
>>> Calculator
>>> CalculatorLocal
>>> java:comp/env/CalculatorLocal
>>> java:comp/env/com.test.Calculator/CalculatorLocal
>>>
>>> I'm using spring's LocalStatelessSessionProxyFactoryBean on client  
>>> for
>>> looking up ejb from jndi.
>>>
>>> Any thoughts on where I've gone wrong on this?
>>>
>>
>> Don't know how the LocalStatelessSessionProxyFactoryBean works, but  
>> you'll
>> essentially need to make it do this:
>>
>> Properties jndiEnv = new Properties();
>> jndiEnv.setProperty("java.naming.factory.initial",
>> "org.apache.openejb.client.LocalInitialContextFactory");
>>
>> InitialContext context = new InitialContext(jndiEnv);
>> context.lookup("CalculatorLocal");
>>
>
> Yes, this works as expected.
> The problem must be with spring configuration.
>
>
>>
>>
>> Looks like the LocalStatelessSessionProxyFactoryBean has a method
>> "setJndiEnvironment(Properties jndiEnvironment)" which might do the  
>> trick.
>
>
> Thanks for pointing this out!
> Will experiment and report back to this thread.

Great.  We can make a little doc for it and put it on the website.

-David


Mime
View raw message