13 Replies Latest reply on Aug 19, 2007 2:49 PM by Mark Little

    Is there a easy way to send to client a BusinessException fr

    Claudio R Novice

      Is there a easy way to send to client a BusinessException from ESB?

      I have a process in ESB pipeline that throw a BusinessException. But in my client I got only replyMessage.getFault().getReason(). (I am using a webservice that call deliverSync).

      To resolve this problem I am using try - catch in all process method, but this is hard. My workaround:

      public Message execute(Message message) throws Exception{
       try{
       .
       .
       .
       } catch (Exception e){
       message.getBody().add("BusinessException",e);
       throw new ActionProcessingFaultException(message,e.toString);
       }
      }


      I am using JBossAS 4.2.1 and ESB 4.2 MR3
      Someone has any suggestion?
      Thanks


        • 1. Re: Is there a easy way to send to client a BusinessExceptio
          Mark Little Master

          Check out the trunk. If you throw an ActionProcessingFaultException within your Action, then it'll be propagated back to the client as such.

          • 2. Re: Is there a easy way to send to client a BusinessExceptio
            Claudio R Novice

            Hi Mark,

            In my code I throw ActionProcessingFaultException (first post), but I need add try - catch. Does the trunk version to do this for me? I am using ESB 4.2 MR3
            Thanks

            • 3. Re: Is there a easy way to send to client a BusinessExceptio
              Mark Little Master

              Yes, in trunk you should now get a FaultMessageException thrown at the client. This will include the fault code, the reason and the original fault Message in case you need to pass back anything application specific.

              • 4. Re: Is there a easy way to send to client a BusinessExceptio
                Mark Little Master

                Oh, and this is not in MR3: only in the trunk.

                • 5. Re: Is there a easy way to send to client a BusinessExceptio
                  Claudio R Novice

                  Hi Mark,

                  I got the revision 14254 of esb trunk.
                  But when I installed in jboss I got this exception in jboss console:

                  13:54:58,125 ERROR [JobExecutorThread] exception in job executor thread. waiting 20000 milliseconds
                  org.hibernate.HibernateException: Could not find datasource
                   at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)
                   at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
                   at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
                   at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:414)
                   at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
                   at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
                   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
                   at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:91)
                   at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:94)
                   at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:98)
                   at org.jbpm.persistence.db.DbPersistenceService.getJobSession(DbPersistenceService.java:354)
                   at org.jbpm.JbpmContext.getJobSession(JbpmContext.java:563)
                   at org.jbpm.job.executor.JobExecutorThread.acquireJobs(JobExecutorThread.java:109)
                   at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:56)
                  Caused by: javax.naming.NameNotFoundException: JbpmDS not bound
                   at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
                   at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
                   at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
                   at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
                   at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
                   at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589)
                   at javax.naming.InitialContext.lookup(InitialContext.java:351)
                   at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)


                  Seems that is missing datasource configuration file.
                  Can you help me?
                  Thanks

                  • 6. Re: Is there a easy way to send to client a BusinessExceptio
                    Kurt Stam Master

                    That should be fixed when you do an update.

                    • 7. Re: Is there a easy way to send to client a BusinessExceptio
                      Claudio R Novice

                      The problem with JbpmDS was resolved in revision 14259.
                      Thanks Kurt!

                      When will go out the version 4.2.GA?

                      • 8. Re: Is there a easy way to send to client a BusinessExceptio
                        Claudio R Novice

                        I did a test with trunk version, but I got this exception:

                        org.jboss.soa.esb.couriers.FaultMessageException: org.jboss.soa.esb.actions.ActionProcessingException: Unexpected invocation target exception from processor
                         at org.jboss.internal.soa.esb.couriers.JmsCourier.pickup(JmsCourier.java:368)
                         at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.pickup(TwoWayCourierImpl.java:223)
                         at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.pickup(TwoWayCourierImpl.java:205)
                         at org.jboss.soa.esb.client.ServiceInvoker.attemptDelivery(ServiceInvoker.java:364)
                         at org.jboss.soa.esb.client.ServiceInvoker.post(ServiceInvoker.java:279)
                         at org.jboss.soa.esb.client.ServiceInvoker.deliverSync(ServiceInvoker.java:192)
                         at com.TestePipeline.main(TestePipeline.java:20)


                        I didn´t get my BusinessException. The exception.getCause() is null
                        Is there a solution for my problem?
                        Thanks




                        • 9. Re: Is there a easy way to send to client a BusinessExceptio
                          Mark Little Master

                           

                          "claudio_br" wrote:
                          When will go out the version 4.2.GA?


                          In a couple of weeks.

                          • 10. Re: Is there a easy way to send to client a BusinessExceptio
                            Mark Little Master

                             

                            "claudio_br" wrote:
                            I did a test with trunk version, but I got this exception:

                            org.jboss.soa.esb.couriers.FaultMessageException: org.jboss.soa.esb.actions.ActionProcessingException: Unexpected invocation target exception from processor
                             at org.jboss.internal.soa.esb.couriers.JmsCourier.pickup(JmsCourier.java:368)
                             at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.pickup(TwoWayCourierImpl.java:223)
                             at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.pickup(TwoWayCourierImpl.java:205)
                             at org.jboss.soa.esb.client.ServiceInvoker.attemptDelivery(ServiceInvoker.java:364)
                             at org.jboss.soa.esb.client.ServiceInvoker.post(ServiceInvoker.java:279)
                             at org.jboss.soa.esb.client.ServiceInvoker.deliverSync(ServiceInvoker.java:192)
                             at com.TestePipeline.main(TestePipeline.java:20)


                            I didn´t get my BusinessException. The exception.getCause() is null
                            Is there a solution for my problem?
                            Thanks


                            I may be misunderstanding what you're trying to do, but let me explain how the exception handling current occurs. (This is in the Programmers Guide, so you should check there too.)

                            If you throw an arbitrary exception from your process method then this will be rethrown back to the client as an FaultMessageException which should contain the original reason and code. Obviously we can't rethrow the original exception from the courier/ServiceInvoker signatures. However, we don't return the original exception in the cause: that's an oversight and I'll take a look at that tomorrow.

                            If your Action process method throws an ActionProcessingFaultException then you can return an arbitrary Message that will be returned to the client and rethrown as a FaultMessageException.

                            In both cases, you will get the entire Message back in the FaultMessageException.

                            • 11. Re: Is there a easy way to send to client a BusinessExceptio
                              Claudio R Novice

                              Hi Mark,

                              I got ESB svn revision 14333 and now I can get my BusinessException in my java client.
                              Thank you very much!

                              • 12. Re: Is there a easy way to send to client a BusinessExceptio
                                Mark Little Master

                                Glad it works for you Claudio :-)

                                • 13. Re: Is there a easy way to send to client a BusinessExceptio
                                  Mark Little Master

                                  BTW, we have plans to improve the failure handling in subsequent revisions, but hopefully what's there now will be sufficient to get you (and others) going.