Just have a try, the codes below work for me. I packaged the ejb and war in the ear.


package org.apache.geronimo.test;

import javax.ejb.Local;

public interface TestBeanInterface {

    public void test();

package org.apache.geronimo.test;

import javax.ejb.Stateless;

 * Session Bean implementation class TestBean
@Stateless(name = "TestBean")
public class TestBean implements TestBeanInterface {

     * Default constructor. 
    public TestBean() {
        // TODO Auto-generated constructor stub

    public void test() {




<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">


Hope it helps.

2012/11/7 Michael Baylis <maillist@baylishome.me.uk>
Hi Ivan,
            I am afraid it didn't make a difference. 

I've tried:-

Object x = ic.lookup("java:comp/env/ejb/TestEJB");
Object x = ic.lookup("ejb/TestEJB");

with the ejb-ref you provided.

As I am using EJB 3.1 and annotations, I didn't put anything in ejb-jar.xml or openejb-jar.xml.   Does anything need to go in there?



On 06/11/2012 14:44, Ivan wrote:
If the ejb jar is packaged in the same ear, could you try whether the configuration below works for you :


2012/11/6 Michael Baylis <maillist@baylishome.me.uk>
Hi Folks,

Whenever I start to use Wink with EJBs I always seem to get totally confused wth JNDI lookups,  please could you resolve this once and for all for me.

I have a restful service that would like to do a call to an EJB.   I have tried many combinations, but the following is what I have pieced together from the docs:-

I am using Geronimo 3.0.0, and as I understand it EJB injection does not work in Wink (in Geronimo or IBM WAS 8.0) as the service class is loaded but the rest servlet, so I have to use a jndi lookup:-

bob.ear has bob.web, the restful service.
bob.ejb is seperate (but I would like it in the ear).

bob.ejb has TestEJB with a @Remote and @Local which results in:-

2012-11-05 22:21:45,603 INFO  [startup] Assembling app: C:\Users\mikebyls\software\eclipse\default\bob.ejb\1.0\jar
2012-11-05 22:21:45,619 INFO  [startup] Jndi(name=TestEJBLocal) --> Ejb(deployment-id=bob.ejb.jar/TestEJB)
2012-11-05 22:21:45,619 INFO  [startup] Jndi(name=global/bob.ejb/TestEJB!bob.ejb.TestEJBLocal) --> Ejb(deployment-id=bob.ejb.jar/TestEJB)
2012-11-05 22:21:45,619 INFO  [startup] Jndi(name=TestEJBRemote) --> Ejb(deployment-id=bob.ejb.jar/TestEJB)
2012-11-05 22:21:45,619 INFO  [startup] Jndi(name=global/bob.ejb/TestEJB!bob.ejb.TestEJBRemote) --> Ejb(deployment-id=bob.ejb.jar/TestEJB)
2012-11-05 22:21:45,619 INFO  [startup] Jndi(name=global/bob.ejb/TestEJB) --> Ejb(deployment-id=bob.ejb.jar/TestEJB)

My bob.web deployment is:-
<web:web-app xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-2.0" xmlns:bp="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:client="http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0" xmlns:conn="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2" xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2" xmlns:ejb="http://openejb.apache.org/xml/ns/openejb-jar-2.2" xmlns:jaspi="http://geronimo.apache.org/xml/ns/geronimo-jaspi" xmlns:log="http://geronimo.apache.org/xml/ns/loginconfig-2.0" xmlns:name="http://geronimo.apache.org/xml/ns/naming-1.2" xmlns:pers="http://java.sun.com/xml/ns/persistence" xmlns:pkgen="http://openejb.apache.org/xml/ns/pkgen-2.1" xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0" xmlns:web="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">

My Test Restful service is:-

public class Test1 {

    public String get() throws NamingException {

        InitialContext ic = new InitialContext();

        Object x = ic.lookup("java:comp/env/ejb/TestEJB");

        return "boo";


I have tried allsorts of combinations with the name, with the ejb in the same ear,  using local and remote interfaces, etc.   Ive googled, but cant seem to find a combination that willwork.
I have also tried different "<name:ejb-link>TestEJBRemote</name:ejb-link>" names.

Please put me out of my misery.

Would it be possible to give me a solution that would work with the EJB module in the same EAR as the WEB module please.