10 Replies Latest reply on May 20, 2015 5:41 PM by ozkin

    Exception delivery to a consumer component

    ozkin

      How to get an exception raised by one component (provider) to be delivered to another component (consumer of the service)?

      I see that exception is intercepted and logged by SY but it is not delivered to the component calling the service and it doesn't know that fault has occurred.

      I am not using Camel, but just Bean components. Do I need to register any handlers?

      Everything is done within one SY application. Just one bean calls another bean.

        • 1. Re: Exception delivery to a consumer component
          ozkin

          I am using SY-1.1.0-Final and curious if it is related to https://issues.jboss.org/browse/SWITCHYARD-1950 ??

          • 2. Re: Exception delivery to a consumer component
            tadayosi

            Check your provider component's MEP to see if it's related to SWITCHYARD-1950. If it's IN_ONLY, it's possible that your issue is related to SWITCHYARD-1950.

            1 of 1 people found this helpful
            • 3. Re: Exception delivery to a consumer component
              ozkin

              Yes, it is IN_ONLY and I have to use the workaround to add a return type.. I assume in SY2.0 it is fixed..

              • 4. Re: Exception delivery to a consumer component
                ozkin

                What if a bean invokes a method of reference interface of, say, SQL reference binding? Such method has no return type. It is also IN_ONLY. How to propagate an exception (in this case some SqlException) from SQL reference binding back to the bean? If I change "void" to some other return type for this method, there will be NullPointerException at run-time...

                • 5. Re: Exception delivery to a consumer component
                  igarashitm

                  I've never seen NPE is thrown when I just change the return type of service operation from void to something else. Can you attach a reproducer?

                  • 6. Re: Exception delivery to a consumer component
                    ozkin

                    I don't have a reproducer at hand, but this is the exception thrown:

                     

                    Caused by: java.lang.NullPointerException

                         at com.sun.proxy.$Proxy51.execute(Unknown Source)

                         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                         at java.lang.reflect.Method.invoke(Method.java:606)

                         at org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:45)

                         at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105)

                         at org.jboss.weld.proxies.MyDBService$1366014922$Proxy$_$$_WeldClientProxy.execute(MyDBService$1366014922$Proxy$_$$_WeldClientProxy.java)

                         at com.my.test.db.insertRecord(MyBean.java:88)

                         ... 205 more

                     

                    This problem is noticed only when calling SQLBinding reference binding service operation.

                    I see no issues with bean calling another bean or calling other reference bindings.

                    • 7. Re: Exception delivery to a consumer component
                      ozkin

                      Here I attached a reproducer app.

                      Service operation returns boolean instead of void and during invocation it throws following exception:

                       

                      00:19:01,439 ERROR [stderr] (http-/127.0.0.1:8080-1) java.lang.NullPointerException

                      00:19:01,440 ERROR [stderr] (http-/127.0.0.1:8080-1)     at com.sun.proxy.$Proxy32.execute(Unknown Source)

                      00:19:01,441 ERROR [stderr] (http-/127.0.0.1:8080-1)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                      00:19:01,441 ERROR [stderr] (http-/127.0.0.1:8080-1)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                      00:19:01,442 ERROR [stderr] (http-/127.0.0.1:8080-1)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                      00:19:01,442 ERROR [stderr] (http-/127.0.0.1:8080-1)     at java.lang.reflect.Method.invoke(Method.java:606)

                      00:19:01,443 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:45)

                      00:19:01,444 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105)

                      00:19:01,444 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.jboss.weld.proxies.MyDBService$1366014918$Proxy$_$$_WeldClientProxy.execute(MyDBService$1366014918$Proxy$_$$_WeldClientProxy.java)

                      00:19:01,445 ERROR [stderr] (http-/127.0.0.1:8080-1)     at com.example.switchyard.reproducer_npe_sql.MyServiceBean.test(MyServiceBean.java:17)

                      00:19:01,445 ERROR [stderr] (http-/127.0.0.1:8080-1)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                      00:19:01,446 ERROR [stderr] (http-/127.0.0.1:8080-1)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                      00:19:01,446 ERROR [stderr] (http-/127.0.0.1:8080-1)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                      00:19:01,447 ERROR [stderr] (http-/127.0.0.1:8080-1)     at java.lang.reflect.Method.invoke(Method.java:606)

                      00:19:01,448 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.switchyard.component.bean.ServiceProxyHandler.handle(ServiceProxyHandler.java:163)

                      00:19:01,448 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.switchyard.component.bean.ServiceProxyHandler.handleMessage(ServiceProxyHandler.java:94)

                      00:19:01,449 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.switchyard.bus.camel.processors.ProviderProcessor.process(ProviderProcessor.java:29)

                      00:19:01,449 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)

                      00:19:01,450 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)

                      00:19:01,451 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)

                      00:19:01,451 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

                      00:19:01,452 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)

                      00:19:01,452 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)

                      00:19:01,453 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

                      00:19:01,453 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)

                      00:19:01,454 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)

                      00:19:01,455 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)

                      00:19:01,455 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

                      00:19:01,456 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91)

                      00:19:01,456 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)

                      00:19:01,457 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)

                      00:19:01,457 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

                      00:19:01,458 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.switchyard.bus.camel.audit.FaultProcessor.process(FaultProcessor.java:46)

                      00:19:01,459 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)

                      00:19:01,459 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

                      00:19:01,460 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)

                      00:19:01,460 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)

                      00:19:01,461 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.Pipeline.process(Pipeline.java:117)

                      00:19:01,461 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)

                      00:19:01,462 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)

                      00:19:01,463 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.TryProcessor.process(TryProcessor.java:104)

                      00:19:01,463 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.TryProcessor.process(TryProcessor.java:78)

                      00:19:01,464 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)

                      00:19:01,464 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)

                      00:19:01,465 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

                      00:19:01,466 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)

                      00:19:01,466 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)

                      00:19:01,467 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)

                      00:19:01,467 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

                      00:19:01,468 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91)

                      00:19:01,468 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)

                      00:19:01,469 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)

                      00:19:01,469 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

                      00:19:01,470 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.switchyard.bus.camel.audit.FaultProcessor.process(FaultProcessor.java:46)

                      00:19:01,471 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)

                      00:19:01,471 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

                      00:19:01,472 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)

                      00:19:01,472 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)

                      00:19:01,473 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

                      00:19:01,473 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:122)

                      00:19:01,474 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48)

                      00:19:01,474 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

                      00:19:01,475 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)

                      00:19:01,476 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)

                      00:19:01,476 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

                      00:19:01,477 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)

                      00:19:01,477 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)

                      00:19:01,478 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:61)

                      00:19:01,478 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)

                      00:19:01,479 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)

                      00:19:01,479 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)

                      00:19:01,480 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)

                      00:19:01,481 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:63)

                      00:19:01,481 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:360)

                      00:19:01,482 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:331)

                      00:19:01,482 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:227)

                      00:19:01,483 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:331)

                      00:19:01,483 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:153)

                      00:19:01,484 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:106)

                      00:19:01,485 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:92)

                      00:19:01,485 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.switchyard.bus.camel.ExchangeDispatcher.dispatch(ExchangeDispatcher.java:87)

                      00:19:01,486 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.switchyard.bus.camel.CamelExchange.sendInternal(CamelExchange.java:234)

                      00:19:01,487 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.switchyard.bus.camel.CamelExchange.send(CamelExchange.java:171)

                      00:19:01,488 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.switchyard.component.http.InboundHandler.invoke(InboundHandler.java:115)

                      00:19:01,488 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.switchyard.component.http.HttpGatewayServlet.handle(HttpGatewayServlet.java:143)

                      00:19:01,489 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.switchyard.component.http.HttpGatewayServlet.service(HttpGatewayServlet.java:114)

                      00:19:01,489 ERROR [stderr] (http-/127.0.0.1:8080-1)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

                      00:19:01,490 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)

                      00:19:01,490 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

                      00:19:01,491 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)

                      00:19:01,491 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)

                      00:19:01,492 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145)

                      00:19:01,493 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)

                      00:19:01,493 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)

                      00:19:01,494 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336)

                      00:19:01,494 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)

                      00:19:01,495 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)

                      00:19:01,496 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920)

                      00:19:01,496 ERROR [stderr] (http-/127.0.0.1:8080-1)     at java.lang.Thread.run(Thread.java:745)

                       

                      This is SY-1.1.0-final.

                      To run a test I execute: "curl -v -X POST http://localhost:8080/test"

                      • 8. Re: Exception delivery to a consumer component
                        ozkin

                        Was there any chance to run the reproducer app and get the same exception?

                        • 9. Re: Exception delivery to a consumer component
                          igarashitm

                          I tried the reproducer with SwitchYard 2.0 branch and got a NPE from here:

                          https://github.com/jboss-switchyard/components/blob/master/common/camel/src/main/java/org/switchyard/component/camel/common/composer/CamelMessageComposer.java#L62


                          So I changed the return type from boolean to java.lang.Boolean and also changed the SQL to select 'dummy' then it worked.

                          • 10. Re: Exception delivery to a consumer component
                            ozkin

                            Thanks!! Changing to Boolean fixed the problem.