users@glassfish.java.net

_at_EJB annotation does not bind EJB under java:comp/env

From: Vano Beridze <vano.beridze_at_silkroad.ge>
Date: Tue, 16 Oct 2007 19:19:01 +0400

Hello

I user NetBeans 6 latest daily build, glassfish v2 b58g.
I've created Enterprise Application Project in NetBeans with EJB Module
project.
I've created one stateless session bean in EJB Module Project with one
simple method.
I used @EJB annotation to register my EJB in ENC.

package test;

import javax.ejb.EJB;
import javax.ejb.Stateless;

@Stateless
@EJB(name="ejb/EchoProvider", beanInterface=EchoProviderLocal.class)
public class EchoProviderBean implements EchoProviderLocal {

    public String sayHello(String callerName) {
        return "Hello "+callerName;
    }
}

I've deployed the application successfully to glassfish.
When I log in to http://localhost:4848 and go Application Server | JNDI
Browsing, there is only one entry under ejb node that is ejb/mgmt


Moreover I've created simple Web Application with one jsp page and a
servlet. When a user clicks button in the browser, the request is sent
to the servlet that calls the following code

InitialContext ic=new InitialContext();
Object obj=ic.lookup("java:comp/env/ejb/EchoProvider");

after ic.lookup NamingException is thrown with the message that the name
is not bound.

-- 
Vano Beridze
Software Developer
Silk Road Group