You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Thomas Darbois <Th...@edifixio.com> on 2008/06/25 10:29:43 UTC

RE: RMI binding and handling Exception

Thanks to Raymond Feng a revision (r671234) has been made for binding rmi and exception.

I've tested it on the small test case I had, it works well.

If you need this change, you don't need to upgrade everything to 1.4-SNAPSHOT, just need to recompile the binding rmi module with the small changed code (available on the svn of tuscany http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIService.java?r1=668359&r2=671234 ), and it is working just fine.


Tomas Darbois
Edifixio Grenoble
thomas.darbois@edifixio.com

-----Message d'origine-----
De : Thomas Darbois [mailto:Thomas.Darbois@edifixio.com]
Envoyé : mardi 24 juin 2008 11:15
À : user@tuscany.apache.org
Objet : RE: RMI binding and handling user defined Exception

A JIRA has been created last week as you asked.

Here is the link:

http://issues.apache.org/jira/browse/TUSCANY-2406

Thanks for your time.

I've tried to reproduce the bug in a small test case that contains junit test. It's using a binding a RMI on port 8081.

Tomas Darbois
Edifixio Grenoble - Projet ScorWare
04 76 29 89 27
thomas.darbois@edifixio.com

-----Message d'origine-----
De : Raymond Feng [mailto:enjoyjava@gmail.com]
Envoyé : mercredi 18 juin 2008 17:30
À : user@tuscany.apache.org
Objet : Re: RMI binding and handling user defined Exception

Hi,

Thank you for reporting the issue. I think it's a bug in the error handling.
Can you open a JIRA so that we can track and fix it?

http://issues.apache.org/jira/browse/TUSCANY

Raymond

--------------------------------------------------
From: "Thomas Darbois" <Th...@edifixio.com>
Sent: Wednesday, June 18, 2008 12:36 AM
To: <us...@tuscany.apache.org>
Subject: RMI binding and handling user defined Exception

