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!

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");


Looks like the LocalStatelessSessionProxyFactoryBean has a method "setJndiEnvironment(Properties jndiEnvironment)" which might do the trick.

-David

Reply via email to