Skip to main content

strange behavior when lookup remote ejb

No replies
matrixV
Offline
Joined: 2012-10-16
Points: 0

Hi everyone, I need your help.. I am seeing a very strange behavior in glassfish. I have 2 non-clustered standalone glassfish instances on a domain, each on a different machine... one for web components and the other for ejb components. The glassfish servers are version 3.1.2.2 and are in centos linux machines.... both of the instances respond to the ssh ping from the DAS. The way I am trying to comunicate to the ejbs is through lookup, from a JSF webapp

Properties env = new Properties();
env.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.impl.SerialInitContextFactory");
env.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
env.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
String host = System.getProperty("org.omg.CORBA.ORBInitialHost");
String port = System.getProperty("org.omg.CORBA.ORBInitialPort");
env.setProperty("org.omg.CORBA.ORBInitialHost", host);
env.setProperty("org.omg.CORBA.ORBInitialPort", port);
Context ctx = new InitialContext(env);
Object obj = ctx.lookup(ejbName);

(I have the host (svr-ejb) and iiop port (3700) of the ejb machine at the JVM options of the web machine... they are read succesfully)

with the webapp deployed in web machine and ejbs in ejb machine, I get this lookup error:

(javax.naming.NamingException) javax.naming.NamingException: Lookup failed for 'com.sac.ParamEJBRemote'
in SerialContext[myEnv={
org.omg.CORBA.ORBInitialPort=3700,
java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory,
org.omg.CORBA.ORBInitialHost=svr-ejb,
java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl,
java.naming.factory.url.pkgs=com.sun.enterprise.naming
}
[Root exception is javax.naming.NameNotFoundException: com.sac.ParamEJBRemote not found]

If I deploy the ejbs in the web machine y redeploy the webapp on it.. the lookup responds succesfully
If I then undeploy the ejbs off the web machine, the lookup still reponds succesfully
If I then redeploy the webapp in the web machine (now without the ejbs deployed on it).. I get the NameNotFoundException again

why is this behavior? do I always need to deploy the ejbs prevously in the same jvm (instance) where I deploy the webapp? the lookup is for localhost? the ORBInitialHost and ORBInitialPort parameters are ignored? my idea is left the applications separate in different instances.

I have tried the alternative in glassfish-web.xml with the syntax corbaname:iiop:host:port#a/b/Foo as shown here:
http://docs.oracle.com/cd/E19798-01/821-1752/beanv/index.html
but without luck.. then I tried the looup version

thanks in advance

matrixV