Announcement Announcement Module
Collapse
No announcement yet.
Accessing remote SLSB Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Accessing remote SLSB

    Hi,

    In my current project, When I was try to access a SLSB deployed on a OC4J application server from another OC4J container, I get the RMIConnectionException: Server Shutdown. I have tried access the same SLSB using tradiational way, it works fine. The following are the details:

    Applicationcontext.xml

    <beans>
    <bean id="asdJndiTemplate"
    class="org.springframework.jndi.JndiTemplate">
    <property name="environment">
    <props>
    <prop key="java.naming.factory.initial">com.evermind.ser ver.rmi.RMIInitialContextFactory</prop>
    <prop key="java.naming.provider.url">ormi://panther:23791/DPDQ</prop>
    <prop key="java.naming.security.principal">admin</prop>
    <prop key="java.naming.security.credentials">password</prop>
    <prop key="dedicated.connection">true</prop>
    </props>
    </property>
    </bean>
    <bean id="asdRMISocInfoService"
    class="org.springframework.ejb.access.SimpleRemote StatelessSessionProxyFactoryBean">
    <property name="jndiName">
    <value>EjbCommandHub</value>
    </property>
    <property name="jndiTemplate">
    <ref local="asdJndiTemplate" />
    </property>
    <property name="homeInterface">
    <value>net.quarksys.common.framework.business.EjbC ommandHubHome</value>
    </property>
    <property name="businessInterface">
    <value>net.quarksys.service.interfaces.CommandHand ler</value>
    </property>
    </bean>
    ...
    <beans>



    Error log

    2005-06-04 11:28:22,083 [HttpRequestHandler-11178268] DEBUG org.springframework.jndi.JndiTemplate - - Looking up JNDI object with name [EjbCommandHub]
    2005-06-04 11:28:22,089 [HttpRequestHandler-11178268] DEBUG org.springframework.ejb.access.SimpleRemoteStatele ssSessionProxyFactoryBean - - Located object with JNDI name [EjbCommandHub]
    2005-06-04 11:28:22,090 [HttpRequestHandler-11178268] DEBUG org.springframework.core.CollectionFactory - - Creating java.util.IdentityHashMap
    2005-06-04 11:28:22,090 [HttpRequestHandler-11178268] DEBUG org.springframework.aop.framework.ProxyFactory - - Added new aspect interface: ca.gc.sdc.isp.ws.service.interfaces.SocInfoService IF
    2005-06-04 11:28:22,090 [HttpRequestHandler-11178268] DEBUG org.springframework.aop.framework.JdkDynamicAopPro xy - - Creating JDK dynamic proxy
    2005-06-04 11:28:22,090 [HttpRequestHandler-11178268] DEBUG org.springframework.beans.factory.support.DefaultL istableBeanFactory - - Invoking BeanPostProcessors after initialization of bean 'asdRMISocInfoService'
    2005-06-04 11:28:22,090 [HttpRequestHandler-11178268] DEBUG org.springframework.beans.factory.support.DefaultL istableBeanFactory - - Calling code asked for FactoryBean instance for name 'asdRMISocInfoService'
    2005-06-04 11:28:22,090 [HttpRequestHandler-11178268] DEBUG org.springframework.beans.factory.support.DefaultL istableBeanFactory - - Returning cached instance of singleton bean 'asdRMISocInfoService'
    2005-06-04 11:28:22,091 [HttpRequestHandler-11178268] DEBUG org.springframework.beans.factory.support.DefaultL istableBeanFactory - - Bean with name 'asdRMISocInfoService' is a factory bean
    .....
    2005-06-04 11:28:22,093 [HttpRequestHandler-11178268] DEBUG org.springframework.ejb.access.SimpleRemoteStatele ssSessionProxyFactoryBean - - Trying to create reference to remote EJB
    2005-06-04 11:28:52,095 [HttpRequestHandler-11178268] DEBUG org.springframework.remoting.rmi.RmiClientIntercep torUtils - - Remote service [EjbCommandHub] threw exception
    com.evermind.server.rmi.RMIConnectionException: Server shutdown
    at com.evermind.server.rmi.RemoteInvocationHandler.in voke(RemoteInvocationHandler.java:50)
    at com.evermind.server.rmi.RecoverableRemoteInvocatio nHandler.invoke(RecoverableRemoteInvocationHandler .java:22)
    at __Proxy0.create(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.springframework.ejb.access.AbstractSlsbInvoker Interceptor.create(AbstractSlsbInvokerInterceptor. java:174)
    at org.springframework.ejb.access.AbstractRemoteSlsbI nvokerInterceptor.newSessionBeanInstance(AbstractR emoteSlsbInvokerInterceptor.java:202)
    at org.springframework.ejb.access.SimpleRemoteSlsbInv okerInterceptor.getSessionBeanInstance(SimpleRemot eSlsbInvokerInterceptor.java:108)
    at org.springframework.ejb.access.SimpleRemoteSlsbInv okerInterceptor.doInvoke(SimpleRemoteSlsbInvokerIn terceptor.java:74)
    at org.springframework.ejb.access.AbstractRemoteSlsbI nvokerInterceptor.invoke(AbstractRemoteSlsbInvoker Interceptor.java:114)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :144)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:174)
    ....


    Any idea, Thanks in advance!

    quarksys

  • #2
    I found the cause

    After digging into this problem for a while, I found the cause this problem, here is the detail:
    In the JndiTemplate classe, when the lookup method is called, the Initial Context is created, run the lookup and then close the context. I guess because the connection is closed, when later on the proxy trying to create the bean using this hoem object, it could not connect to the remote JVM and the "Server Shutdown" exception is thrown.
    Now my question is, is this a bug of OC4J or Spring, and what's the best work around for this...

    Thanks!

    Comment


    • #3
      Seems weird to me. Maybe it helps if you disable the caching of the home interface in your SimpleRemoteStatelessSessionProxyFactoryBean?

      Regards,
      Andreas

      Comment


      • #4
        Actually I did try to disable the home interface caching, but I got the same result. Now I'm more leaning to that this is a bug/issue of thr RMI implementation from OC4J. I will try to do the same using WebSphere and WebLogic over this weekend to see if there is anything differences

        Thanks for the suggestion Andreas!

        Comment


        • #5
          I got exactly the same error while trying to access remote SLSB at OC4J apps server.
          May I know how could I disable the caching of the home interface?
          So quarksys did you found any workaround to resolve this issue?

          Thanks in advance for any help.

          Comment


          • #6
            I modified the source code in Spring for now.
            File: org.springframework.jndi.JndiTemplate, inside method execute:

            change the line of
            ctx.close();
            to
            if(false)
            ctx.close();

            You can make this behavior configurable by adding a flag. But still, I would consider this a temp solution. I'm not sure not closing the Intial Context could cause any problem.

            Hope helps

            Comment


            • #7
              I'd like to propose another workaround solution which does not require Spring code being modified.

              Just subclass JndiTemplate and overwrite the "createInitialContext" method.
              The overwritten method should obtain the Context from the original implementation and wrap it into an own "Context" subclass instance which just delegates all methods and just ignores invocations of "close".

              So, when the bug might be fixed, you can just change your configuration (and don't have to patch each Spring version to come before).

              Regards,
              Andreas

              Comment

              Working...
              X