users@glassfish.java.net

[gf-users] Re: Local EJB call after any remote invocation

From: Reza Rahman <reza.rahman_at_oracle.com>
Date: Wed, 1 Oct 2014 21:02:19 -0700

This might be a subtle bug. I would isolate to a small reproducible example and file it. In the meanwhile, hope you've made sure you are simply not accidentally using the wrong 'ctx' reference? Maybe worthwhile to rename variables and maybe try passing in empty properties?

Sent from my iPhone

> On Oct 1, 2014, at 11:48 AM, Eugeny Balakhonov <c0ff75_at_gmail.com> wrote:
>
> Hello
>
> I have two Glassfish servers. One server mostly work like EJB and web-service server, second mostly work like facade web-server. Web-applications from facade web-server calls EJB beans on first server via their remote interfaces. I call remote EJB's in standard way:
>
> Properties props = new Properties();
> props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.enterprise.naming.SerialInitContextFactory");
> props.setProperty("org.omg.CORBA.ORBInitialHost", "192.168.100.176");
> props.setProperty("org.omg.CORBA.ORBInitialPort", "3701");
> InitialContext ctx = new InitialContext(props);
> this.op_srv = (Operations_ServiceRemote) ctx.lookup(OPERATIONS_SERVICE_NAME);
>
> But in same time I need use JNDI for looking JDBC resources like this:
>
> InitialContext ctx = new InitialContext();
> this.ds = (DataSource) ctx.lookup("jdbc/POOL1");
>
> But if any application on the web-server already called any remote interface then all local JNDI lookup() operations tries to work via remote calls! I.e instead of lookup of the local JDBC pool system tries to find it on the remote server. I have a lot of ClassCastExceptions in the system log file because instead of local interface I receive remote interface.
>
> How to clear EJB call settings before local EJB/JNDI call ?
>
> Thanks for future answers.
>
> Eugeny
>
>