10 Replies Latest reply on Feb 9, 2010 12:15 PM by Steffen Krause

    Problems with ServiceInvoker...please help!

    Steffen Krause Newbie

      Hi everyone,

       

      I have a pretty tricky issue (or better, I have no idea where to look). Here is what is happening:

       

      We have been developing a web based application that makes business calls to an ESB in order to get data. The web-app and the ESB services are deployed on the same instance of JBoss (for right now). So far we have been developing against the community edition of JBoss and everything is working fine, the web-app sends a request, the request is being received by the services, the services process their business logic and send back a response, which the web-app receives and posts to the user. Our development set-up is:

       

      • JBoss-AS: 4.2.3.GA
      • JBoss-ESB: 4.5

       

      Now we deploy the web-app and the services to the commercial JBoss version. Everything deploys perfectly but when the web-app invokes the services the trouble starts. The ServiceInvoker used in the web-app spits out the following error message:

       

      2010-02-08 13:22:50,754 INFO  [gov.usc.ao.pacts.business.esb.utils.ESBInvokerImpl] callService:codexInputXML =() - 
      2010-02-08 13:22:50,789 INFO  [gov.usc.ao.pacts.business.esb.utils.ESBInvokerImpl] invokeService() - Invoking Service DemographicsESBs:FetchCountry
      2010-02-08 13:22:53,878 INFO  [org.jboss.soa.esb.client.ServiceInvoker] Unresponsive EPR: JMSEpr [ PortReference < <wsa:Address jms://ubuntu-krauses:1099/queue/demographics_fetchCountry/>, <wsa:ReferenceProperties jbossesb:java.naming.factory.initial : org.jnp.interfaces.NamingContextFactory/>, <wsa:ReferenceProperties jbossesb:java.naming.provider.url : ubuntu-krauses:1099/>, <wsa:ReferenceProperties jbossesb:java.naming.factory.url.pkgs : org.jnp.interfaces/>, <wsa:ReferenceProperties jbossesb:destination-type : queue/>, <wsa:ReferenceProperties jbossesb:specification-version : 1.1/>, <wsa:ReferenceProperties jbossesb:connection-factory : ConnectionFactory/>, <wsa:ReferenceProperties jbossesb:persistent : true/>, <wsa:ReferenceProperties jbossesb:acknowledge-mode : AUTO_ACKNOWLEDGE/>, <wsa:ReferenceProperties jbossesb:transacted : false/>, <wsa:ReferenceProperties jbossesb:type : urn:jboss/esb/epr/type/jms/> > ] for message: header: [  ]
      2010-02-08 13:22:56,999 INFO  [org.jboss.soa.esb.client.ServiceInvoker] Unresponsive EPR: JMSEpr [ PortReference < <wsa:Address jms://ubuntu-krauses:1099/queue/demographics_fetchCountry/>, <wsa:ReferenceProperties jbossesb:java.naming.factory.initial : org.jnp.interfaces.NamingContextFactory/>, <wsa:ReferenceProperties jbossesb:java.naming.provider.url : ubuntu-krauses:1099/>, <wsa:ReferenceProperties jbossesb:java.naming.factory.url.pkgs : org.jnp.interfaces/>, <wsa:ReferenceProperties jbossesb:destination-type : queue/>, <wsa:ReferenceProperties jbossesb:specification-version : 1.1/>, <wsa:ReferenceProperties jbossesb:connection-factory : ConnectionFactory/>, <wsa:ReferenceProperties jbossesb:persistent : true/>, <wsa:ReferenceProperties jbossesb:acknowledge-mode : AUTO_ACKNOWLEDGE/>, <wsa:ReferenceProperties jbossesb:transacted : false/>, <wsa:ReferenceProperties jbossesb:type : urn:jboss/esb/epr/type/jms/> > ] for message: header: [  ]
      2010-02-08 13:22:57,000 INFO  [org.jboss.soa.esb.client.ServiceInvoker] Delivering message [header: [  ]] to DLQ.
      2010-02-08 13:22:57,104 ERROR [gov.usc.ao.pacts.business.esb.utils.ESBInvokerImpl] invokeService() - Service DemographicsESBs:FetchCountry threw a MessageDeliverException
      org.jboss.soa.esb.listeners.message.MessageDeliverException: Failed to deliver message [header: [  ]] to Service [DemographicsESBs:FetchCountry].  Check for errors.
           at org.jboss.soa.esb.client.ServiceInvoker.post(ServiceInvoker.java:402)
           at org.jboss.soa.esb.client.ServiceInvoker.deliverSync(ServiceInvoker.java:204)
           at gov.usc.ao.pacts.business.esb.utils.ESBInvokerImpl.invokeService(ESBInvokerImpl.java:916)
           at gov.usc.ao.pacts.business.esb.utils.ESBInvokerImpl.callService(ESBInvokerImpl.java:895)
           at gov.usc.ao.pacts.business.esb.baos.ListOfValueBAOESB.getCountryList(ListOfValueBAOESB.java:211)
           at gov.usc.ao.pacts.actions.demographics.DemographicsLookupActionBean.getListOfCountrys(DemographicsLookupActionBean.java:74)
           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:592)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
           at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
           at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
           at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:29)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:31)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
           at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
           ...
      

       

      Can anybody please point me in the right direction? What am I missing?

       

      The commercial JBoss version we tried it with:

       

      • jboss-soa-p.4.3.0_CP01
      • jboss-soa-p.4.3.0_CP02

       

      And here is the service configuration:

       

      <?xml version = "1.0" encoding = "UTF-8"?>
      <jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" parameterReloadSecs="5">
      
          <!--========================================================================-->
          <!--= P R O V I D E R   C O N F I G U R A T I O N                          =-->
          <!--========================================================================-->
          <providers>
              <!--===================================-->
              <!--=== JMS Provider                ===-->
              <jms-provider name="JBossMQ" connection-factory="ConnectionFactory">
                  <!-- Demographics Begin -->
                  <jms-bus busid="FetchCountryESB">
                      <jms-message-filter dest-name="queue/demographics_fetchCountry" dest-type="QUEUE"/>
                  </jms-bus>
              </jms-provider>
          </providers>
      
          <!--========================================================================-->
          <!--= S E R V I C E   C O N F I G U R A T I O N                            =-->
          <!--========================================================================-->
          <services>
              <!-- Demographics services Start -->
              <!-- This service gives all the available Countries -->
              <service category="DemographicsESBs" name="FetchCountry" invmScope="NONE" description="Fetch Countries">
                  <listeners>
                      <jms-listener name="DemographicsESBs-FetchCountry" busidref="FetchCountryESB" maxThreads="1" is-gateway="false"/>
                  </listeners>
                  <actions mep="RequestResponse">
                      ...
                  </actions>
              </service>
          </services>
      </jbossesb>
      

       

      Thanks for your help in advance,

       

      Kimba

        • 1. Re: Problems with ServiceInvoker...please help!
          Daniel Bevenius Master

          Hi,

           

          is there any additional information in the server.log file?

           

          Thanks,

           

          /Daniel

          • 2. Re: Problems with ServiceInvoker...please help!
            Steffen Krause Newbie

            Daniel,

             

            Attached is the server log in INFO mode. Please see timestamp 2010-02-08 15:01:28,014 that is where the issue starts. If you want me to turn any particular package into DEBUG mode please let me know.

             

            Thanks for your help,

             

            Kimba

            • 3. Re: Problems with ServiceInvoker...please help!
              Daniel Bevenius Master

              Hi,

               

              yes, please turn on debug logging and see if you get anything of value in server.log.

               

              Would you be able to clean out your juddi database?. The reason I'm asking is that this would let us rule out stale EPRs in the database.

               

              Regards,

               

              /Daniel

              • 4. Re: Problems with ServiceInvoker...please help!
                Tom Fennelly Master
                By any chance is it the JMS Provider?  How is your JMS queue configured when deploying on the ESB on AS 4.2.3?  Doesn't AS 4.2.3 use JBossMQ, with the SOA-P using JBoss Messaging?
                1 of 1 people found this helpful
                • 5. Re: Problems with ServiceInvoker...please help!
                  Steffen Krause Newbie

                  Tom,

                   

                  Very good catch, I caught that one right in the beginning but you might be on to something! I found out the issue late last night so forgive me if I didn't post the answer right away. "found" might be a little to strong of a word here but I know what causes the problem, maybe you guys can shed some light into it to help me identify the best way to deal with the problem.

                   

                  I build a simple test Servlet yesterday and added it to my web-app. The Servlet did nothing else but call a service on our ESB that returns a list with all countries. To my surprise the Servlet worked just fine whereas the actual web-app (which we use SEAM for) did not. So I started adding more and more of our invocation stack to the Servlet. Everything worked fine and the Servlet continued to bring the desired results, my frustration at that point was pretty high. At that point the only difference between the Servlet and the actual web-app was one lousy little EJB call. And THAT was IT!

                   

                  Our ServiceInvoker is embedded in a Session Bean, which uses by default automatic transaction demarcation for its business methods (@TransactionAttribute(TransactionAttributeType.REQUIRED) and @TransactionManagement(TransactionManagementType.CONTAINER)). As mentioned before, the business method and my Servlet logic were at this point identical, the only thing I did NOT do from the Servlet was to actually call the business method of the EJB. When I finally did call the business method my Servlet broke as well. Now I did have the suspicion earlier that it might have something to do with transactions. For testing purposes I set the following on the type level of the bean:

                   

                  • @TransactionAttribute(TransactionAttributeType.NEVER)

                  • @TransactionManagement(TransactionManagementType.BEAN)

                   

                  After this change the web-app behaved as desired. So, correct me if I'm wrong but the problem lies in the following order:

                   

                  1. Web-app makes call to business method
                  2. EJB opens a new transaction
                  3. EJB invokes service synchronous via ServiceInvoker
                  4. ServiceInvoker waits for transaction commit (?)
                  5. ServiceInvoker fails with MessageDeliverException since transaction wasn't committed (?)
                  6. EJB commits transaction

                   

                  Since at this point we are not using any transactions with JMS is the way I chose the correct way to disable transactions for this particular Session Bean or is there a better way how I should handle transactions with the ServiceInvoker?

                   

                  Thanks for all your help so far guys, it's highly appreciated,

                   

                  Kimba

                  • 6. Re: Problems with ServiceInvoker...please help!
                    Kevin Conner Master

                    The outgoing JMS message will not be delivered to the target service until the transaction has committed, as it is enlisted in the encompassing transaction.

                     

                    If you wish to do this then the best way would be to use container managed transactions and invoke the deliverSync within a separate method, this time specifying NotSupported.

                    • 7. Re: Problems with ServiceInvoker...please help!
                      Steffen Krause Newbie
                      Kevin,

                      Kevin.Conner@jboss.com wrote:

                       

                      The outgoing JMS message will not be delivered to the target service until the transaction has committed, as it is enlisted in the encompassing transaction.

                       

                      Yes, that is what I finally found out as well (the hard way).

                       

                      So what you are saying the best way to deal with it is to:

                       

                      1. Set @TransactionManagement(TransactionManagementType.CONTAINER) or leave it out completely since it's the default
                      2. Set @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) on the method with the invoker call in it

                       

                      Awesome, let me try that out.

                       

                      Just out of curiosity, how would I do a synchronous call with the ServiceInvoker using transactions? Is it possible at all?

                       

                      Again, thanks for the help, that was great support team-work!!

                       

                      Kimba

                      • 8. Re: Problems with ServiceInvoker...please help!
                        Tom Fennelly Master
                        To deliverSync using ServiceInvoker in a transaction, I think you'd need to suspend the transaction... deliverSync... and then resume the transaction.
                        • 9. Re: Problems with ServiceInvoker...please help!
                          Kevin Conner Master

                          Unfortunately you cannot do synchronous invocations within the context of a transaction as we do not yet support distributed transactions.

                           

                          The reason I suggested a second method, with the NotSupported attribute, is that it explicitly suspends any encompassing transaction before invoking the method.

                          • 10. Re: Problems with ServiceInvoker...please help!
                            Steffen Krause Newbie

                            Thanks Kevin for the clarification, that helped me a lot! Also Tom, thanks for your input as it was also very helpful and confirmed my own thought process.

                             

                            Outstanding help,

                             

                            Kimba