Mantis - Resin
Viewing Issue Advanced Details
1739 minor always 05-16-07 23:53 05-31-07 16:30
hazurek  
ferg  
normal  
closed 3.0.19  
fixed  
none    
none 3.1.2  
0001739: Using jndi-link instead of direct using Properties is not working when connecting to Glassfish.
I try to connect from Resin to Remote EJB 3.0 deployed at Glassfish.
I follow instructions at https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#nonJavaEEwebcontainerRemoteEJB. [^]

So when I use properties when constructing InitialContext:

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

    Context ic2 = (Context)new InitialContext(props);
    EJBKESessionFacade facade = (EJBKESessionFacade)ic2.lookup("test.EJBKESessionFacade");

all is working.

But when I try to use jndi-link at resin.conf:

        <jndi-link>
          <jndi-name>java:comp/env/ejb</jndi-name>
          <factory>com.sun.enterprise.naming.SerialInitContextFactory</factory>
        <init-param java.naming.factory.url.pkgs="com.sun.enterprise.naming"/>
        <init-param java.naming.factory.state="com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl"/>
        </jndi-link>

and

    Context ic2 = (Context)new InitialContext().lookup("java:comp/env/ejb");

(EJBKESessionFacade)ic2.lookup("com.sitronicsts.ngage.ke.datalayer.core.EJBKESessionFacade");

I get exception

java.lang.NullPointerException
    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:585)
    at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:346)
    at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:61)
    at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
    at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:331)
    at com.caucho.naming.ContextImpl.lookupImpl(ContextImpl.java:214)
    at com.caucho.naming.ContextImpl.lookup(ContextImpl.java:168)
    at javax.naming.InitialContext.lookup(InitialContext.java:351)
    at com.caucho.naming.LinkProxy.createObject(LinkProxy.java:181)
    at com.caucho.naming.ContextImpl.dereference(ContextImpl.java:585)
    at com.caucho.naming.ContextImpl.lookupImpl(ContextImpl.java:209)
    at com.caucho.naming.ContextImpl.lookup(ContextImpl.java:168)
    at _jsp._test__jsp._jspService(test.jsp:42)
    at com.caucho.jsp.JavaPage.service(JavaPage.java:60)
    at com.caucho.jsp.Page.pageservice(Page.java:570)
    at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:175)
    at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:178)
    at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
    at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:268)
    at com.caucho.server.port.TcpConnection.run(TcpConnection.java:389)
    at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:507)
    at com.caucho.util.ThreadPool.run(ThreadPool.java:433)
    at java.lang.Thread.run(Thread.java:595)

Environment entries of created context are:

java.naming.factory.initial=com.caucho.naming.InitialContextFactoryImpl

java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl:com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl:com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl:com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl

java.naming.factory.url.pkgs=com.caucho.naming:com.sun.enterprise.naming:com.sun.enterprise.naming:com.sun.enterprise.naming:com.sun.enterprise.naming

If I change code to

    Context ic2 = (Context)new InitialContext().lookup("java:comp/env/ejb");

        ic2.addToEnvironment("java.naming.factory.initial",
                "com.sun.enterprise.naming.SerialInitContextFactory");

(EJBKESessionFacade)ic2.lookup("com.sitronicsts.ngage.ke.datalayer.core.EJBKESessionFacade");


it is working.

What could be the problem?

Notes
(0001987)
ferg   
05-31-07 16:30   
server/4401