users@glassfish.java.net

GF 3.1.1: How to access EJB in GF 2.1.1?

From: Bernhard Thalmayr <bernhard.thalmayr_at_painstakingminds.com>
Date: Thu, 8 Dec 2011 17:08:29 +0100

Hi experts,

sorry if this has been asked serveral times already, but I could not find
any hint googling around and the EJB faq does not talk about this topic :-(

What must be done so that a client receiding within GF 3.1.1 can access an
EJB receiding in GF 2.1.1?

Without doing anything special I get a 'ClassCastExcetion'

Samplecode to access the remote EJB is the one from the EJB faq ...



     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");


  // optional. Defaults to localhost. Only needed if web server is
running
  // on a different host than the appserver
  props.setProperty("org.omg.CORBA.ORBInitialHost", <somehost>);

  // optional. Defaults to 3700. Only needed if target orb port is not
3700.
  props.setProperty("org.omg.CORBA.ORBInitialPort", <someport>);



     FooRemoteBusiness foo = (FooRemoteBusiness)
ic.lookup(<non-portable-jndi-name>);


TIA,
Bernhard

-- 
IT-Consulting Bernhard Thalmayr
- Painstaking Minds -
83620 Vagen (Munich area)
Germany