users@glassfish.java.net

InitialContext NameNotFoundException

From: <glassfish_at_javadesktop.org>
Date: Wed, 26 Nov 2008 15:59:50 PST

Hi Guys,

I have tried a simple EJB3.0 sample application, using Eclipse and Glassfish v2 J2EE 5, from some forums and I am unable to find the bean by using the InitialContext.lookup().

The Glassfish log is :

INFO: WEB0302: Starting Sun-Java-System/Application-Server.
INFO: WEB0712: Starting Sun-Java-System/Application-Server HTTP/1.1 on 8280
INFO: WEB0712: Starting Sun-Java-System/Application-Server HTTP/1.1 on 8281
INFO: WEB0712: Starting Sun-Java-System/Application-Server HTTP/1.1 on 4858
INFO: SMGT0007: Self Management Rules service is enabled
INFO: Application server startup complete.
INFO: CORE5022: All ejb(s) of [Ejb2Ear] were unloaded successfully!
INFO: ADM1006:Uploading the file to:[C:\Users\xxx\AppData\Local\Temp\s1astempdomain1server-1128441658\Ejb2Ear.ear]
INFO: deployed with moduleid = Ejb2Ear
INFO: POARemoteRefFactory checking if SFSBVersionPolicy need to be added
INFO: EJBSCLookup:: sc.getEjbContainerAvailabilityEnabledFromConfig() ==> false
INFO: POARemoteRefFactory addSFSBVersionPolicy? false
INFO: POARemoteRefFactory checking if SFSBVersionPolicy need to be added
INFO: EJBSCLookup:: sc.getEjbContainerAvailabilityEnabledFromConfig() ==> false
INFO: POARemoteRefFactory addSFSBVersionPolicy? false
INFO: **RemoteBusinessJndiName: first.Hello; remoteBusIntf: first.HelloRemote
INFO: LDR5010: All ejb(s) of [Ejb2Ear] loaded successfully!

The client trying to connect to the bean is:

                InitialContext cntx = new InitialContext();
                HelloRemote hello = (HelloRemote) cntx.lookup("first.Hello");

And the actual bean:

package first;
....
@Stateless(name="Hello", mappedName="first.Hello")
public class Hello implements HelloRemote, HelloLocal {
...

The error that I receive is javax.naming.NameNotFoundException: first.Hello not found

I have a feeling that I miss something really simple here. I have tried also without using the mappedName, but the result is the same.

Do I require any ejb-jar.xml descriptor for EJB3 ?

Thanks,
Alex
[Message sent by forum member 'alex111' (alex111)]

http://forums.java.net/jive/thread.jspa?messageID=318913