>
> Hello all,
> I'm having some trouble with java user defined exception that does not
> propagate correctly through RMI binding. The test is working well when no
> exception is raised behind a RMI binding. (I've simplified it to match a
> simpler case but not removing key element for example:  long package name
> replaced by a short one).
>
> I have a component (n°1) using another component (n°2), which is also
> using another component (n°3). All connexions are done with RMI bindings.
> It might happen that one component is down due to various troubles. Let
> say my last component is down.
>
> The third  component will fail to contact it and raise:
> org.apache.tuscany.sca.host.rmi.RMIHostRuntimeException: Connection
> refused to host: localhost; nested exception is:
> java.net.ConnectException: Connection refused: connect That is normal, in
> my second component  I will catch it without problem and I'm going to
> throw it with my user defined exception : test.UserDefinedException  (an
> user defined public class which extends an user defined public abstract
> class (test.UserAbstractException that extends Exception and Implements
> Serializable)).
>
> Now in my first component, I'm catching this exception (I'm trying to
> catch UserDefinedException but instead I'm getting an other exception that
> was not handled):
>
> It might be a problem caused by the use of user defined exception that is
> not fully defined for tuscany
>
>
> java.lang.reflect.UndeclaredThrowableException
>   at $Proxy10.test2(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.apache.tuscany.sca.binding.rmi.RMIReferenceInvoker.invokeTarget(RMIReferenceInvoker.java:74)
>   at
> org.apache.tuscany.sca.binding.rmi.RMIReferenceInvoker.invoke(RMIReferenceInvoker.java:51)
>   at
> org.apache.tuscany.sca.extension.helper.impl.InvokerProxy.invoke(BindingsActivator.java:252)
>   at
> org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:108)
>   at
> org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:286)
>   at
> org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:154)
>   at $Proxy6.test2(Unknown Source)
>   at compo1.test2a(Compo1.java:93)
>   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.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:109)
>   at
> org.apache.tuscany.sca.binding.sca.impl.SCABindingInvoker.invoke(SCABindingInvoker.java:61)
>   at
> org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:286)
>   at
> org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:154)
>   at $Proxy5.test2a(Unknown Source)
>   at webapp.TestAction.execute(TestAction.java:98)
>   at
> org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
>   at
> org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
>   at
> org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
>   at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
>   at
> org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
>   at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
>   at
> org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
>   at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
>   at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
>   at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
>   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>   at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>   at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>   at
> org.apache.tuscany.sca.host.webapp.TuscanyServletFilter.doFilter(TuscanyServletFilter.java:96)
>   at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>   at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>   at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>   at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
>   at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
>   at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>   at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>   at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>   at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
>   at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
>   at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>   at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>   at java.lang.Thread.run(Thread.java:595)
> Caused by: java.rmi.UnexpectedException: unexpected exception; nested
> exception is:
>   java.lang.reflect.InvocationTargetException
>   at
> java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:198)
>   at
> java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
>   ... 50 more
> Caused by: java.lang.reflect.InvocationTargetException
>   at
> org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker.invoke(RuntimeWireInvoker.java:117)
>   at
> org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker.invoke(RuntimeWireInvoker.java:89)
>   at
> org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker.invoke(RuntimeWireInvoker.java:83)
>   at
> org.apache.tuscany.sca.core.assembly.RuntimeWireImpl.invoke(RuntimeWireImpl.java:134)
>   at
> org.apache.tuscany.sca.binding.rmi.RMIService.invokeTarget(RMIService.java:110)
>   at
> org.apache.tuscany.sca.binding.rmi.RMIService$1.intercept(RMIService.java:95)
>   at
> $java.rmi.server.UnicastRemoteObject$$EnhancerByCGLIB$$a110b00b.test2(<generated>)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>   at java.lang.reflect.Method.invoke(Unknown Source)
>   at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
>   at sun.rmi.transport.Transport$1.run(Unknown Source)
>   at java.security.AccessController.doPrivileged(Native Method)
>   at sun.rmi.transport.Transport.serviceCall(Unknown Source)
>   at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
>   at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown
> Source)
>   at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown
> Source)
>   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
> Source)
>   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>   at java.lang.Thread.run(Unknown Source)
>   at
> sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
>   at
> sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
>   at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
>   at
> java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:179)
>   ... 51 more
> Caused by: test.UserDefinedException : UserAbstractException:
> UserDefinedException  : method test - Recovering from error
>   At test.TestException.test2(TestException.java:110)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>   at java.lang.reflect.Method.invoke(Unknown Source)
>   at
> org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:109)
>   at
> org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:108)
>   at
> org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker.invoke(RuntimeWireInvoker.java:114)
>   at
> org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker.invoke(RuntimeWireInvoker.java:89)
>   at
> org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker.invoke(RuntimeWireInvoker.java:83)
>   at
> org.apache.tuscany.sca.core.assembly.RuntimeWireImpl.invoke(RuntimeWireImpl.java:134)
>   at
> org.apache.tuscany.sca.binding.rmi.RMIService.invokeTarget(RMIService.java:110)
>   at
> org.apache.tuscany.sca.binding.rmi.RMIService$1.intercept(RMIService.java:95)
>   at
> $java.rmi.server.UnicastRemoteObject$$EnhancerByCGLIB$$a110b00b.test2(<generated>)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>   at java.lang.reflect.Method.invoke(Unknown Source)
>   at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
>   at sun.rmi.transport.Transport$1.run(Unknown Source)
>   at java.security.AccessController.doPrivileged(Native Method)
>   at sun.rmi.transport.Transport.serviceCall(Unknown Source)
>   at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
>   at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown
> Source)
>   at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown
> Source)
>   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
> Source)
>   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>   at java.lang.Thread.run(Unknown Source)
>
>
>
>
> Tomas Darbois
> Edifixio Grenoble
>
>