Announcement Announcement Module
Collapse
No announcement yet.
rmi socket write error with tomcat Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • rmi socket write error with tomcat

    hi,
    The rmi server work well,
    my rmi test client run well ( a simple java program) ,
    In a jsp file, I test the method getPhotoByLogin of the service ServiceUserInterface as:
    Code:
    ServletContext servletCtx = session.getServletContext();
    ApplicationContext springCtx = WebApplicationContextUtils.getWebApplicationContext(servletCtx);
    ServiceUserInterface userService = (ServiceUserInterface) springCtx.getBean(Constant.BEAN_USER);
    userService.getPhotoByLogin("superadmin");
    and it's good,
    but in my controller ,with the same code
    Code:
            ServletOutputStream out = response.getOutputStream();
    	ServletContext servletCtx = request.getSession().getServletContext();
    		ApplicationContext springCtx = WebApplicationContextUtils.getWebApplicationContext(servletCtx);
    		ServiceUserInterface sUser = (ServiceUserInterface) springCtx.getBean(Constant.BEAN_USER);
    		byte[] b = new byte[0];
    		try {
    			if (login != null && login.length() != 0) {
    				b = sUser.getPhotoByLogin(login);
    				out.write(b);
    			}
    		} catch (RuntimeException ex) {
    			ex.printStackTrace();


    I have this error:
    Code:
    04/06/2007 15:31:31  WARN [http-8080-Processor25] (RmiClientInterceptor.java:300) - Could not connect to RMI service [rmi://D02DI060131880:9000/UserService] - retrying
    org.springframework.remoting.RemoteConnectFailureException: Cannot connect to remote service [rmi://D02DI060131880:9000/UserService]; nested exception is java.rmi.MarshalException: error marshalling arguments; nested exception is: 
    	java.net.SocketException: Software caused connection abort: socket write error
    Caused by: java.rmi.MarshalException: error marshalling arguments; nested exception is: 
    	java.net.SocketException: Software caused connection abort: socket write error
    	at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
    	at org.springframework.remoting.rmi.RmiInvocationWrapper_Stub.invoke(Unknown Source)
    	at org.springframework.remoting.rmi.RmiClientInterceptor.doInvoke(RmiClientInterceptor.java:400)
    	at org.springframework.remoting.rmi.RmiClientInterceptor.doInvoke(RmiClientInterceptor.java:344)
    	at org.springframework.remoting.rmi.RmiClientInterceptor.refreshAndRetry(RmiClientInterceptor.java:330)
    	at org.springframework.remoting.rmi.RmiClientInterceptor.handleRemoteConnectFailure(RmiClientInterceptor.java:302)
    	at org.springframework.remoting.rmi.RmiClientInterceptor.invoke(RmiClientInterceptor.java:262)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:209)
    	at $Proxy5.getPhotoByLogin(Unknown Source)
    	at eu.cec.sanco.Image.doGet(Image.java:61)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
    	at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
    	at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
    	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    	at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110)
    	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    	at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:217)
    	at eu.cec.sanco.SaasCasProcessingFilter.doFilter(SaasCasProcessingFilter.java:45)
    	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    	at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:229)
    	at eu.cec.sanco.SaasHttpSessionContextIntegrationFilter.doFilter(SaasHttpSessionContextIntegrationFilter.java:46)
    	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    	at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
    	at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
    	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
    	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    	at java.lang.Thread.run(Thread.java:595)
    Caused by: java.net.SocketException: Software caused connection abort: socket write error
    	at java.net.SocketOutputStream.socketWrite0(Native Method)
    	at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
    	at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
    	at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
    	at java.io.BufferedOutputStream.write(BufferedOutputStream.java:109)
    	at java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStream.java:1676)
    	at java.io.ObjectOutputStream$BlockDataOutputStream.writeByte(ObjectOutputStream.java:1714)
    	at java.io.ObjectOutputStream.writeFatalException(ObjectOutputStream.java:1391)
    	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:294)
    	at sun.rmi.server.UnicastRef.marshalValue(UnicastRef.java:258)
    	at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:117)
    	... 42 more

    So, I call the same remote methode in the same context but it's run in the jsp file and don't run in the controller,
    a idea ?
    Thanks

  • #2
    i use -Djava.rmi.server.logCalls=true to see log in the rmi server :
    Code:
    FINER: RMI TCP Connection(6)-158.166.194.209: [158.166.194.209: org.springframework.remoting.rmi.RmiInvocationWrapper[2]: public abstract java.lang.Object org.s
    pringframework.remoting.rmi.RmiInvocationHandler.invoke(org.springframework.remoting.support.RemoteInvocation) throws java.rmi.RemoteException,java.lang.NoSuchM
    ethodException,java.lang.IllegalAccessException,java.lang.reflect.InvocationTargetException]
    Jun 4, 2007 5:16:03 PM sun.rmi.server.UnicastServerRef logCallException
    FINE: RMI TCP Connection(6)-158.166.194.209: [158.166.194.209] exception:
    java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
            at java.lang.Class.getDeclaredMethods0(Native Method)
            at java.lang.Class.privateGetDeclaredMethods(Class.java:2365)
            at java.lang.Class.getDeclaredMethod(Class.java:1907)
            at java.io.ObjectStreamClass.getPrivateMethod(ObjectStreamClass.java:1327)
            at java.io.ObjectStreamClass.access$1600(ObjectStreamClass.java:47)
            at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:394)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:373)
            at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:268)
            at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:504)
            at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
            at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
            at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
            at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
            at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
            at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
            at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
            at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
            at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
            at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:290)
            at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:279)
            at sun.rmi.transport.Transport$1.run(Transport.java:153)
            at java.security.AccessController.doPrivileged(Native Method)
            at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
            at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
            at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
            at java.lang.Thread.run(Thread.java:595)
    Jun 4, 2007 5:16:03 PM sun.rmi.server.UnicastServerRef logCall
    FINER: RMI TCP Connection(4)-158.166.194.209: [158.166.194.209: sun.rmi.registry.RegistryImpl[0:0:0, 0]: java.rmi.Remote lookup(java.lang.String)]
    Jun 4, 2007 5:16:03 PM sun.rmi.server.UnicastServerRef logCall
    FINER: RMI TCP Connection(7)-158.166.194.209: [158.166.194.209: org.springframework.remoting.rmi.RmiInvocationWrapper[2]: public abstract java.lang.Object org.s
    pringframework.remoting.rmi.RmiInvocationHandler.invoke(org.springframework.remoting.support.RemoteInvocation) throws java.rmi.RemoteException,java.lang.NoSuchM
    ethodException,java.lang.IllegalAccessException,java.lang.reflect.InvocationTargetException]
    Jun 4, 2007 5:16:03 PM sun.rmi.server.UnicastServerRef logCallException
    FINE: RMI TCP Connection(7)-158.166.194.209: [158.166.194.209] exception:
    java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
            at java.lang.Class.getDeclaredMethods0(Native Method)
            at java.lang.Class.privateGetDeclaredMethods(Class.java:2365)
            at java.lang.Class.getDeclaredMethod(Class.java:1907)
            at java.io.ObjectStreamClass.getPrivateMethod(ObjectStreamClass.java:1327)
            at java.io.ObjectStreamClass.access$1600(ObjectStreamClass.java:47)
            at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:394)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:373)
            at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:268)
            at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:504)
            at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
            at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
            at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
            at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
            at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
            at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
            at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
            at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
            at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
            at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:290)
            at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:279)
            at sun.rmi.transport.Transport$1.run(Transport.java:153)
            at java.security.AccessController.doPrivileged(Native Method)
            at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
            at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
            at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
            at java.lang.Thread.run(Thread.java:595)
    Jun 4, 2007 5:16:35 PM sun.rmi.server.UnicastServerRef logCall
    FINER: RMI TCP Connection(8)-158.166.194.209: [158.166.194.209: sun.rmi.transport.DGCImpl[0:0:0, 2]: void clean(java.rmi.server.ObjID[], long, java.rmi.dgc.VMID
    , boolean)]
    I don't understand why the rmi server needs the servlet classes ???!!!

    Comment


    • #3
      More info about the problem.
      I use acegi, and the Securitycontext is propagated to the server .
      In my client context I have this
      Code:
      <bean id="remoteInvocationFactory" class="org.acegisecurity.context.rmi.ContextPropagatingRemoteInvocationFactory" />
      So when I 'm not authenticated (this is the case in the jsp) acegi context isn't propagated,
      but when I 'm authenticated (with a cas server), the SecurityContext is propagated to the server and so I have the error
      java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest

      Comment


      • #4
        more info

        The security context propagated to the rmi server use the class "WebAuthenticationDetails" whitch import "javax.servlet.http.HttpServletRequest".

        When I had in the classpath of the rmi server the servlet classes, all run fine,
        but I think it's abnormal to do this ...............no ?

        Comment

        Working...
        X