users@glassfish.java.net

[Glassfish 3.1.1] doing a lookup in a remote EJB

From: <forums_at_java.net>
Date: Fri, 19 Aug 2011 11:43:18 -0500 (CDT)

I'm running an EJB on Glassfish 3.1.1 and I'm trying do a lookup on a remote
EJB via:

[code]

    @PostConstruct

    public void postConstruct() {

        String iiophost = System.getProperty("iiop.host"); //these are
set on the appserver

        String iiopport = System.getProperty("iiop.port");

        if (null == iiophost) {

            throw new EJBException("Missing system property
com.lexi.limsds.iiop.host!");

        }

        if (null == iiopport) {

            iiopport = "3700";

        }

        try {

            Properties props = new Properties();

            props.setProperty("org.omg.CORBA.ORBInitialHost",
iiophost);

            props.setProperty("org.omg.CORBA.ORBInitialPort",
iiopport);

            InitialContext ic = new InitialContext(props);

            Foo foo = (Foo) ic.lookup("com.mydomain.Foo");

        } catch (NamingException ex) {

            throw new EJBException(ex);

        }

[/code]

 

However the on ic.lookup call, I'm getting this error:

[code]

Caused by: javax.ejb.EJBException: javax.naming.NamingException: Lookup
failed for 'com.mydomain.Foo' in
SerialContext[myEnv={org.omg.CORBA.ORBInitialPort=3700,
java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory,
org.omg.CORBA.ORBInitialHost=machine1.foobar.com,
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.NamingException: Unable to acquire SerialContextProvider for
SerialContext[myEnv={org.omg.CORBA.ORBInitialPort=3700,
java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory,
org.omg.CORBA.ORBInitialHost=machine1.foobar.com,
java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl,
java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is
java.lang.ClassCastException]]

at com.mydomain.ejb.NewSessionBean.postConstruct(NewSessionBean.java:61)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at
com.sun.ejb.containers.interceptors.BeanCallbackInterceptor.intercept(InterceptorManager.java:1009)

at
com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:65)

at
com.sun.ejb.containers.interceptors.CallbackInvocationContext.proceed(CallbackInvocationContext.java:113)

at
com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCallback(SystemInterceptorProxy.java:138)

at
com.sun.ejb.containers.interceptors.SystemInterceptorProxy.init(SystemInterceptorProxy.java:120)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at
com.sun.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:964)

at
com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:65)

at
com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:393)

at
com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:376)

at
com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:526)

[/code]

I'm not sure what I'm doing wrong, the only thing I can think of is the
remote EJB is running on a Glassfish 2.1.1 server.  Is that not possbile? I
know the remote EJB on Glassfish 2.1.1 is using EJB 3.0.  

Thanks,

Jerry

 


--
[Message sent by forum member 'djgerbavore']
View Post: http://forums.java.net/node/835539