Announcement Announcement Module
Collapse
No announcement yet.
SimpleRemoteStatelessSessionProxyFactoryBean reconnect issue in OC4J Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SimpleRemoteStatelessSessionProxyFactoryBean reconnect issue in OC4J

    We're using Spring's SimpleRemoteStatelessSessionProxyFactoryBean in an OC4J (10.1.3.2) environment and it seems to be working great with one significant exception... If we restart the EJB application, redeploy the EJB application, or restart the container that the EJB application is running in without restarting the EJB client application then the EJB client is unable to reconnect.

    I saw that an OC4J specific reconnect issue was logged in jira (http://jira.springframework.org/browse/SPR-3113) and was fixed in 2.0.3. Could this be another OC4J related issue?

    If we restart the EJB application's container or redeploy the EJB application we get...

    Code:
    java.lang.ClassCastException: __Proxy6
            at __Proxy3.create(Unknown Source)
            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 org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.create(AbstractSlsbInvokerInterceptor.java:177)
            at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.newSessionBeanInstance(AbstractRemoteSlsbInvokerInterceptor.java:205)
            at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.getSessionBeanInstance(SimpleRemoteSlsbInvokerInterceptor.java:108)
            at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.doInvoke(SimpleRemoteSlsbInvokerInterceptor.java:74)
            at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.invoke(AbstractRemoteSlsbInvokerInterceptor.java:119)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
            at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
            at $Proxy1.execute(Unknown Source)
            at vanderbilt.norm.ejb.EjbInvokerServlet.doPost(EjbInvokerServlet.java:43)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
            at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
            at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
            at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
            at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
            at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
            at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
            at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
            at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
            at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
            at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
            at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
            at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
            at java.lang.Thread.run(Thread.java:613)
    If we restart the EJB application we get...

    Code:
    org.springframework.remoting.RemoteAccessException: Could not access remote service [EjbTestBean]; nested exception is oracle.oc4j.rmi.OracleRemoteException: Application was stopped
            at org.springframework.remoting.rmi.RmiClientInterceptorUtils.convertRmiAccessException(RmiClientInterceptorUtils.java:181)
            at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.doInvoke(SimpleRemoteSlsbInvokerInterceptor.java:84)
            at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.invoke(AbstractRemoteSlsbInvokerInterceptor.java:119)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
            at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
            at $Proxy3.execute(Unknown Source)
            at vanderbilt.norm.ejb.EjbInvokerServlet.doPost(EjbInvokerServlet.java:43)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
            at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
            at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
            at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
            at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
            at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
            at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
            at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
            at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
            at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
            at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
            at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
            at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
            at java.lang.Thread.run(Thread.java:613)
    Caused by: oracle.oc4j.rmi.OracleRemoteException: Application was stopped
            at com.evermind.server.rmi.RMICall.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(RMICall.java:109)
            at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:125)
            at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:517)
            at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:461)
            at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
            at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
            at __Proxy11.create(Unknown Source)
            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 org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.create(AbstractSlsbInvokerInterceptor.java:177)
            at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.newSessionBeanInstance(AbstractRemoteSlsbInvokerInterceptor.java:205)
            at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.getSessionBeanInstance(SimpleRemoteSlsbInvokerInterceptor.java:108)
            at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.doInvoke(SimpleRemoteSlsbInvokerInterceptor.java:74)
            ... 20 more
    Here is my spring config...

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    
    <beans>
       <bean id="ejbTest" lazy-init="true"
          class="org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean">
          <property name="jndiName">
             <value>EjbTestBean</value>
          </property>
          <property name="businessInterface">
             <value>vanderbilt.norm.ejb.IEjbTest</value>
          </property>
          <property name="jndiEnvironment">
             <props>
                <prop key="java.naming.factory.initial">com.evermind.server.rmi.RMIInitialContextFactory</prop>
                <prop key="java.naming.provider.url">opmn:ormis://oas21ld-vm.mc.vanderbilt.edu:6003:OC4J_coredata/ejb-ear</prop>
                <prop key="java.naming.security.principal">jazn.com/rmiuser</prop>
                <prop key="java.naming.security.credentials">password</prop>
             </props>
          </property>
          <property name="refreshHomeOnConnectFailure">
             <value>true</value>
          </property>
       </bean>
    </beans>

  • #2
    This is odd...

    So in looking at the AbstractRemoteSlsbInvokerInterceptor and SimpleRemoteSlsbInvokerInterceptor code it looks like in this particular case it is not detecting this as a "connect failure" and triggering the "refreshAndRetry" logic. I looked at RmiClientInterceptorUtils.isConnectFailure and it looks like it already has one OC4J related tweak (introduced in Spring 2.0.3) and I was thinking maybe this might be a new case (possibly introduced by changes in newer versions of OC4J). So with that in mind I extended SimpleRemoteStatelessSessionProxyFactoryBean and overrode isConnectFailure as follows:

    Code:
      @Override
      protected boolean isConnectFailure(RemoteException inEx)
      {
        return super.isConnectFailure(inEx) ||
        "oracle.oc4j.rmi.OracleRemoteException".equals(inEx.getClass().getName());
      }
    With this change it detects this situation as a "connect failure" and starts into the "refreshAndRetry" logic. I see it refresh home but when it tries to invoke the create method on the newly obtained home I get...

    Code:
    java.lang.IllegalArgumentException: object is not an instance of declaring class
        at com.evermind.server.rmi.RMICall.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(RMICall.java:109)
        at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:125)
        at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:517)
        at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:461)
        at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
        at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
        at __Proxy9.create(Unknown Source)
        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 org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.create(AbstractSlsbInvokerInterceptor.java:177)
        at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.newSessionBeanInstance(AbstractRemoteSlsbInvokerInterceptor.java:205)
        at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.getSessionBeanInstance(SimpleRemoteSlsbInvokerInterceptor.java:108)
        at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.doInvoke(SimpleRemoteSlsbInvokerInterceptor.java:74)
        at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.refreshAndRetry(AbstractRemoteSlsbInvokerInterceptor.java:175)
        at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.handleRemoteConnectFailure(AbstractRemoteSlsbInvokerInterceptor.java:153)
        at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.invoke(AbstractRemoteSlsbInvokerInterceptor.java:122)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy1.execute(Unknown Source)
        at vanderbilt.norm.ejb.EjbInvokerServlet.doPost(EjbInvokerServlet.java:43)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
        at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
        at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
        at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
        at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
        at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
        at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
        at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
        at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
        at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
        at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
        at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
        at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
        at java.lang.Thread.run(Thread.java:613)

    Comment


    • #3
      Disabling cacheing of the home interface doesn't seem to help

      It looks likes disabling caching of the home interface doesn't seem to solve the issue either. With home interface caching disabled it still throws the IllegalArgumentException when the client tries to call the home's create method after an EJB application restart.

      Comment


      • #4
        We are seeing pretty much the same problem as seen from the remote service:

        java.lang.Throwable: EJB Exception: : java.lang.IllegalArgumentException: java.lang.ClassCastException@1c22988
        at com.evermind.server.rmi.RMICall.EXCEPTION_ORIGINAT ES_FROM_THE_REMOTE_SERVER(RMICall.java:110)
        at com.evermind.server.rmi.RMICall.throwRecordedExcep tion(RMICall.java:128)
        at com.evermind.server.rmi.RMIClientConnection.obtain RemoteMethodResponse(RMIClientConnection.java:472)
        at com.evermind.server.rmi.RMIClientConnection.invoke Method(RMIClientConnection.java:416)
        at com.evermind.server.rmi.RemoteInvocationHandler.in voke(RemoteInvocationHandler.java:63)
        at com.evermind.server.rmi.RecoverableRemoteInvocatio nHandler.invoke(RecoverableRemoteInvocationHandler .java:28)
        at __Proxy6.create(Unknown Source)

        Any news on this?

        Comment


        • #5
          I have the same problem... any one??

          oc4j version: 10.1.3.4

          Code:
          Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
          	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.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:53)
          	at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
          	at java.lang.Thread.run(Thread.java:595)
          	at com.evermind.server.rmi.RMICall.warningExceptionOriginatesFromTheRemoteServer(RMICall.java:109)
          	at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:129)
          	at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:571)
          	at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:515)
          	at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
          	at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
          	at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
          	at __Proxy1.isOperationAllowed(Unknown Source)

          Comment

          Working...
          X