Thank you Andreas, but this does not solve my problem (just tried it).
These settings are the defaults for GF3 (so implicit i use the same
settings in my sample).
You are able to call a remote EJB *deployed on GF2* from a web
application *deployed on GF 3*?
If yes, can you give me some details?
Kind Regards,
Ronald
Andreas Kozma wrote:
> Ronald,
>
> we use the following settings for GFv2 and GFv3:
>
> final 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");
>
> // Only needed if server is running on a different host than localhost:
> if (!getServerWrapper().isEmpty())
> props.setProperty("org.omg.CORBA.ORBInitialHost", getServer());
> // Optional. Defaults to 3700. Only needed if target orb port is
> not 3700.
> if (!StringUtils.isEmpty(getPortNumber()))
> props.setProperty("org.omg.CORBA.ORBInitialPort", getPortNumber());
>
>
>
> props.setProperty("com.sun.appserv.iiop.orbconnections","5");
>
>
>
> Kind regards,
>
> - Andreas Kozma
> www.ansis.com <http://www.ansis.com>
>
>
> On Jul 1, 2010, at 10:47 , Ronald Muller wrote:
>
>> I reduced this problem to a very simple "Hello World" sample:
>>
>> 1) A library jar with one Remote interface (InterfaceEJB.jar):
>>
>> public interface SimpleEJBRemote {
>>
>> String hello();
>>
>> }
>>
>> 2) An Enterprise Application (ear) deployed on SERVER1 with an EJB
>> Module (EJBModule.ear containing /lib/InterfaceEJB.jar and
>> EJBModule.jar) and a SLSB:
>>
>> @Stateless
>> @Remote(value=SimpleEJBRemote.class)
>> public class SimpleEJBBean implements SimpleEJBRemote {
>>
>> @Override
>> public String hello() {
>> return "Hello world...";
>> }
>>
>> }
>>
>> 3) A Web Application (WebRemote.war) deployed on SERVER2 containing
>> WEB-INF/lib/InterfaceEJB.jar and a servlet, calling the remote EJB:
>>
>> public class SimpleServlet extends HttpServlet {
>>
>> private SimpleEJBRemote _remoteService;
>>
>> public SimpleServlet() {
>> try {
>> final Properties env = new Properties();
>> env.setProperty("org.omg.CORBA.ORBInitialHost", 127.0.0.1");
>> env.setProperty("org.omg.CORBA.ORBInitialPort", "3100");
>> InitialContext context = new InitialContext(env);
>> // all fail ..
>> _remoteService = (SimpleEJBRemote) context.lookup(
>> SimpleEJBRemote.class.getCanonicalName());
>> //"SimpleEJBRemote");
>> //"java:global/SimpleEJBBean");
>> //"java:global/EJBModule/EJBModule-ejb/SimpleEJBBean");
>> } catch (Exception ex) {
>> ex.printStackTrace();
>> }
>> }
>>
>> ... standard code
>> }
>>
>> I get the following exception:
>> javax.naming.NamingException: Lookup failed for
>> 'sample.SimpleEJBRemote' in SerialContext
>> targetHost=127.0.0.1,targetPort=3100,orb'sInitialHost=127.0.1.1,orb'sInitialPort=4037
>> [Root exception is javax.naming.NamingException: Unable to acquire
>> SerialContextProvider for SerialContext
>> targetHost=127.0.0.1,targetPort=3100,orb'sInitialHost=127.0.1.1,orb'sInitialPort=4037
>> [Root exception is java.lang.ClassCastException]]
>> at
>> com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442)
>> ...
>> Caused by: java.lang.ClassCastException: Object is not of remote type
>> com.sun.enterprise.naming.impl.SerialContextProvider
>> at
>> com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:250)
>>
>> If i change the lookup code to:
>> InitialContext context = new InitialContext();
>> _remoteService = (SimpleEJBRemote)
>> context.lookup("corbaname:iiop:127.0.0.1:3100#sample.SimpleEJBRemote");
>>
>> I get the following exception:
>> javax.naming.NameNotFoundException [Root exception is
>> org.omg.CosNaming.NamingContextPackage.NotFound:
>> IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
>> at
>> com.sun.jndi.cosnaming.ExceptionMapper.mapException(ExceptionMapper.java:44)
>> ...
>> Caused by: org.omg.CosNaming.NamingContextPackage.NotFound:
>> IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
>> at
>> org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72)
>>
>> If I use GF 2.1.1 for both SERVER1 and SERVER2, everthing goes well
>> If I use GF 3.0.1 for both SERVER1 and SERVER2, everthing goes well
>> The exceptions occurs when SERVER1 is GF 2 and SERVER2 is GF 3
>>
>> Who knows what I am doing wrong??
>>
>> Regards,
>>
>> Ronald
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ejb-unsubscribe_at_glassfish.dev.java.net
>> <mailto:ejb-unsubscribe_at_glassfish.dev.java.net>
>> For additional commands, e-mail: ejb-help_at_glassfish.dev.java.net
>> <mailto:ejb-help_at_glassfish.dev.java.net>
>>
>>
>> --
>> This message has been scanned for viruses and
>> dangerous content by MailScanner, and is
>> believed to be clean.
>>
>
--
XIAM Solutions B.V.
http://www.xiam.nl
KvK 39 07 99 39
Per 1 april 2010:
Huis ter Heideweg 46
3705 LZ Zeist
Tel +31 (0)30 697 32 88
Opmerking:
De informatie verzonden met dit e-mailbericht is uitsluitend bestemd
voor de geadresseerde. Indien u als lezer van deze mededeling niet de
geadresseerde bent, wordt u er hierbij op gewezen, dat u geen recht hebt
kennis te nemen van dit bericht, het te kopiëren of te verstrekken aan
derden. Indien u deze e-mail abusievelijk hebt ontvangen, wordt u
verzocht de afzender hiervan in kennis te stellen en dit bericht te wissen.
XIAM Solutions B.V. is niet verantwoordelijk voor de gevolgen van en
wijst iedere aansprakelijkheid af in verband met eventuele schade van
een (on)juiste en (on)volledige verzending en ontvangst van de inhoud
van deze e-mail en eventuele bijlage(n).