users@glassfish.java.net

Glassfish does not find bean on another Glassfish server

From: <glassfish_at_javadesktop.org>
Date: Wed, 01 Jul 2009 08:49:02 PDT

Hi guys,

I am struggling with that sort of problem for quite a while now.
I have two Glassfish instances in the same LAN. One hosts the enterprise application that has a stateless session bean. The other one has a servlet who wants to access the bean remotely.

The Webapp contains the ejb.jar with the interface definitions of the enterprise app. The following code snippet shows how I try to lookup the session bean:

Properties props = new Properties();
            props.setProperty("java.naming.factory.initial","com.sun.enterprise.naming.SerialInitContextFactory");
props.setProperty("java.naming.factory.url.pkgs","com.sun.enterprise.naming"); props.setProperty("java.naming.factory.state","com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
props.setProperty("org.omg.CORBA.ORBInitialHost", "192.168.10.70");
props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");

InitialContext ctx = new InitialContext(props);
Object access = ctx.lookup("AccessBean");
AccessRemote a = (AccessRemote) access;

The Remote Interface of the bean is specified as follows:

@Remote
public interface AccessRemote {
    public String createScopeCallEntry(params);
}

and the bean as follows:

@Stateless(mappedName="AccessBean")
public class AccessBean implements AccessRemote {
    // code
}

The only error message that I get from the Glassfish that hosts the enterprise app is:

javax.naming.NameNotFoundException: AccessBean not found

What am I doing wrong or what is missing to get the Access Bean successfully on my client web app?!?

Thanx so much in advance for your help. It is grealty appreciated!

Cheers
Peter
[Message sent by forum member 'peter0601' (peter0601)]

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