JNDI lookup for bean [ejb3]

I've EAR with 2 modules:

a) ejb module, which contain 1 session bean:

public interface TestBean {...}

@Stateless

public class TestBeanImpl implements TestBean {...}

b) web module, which contains some *non managed* service, which needs access to above bean.

Question is - how can get access to this bean?

public MyService

{

public void serviceMethod()

{

new InitialContext().lookup("what should I put here?");

}

}

I've tried various combinations of jndi name. I've tried @Stateless (mappedName="..."). I've tried putting ejb-local-ref in web.xml of web module. And I've found dozens similar questions on the net, usually without answers or with nonworking answere. Is there any portable way to achieve above scenario? Is it really so complicated?

[842 byte] By [B.Harrisa] at [2007-11-27 8:26:27]
# 1

There are two steps since your ejb client is not a managed bean.

1) Define an ejb-local-ref in web.xml or a *class*-level @EJB in some managed class within

the same .war.

2) Lookup the dependency by ejb-ref-name or @EJB(name) relative to java:comp/env

Our EJB FAQ has more detail :

https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#POJOLocalEJB

ksaksa at 2007-7-12 20:15:52 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...