9 Replies Latest reply on Mar 5, 2014 10:07 AM by Tomohisa igarashi

    NPE using Switchyard BPM with jca and peristence

    jachym.culka Newbie

      Hi, I'm having trouble with SY BPM component with enabled persistence. I'm getting NPE thrown in BPM internal org.drools.persistence.SingleSessionCommandService class

      at org.drools.persistence.SingleSessionCommandService$TransactionInterceptor.execute(SingleSessionCommandService.java:515) [drools-persistence-jpa-6.0.0.CR5.jar:6.0.0.CR5] [full stack trace bellow]:

       

      This issue can be simulated by signaling on nonexisting correlationKey on a freshly deployed sy app through JCA (ActiveMQ) transacted binding. I've noticed that once the process is successfully called and its state is stored, subsequent requests seem to be handled correctly. Problem seem to occur only when there is active transaction before BPM component is called, when the component is called through rest binding or JCA binding with disabled transactions it behaves as I'd expect (getting Cannot signalEvent: unknown processInstanceId or unknown/unmatched correlationKey: org.switchyard.HandlerException).

      I've also tried to change SimpleProcessService transaction policy from propagatesTransaction to suspendTransaction both with managedTransaction.Global on bpm impl, but result remained the same.

       

      I've encountered this issue in one of our larger sy modules but the same problem can be simulated with a simple SY app which is included. Any help greatly appreciated.

       

      Platform on which I tested: EAP 6.1.0.Alpha + SY 1.1 + ActiveMQ 5.9 JCA resource, with adapter named activemq-ra.rar.

       

      To signal the process, insert json object in the format below into the ActiveMQ In.SimpleServiceSignalQueue.

      To start the process, use In.SimpleServiceStartQueue.

      {  "correlationKey": "xxxzzz" }


      Thanks

      JC

       

      bpm-demo-process-sy.pngbpm-demo-process.png

      15:38:49,321 ERROR [org.switchyard.bus.camel.DefaultErrorListener] (default-threads - 9)

      ------- Begin Message Trace -------

      Consumer -> {urn:beei:jbpm-tester:1.0}SimplePromotedService

      Provider -> {urn:beei:jbpm-tester:1.0}SimplePromotedService

      Operation -> process

      MEP -> IN_ONLY

      Phase -> IN

      State -> OK

      Exchange Context ->

          CamelCreatedTimestamp ...............................: Wed Feb 19 15:38:49 CET 2014

          CamelExceptionCaught ................................: java.lang.NullPointerException

          CamelFailureEndpoint ................................: direct://%7Burn:beei:jbpm-tester:1.0%7DSimplePromotedService

          CamelFilterMatched ..................................: false

          CamelToEndpoint .....................................: direct://%7Burn:beei:jbpm-tester:1.0%7DSimplePromotedService

          org.switchyard.bus.camel.consumer ...................: ServiceReference [name={urn:beei:jbpm-tester:1.0}SimplePromotedService, interface=SWITCHYARD010007: BaseServiceInterface [type=java, operations=[SWITCHYARD010008: process : IN_ONLY  : [{beei:bt}Action.json, null, null], SWITCHYARD010008: acceptData : IN_ONLY  : [{beei:bt}Data.json, null, null]]], domain=ServiceDomain [name=null]]

          org.switchyard.bus.camel.contract ...................: org.switchyard.metadata.BaseExchangeContract@292a6ae9

          org.switchyard.bus.camel.dispatcher .................: org.switchyard.bus.camel.ExchangeDispatcher@59e5a7bf

          org.switchyard.bus.camel.intercept.Consumer .........: before

          org.switchyard.bus.camel.intercept.Provider .........: before

          org.switchyard.bus.camel.labels .....................: {org.switchyard.exchangeGatewayName=[org.switchyard.label.behavior.transient], org.switchyard.exchangeInitiatedNS=[org.switchyard.label.behavior.transient], org.switchyard.policy.provided=[org.switchyard.label.behavior.transient], org.switchyard.exchange.transaction.beforeInvoked=[org.switchyard.label.behavior.transient]}

          org.switchyard.bus.camel.phase ......................: IN

          org.switchyard.bus.camel.provider ...................: Service [name={urn:beei:jbpm-tester:1.0}SimplePromotedService, interface=SWITCHYARD010007: BaseServiceInterface [type=java, operations=[SWITCHYARD010008: process : IN_ONLY  : [java:net.servodata.beei.data.Action, null, null], SWITCHYARD010008: acceptData : IN_ONLY  : [java:net.servodata.beei.data.Data, null, null]]], domain=ServiceDomain [name=null], metadata=org.switchyard.metadata.ServiceMetadataBuilder$ServiceMetadataImpl@13cdb240]

          org.switchyard.exchange.transaction.beforeInvoked ...: true

          org.switchyard.exchangeGatewayName ..................: processBinding

          org.switchyard.exchangeInitiatedNS ..................: 440445088980562

          org.switchyard.policy.provided ......................: [propagatesTransaction, managedTransaction.Global]

          {urn:switchyard-component-bpm:bpm:1.0}correlationKey : kkk1-a

      Message Context ->

          breadcrumbId ..............................: ID-jachymculka-dl-63931-1392820688180-4-19

          org.switchyard.bus.camel.labels ...........: {org.switchyard.contentType=[org.switchyard.label.behavior.transient], org.switchyard.bus.camel.messageSent=[org.switchyard.label.behavior.transient], org.switchyard.transform.TransformSequence=[org.switchyard.label.behavior.transient]}

          org.switchyard.bus.camel.messageSent ......: true

          org.switchyard.contentType ................: java:net.servodata.beei.data.Action

          org.switchyard.messageId ..................: ID-jachymculka-dl-63931-1392820688180-4-19

          org.switchyard.transform.TransformSequence : org.switchyard.transform.TransformSequence@5157a295

      ------ End Message Trace -------

      Caught exception of type java.lang.NullPointerException with message: null: java.lang.NullPointerException

             at org.drools.persistence.SingleSessionCommandService$TransactionInterceptor.execute(SingleSessionCommandService.java:515) [drools-persistence-jpa-6.0.0.CR5.jar:6.0.0.CR5]

              at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:374) [drools-persistence-jpa-6.0.0.CR5.jar:6.0.0.CR5]

              at org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession.addEventListener(CommandBasedStatefulKnowledgeSession.java:460) [drools-core-6.0.0.CR5.jar:6.0.0.CR5]

              at org.switchyard.component.common.knowledge.util.Listeners.registerListener(Listeners.java:182)

              at org.switchyard.component.bpm.exchange.BPMExchangeHandler.getBPMSession(BPMExchangeHandler.java:303) [switchyard-component-bpm-1.1.0.Final.jar:1.1.0.Final]

              at org.switchyard.component.bpm.exchange.BPMExchangeHandler.handleOperation(BPMExchangeHandler.java:222) [switchyard-component-bpm-1.1.0.Final.jar:1.1.0.Final]

              at org.switchyard.component.common.knowledge.exchange.KnowledgeExchangeHandler.handleMessage(KnowledgeExchangeHandler.java:253)

              at org.switchyard.bus.camel.processors.ProviderProcessor.process(ProviderProcessor.java:29) [switchyard-bus-camel-1.1.0.Final.jar:1.1.0.Final]

              at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.3.jar:2.10.3]

              at org.switchyard.bus.camel.audit.FaultProcessor.process(FaultProcessor.java:46) [switchyard-bus-camel-1.1.0.Final.jar:1.1.0.Final]

              at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.Pipeline.process(Pipeline.java:117) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.Pipeline.process(Pipeline.java:80) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.TryProcessor.process(TryProcessor.java:104) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.TryProcessor.process(TryProcessor.java:78) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.3.jar:2.10.3]

              at org.switchyard.bus.camel.audit.FaultProcessor.process(FaultProcessor.java:46) [switchyard-bus-camel-1.1.0.Final.jar:1.1.0.Final]

              at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:122) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:61) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:63) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:366) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:337) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:233) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:337) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:159) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:106) [camel-core-2.10.3.jar:2.10.3]

              at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:92) [camel-core-2.10.3.jar:2.10.3]

              at org.switchyard.bus.camel.ExchangeDispatcher.dispatch(ExchangeDispatcher.java:87) [switchyard-bus-camel-1.1.0.Final.jar:1.1.0.Final]

              at org.switchyard.bus.camel.CamelExchange.sendInternal(CamelExchange.java:234) [switchyard-bus-camel-1.1.0.Final.jar:1.1.0.Final]

              at org.switchyard.bus.camel.CamelExchange.send(CamelExchange.java:171) [switchyard-bus-camel-1.1.0.Final.jar:1.1.0.Final]

              at org.switchyard.component.jca.endpoint.JMSEndpoint.onMessage(JMSEndpoint.java:49) [switchyard-component-jca-1.1.0.Final.jar:1.1.0.Final]

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_07]

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_07]

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_07]

              at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_07]

              at org.switchyard.component.jca.EndpointProxy.delivery(EndpointProxy.java:194) [switchyard-component-jca-1.1.0.Final.jar:1.1.0.Final]

              at org.switchyard.component.jca.EndpointProxy.invoke(EndpointProxy.java:159) [switchyard-component-jca-1.1.0.Final.jar:1.1.0.Final]

        at $Proxy160.onMessage(Unknown Source)  at org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.onMessage(MessageEndpointProxy.java:123)

              at org.apache.activemq.ra.MessageEndpointProxy.onMessage(MessageEndpointProxy.java:64)

              at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:916)

              at org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:169)

              at org.jboss.jca.core.workmanager.WorkWrapper.run(WorkWrapper.java:218)

              at org.jboss.threads.SimpleDirectExecutor.execute(SimpleDirectExecutor.java:33)

              at org.jboss.threads.QueueExecutor.runTask(QueueExecutor.java:806)

              at org.jboss.threads.QueueExecutor.access$100(QueueExecutor.java:45)

              at org.jboss.threads.QueueExecutor$Worker.run(QueueExecutor.java:826)

              at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]

              at org.jboss.threads.JBossThread.run(JBossThread.java:122)

       

      Source codes added

        • 1. Re: NPE using Switchyard BPM with jca and peristence
          Keith Babo Master

          How is ActiveMQ installed in your environment - embedded or remote JVM?  From the outside, it looks to be something funky with the association of the transaction from ActiveMQ.

          • 2. Re: Re: NPE using Switchyard BPM with jca and peristence
            jachym.culka Newbie

            ActiveMQ is standalone, currently running on the same machine as AS7.

            My resource config for ActiveMQ in domain.xml is following:

            <resource-adapter id="activemq-ra.rar">
              <archive>
              activemq-ra.rar
              </archive>
              <transaction-support>XATransaction</transaction-support>
              <config-property name="ServerUrl">
              tcp://localhost:61616
              </config-property>
              <connection-definitions>
              <connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:/activemq/ConnectionFactory" enabled="true" use-java-context="true" pool-name="ActiveMQConnectionFactoryPool" use-ccm="true">
              <xa-pool>
              <min-pool-size>1</min-pool-size>
              <max-pool-size>20</max-pool-size>
              </xa-pool>
              </connection-definition>
              </connection-definitions>
            ...
            </resource-adapter>
            

            Also i forgot to mention that we use PostgreSQL 9.3 through XA Datasource for jBPM persistance.

            • 3. Re: NPE using Switchyard BPM with jca and peristence
              Jiri Svitak Novice

              First of all - version 6.0.0.CR5 is outdated. Please retry your use case with latest jBPM, currently it is 6.0.1.Final. If the problem persists please file a JIRA.

               

              Thanks,

              Jiri

              • 4. Re: Re: NPE using Switchyard BPM with jca and peristence
                jachym.culka Newbie

                jBPM 6.0.0.CR5 is packaged with SY 1.1.0 Final which is latest stable version of SY that's is publicly available. But we've also tried out luck by upgrading to jBPM 6.0.0.Final which afaik is latest version used by SY1.x branch, but the problem remained exactly the same. I can try to upgrade to 6.0.1.Final to see if that helps, but I'm not sure if it won't break the compatibility with 1.x SY (SY upgraded to 6.0.1 in branch 2.x by SWITCHYARD-1935).

                • 5. Re: Re: Re: NPE using Switchyard BPM with jca and peristence
                  Tomohisa igarashi Master

                  I just modified your application to get work with EAP + SwitchYard2.0 SNAPSHOT + HornetQ + H2DB and I got following - It seems to be working as you expected. As Keith said to me, maybe something wrong with ActiveMQ resource adapter on transaction handling.

                   

                  21:25:04,639 INFO  [net.servodata.beei.CorrelationKeyInterceptor] (Thread-8 (HornetQ-client-global-threads-1731950029)) Intercepted: Action{correlationKey='xxxzzz', name='null'}, correlationKey xxxzzz

                  21:25:04,942 ERROR [org.switchyard.bus.camel.DefaultErrorListener] (Thread-8 (HornetQ-client-global-threads-1731950029))

                  ------- Begin Message Trace -------

                  Consumer -> {urn:beei:jbpm-tester:1.0}SimplePromotedService

                  Provider -> {urn:beei:jbpm-tester:1.0}SimplePromotedService

                  Operation -> process

                  MEP -> IN_ONLY

                  Phase -> IN

                  State -> OK

                  Exchange Context ->

                      CamelCreatedTimestamp ...............................: Tue Feb 25 21:25:04 JST 2014

                      CamelExceptionCaught ................................: org.switchyard.HandlerException: SWITCHYARD032002: Cannot signalEvent: unknown processInstanceId or unknown/unmatched correlationKey

                      CamelFailureEndpoint ................................: direct://%7Burn:beei:jbpm-tester:1.0%7DSimplePromotedService

                      CamelFilterMatched ..................................: false

                      CamelToEndpoint .....................................: direct://%7Burn:beei:jbpm-tester:1.0%7DSimplePromotedService

                      org.switchyard.bus.camel.consumer ...................: ServiceReference [name={urn:beei:jbpm-tester:1.0}SimplePromotedService, interface=BaseServiceInterface [type=java, operations=[process : IN_ONLY  : [{beei:bt}Action.json, null, null], acceptData : IN_ONLY  : [{beei:bt}Data.json, null, null]]], domain=ServiceDomain [name=null]]

                      org.switchyard.bus.camel.contract ...................: org.switchyard.metadata.BaseExchangeContract@470c8eae

                      org.switchyard.bus.camel.dispatcher .................: org.switchyard.bus.camel.ExchangeDispatcher@69f23959

                      org.switchyard.bus.camel.intercept.Consumer .........: before

                      org.switchyard.bus.camel.intercept.Provider .........: before

                      org.switchyard.bus.camel.labels .....................: {org.switchyard.exchangeGatewayName=[org.switchyard.label.behavior.transient], org.switchyard.exchangeInitiatedNS=[org.switchyard.label.behavior.transient], org.switchyard.policy.provided=[org.switchyard.label.behavior.transient], org.switchyard.exchange.transaction.beforeInvoked=[org.switchyard.label.behavior.transient]}

                      org.switchyard.bus.camel.phase ......................: IN

                      org.switchyard.bus.camel.provider ...................: Service [name={urn:beei:jbpm-tester:1.0}SimplePromotedService, interface=BaseServiceInterface [type=java, operations=[acceptData : IN_ONLY  : [java:net.servodata.beei.data.Data, null, null], process : IN_ONLY  : [java:net.servodata.beei.data.Action, null, null]]], domain=ServiceDomain [name=null], metadata=org.switchyard.metadata.ServiceMetadataBuilder$ServiceMetadataImpl@22f2312d]

                      org.switchyard.bus.camel.replyHandler ...............: org.switchyard.component.common.SynchronousInOutHandler@1d933866

                      org.switchyard.exchange.transaction.beforeInvoked ...: true

                      org.switchyard.exchangeGatewayName ..................: processBinding

                      org.switchyard.exchangeInitiatedNS ..................: 106367692424026

                      org.switchyard.policy.provided ......................: [managedTransaction.Global, propagatesTransaction]

                      suspendedTransaction ................................: TransactionImple < ac, BasicAction: 0:ffff7f000001:5e1d179:530c8667:79 status: ActionStatus.RUNNING >

                      {urn:switchyard-component-bpm:bpm:1.0}correlationKey : xxxzzz

                  Message Context ->

                      breadcrumbId ..............................: ID-tomo-x220-56315-1393330214894-5-1

                      org.switchyard.bus.camel.labels ...........: {org.switchyard.contentType=[org.switchyard.label.behavior.transient], org.switchyard.bus.camel.messageSent=[org.switchyard.label.behavior.transient], org.switchyard.transform.TransformSequence=[org.switchyard.label.behavior.transient]}

                      org.switchyard.bus.camel.messageSent ......: true

                      org.switchyard.contentType ................: java:net.servodata.beei.data.Action

                      org.switchyard.messageId ..................: ID-tomo-x220-56315-1393330214894-5-1

                      org.switchyard.transform.TransformSequence : org.switchyard.transform.TransformSequence@3b871ad3

                  ------ End Message Trace -------

                  Caught exception of type org.switchyard.HandlerException with message: SWITCHYARD032002: Cannot signalEvent: unknown processInstanceId or unknown/unmatched correlationKey: org.switchyard.HandlerException: SWITCHYARD032002: Cannot signalEvent: unknown processInstanceId or unknown/unmatched correlationKey

                    at org.switchyard.component.bpm.exchange.BPMExchangeHandler.handleOperation(BPMExchangeHandler.java:227) [switchyard-component-bpm-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]

                    at org.switchyard.component.common.knowledge.exchange.KnowledgeExchangeHandler.handleMessage(KnowledgeExchangeHandler.java:253)

                    at org.switchyard.bus.camel.processors.ProviderProcessor.process(ProviderProcessor.java:28) [switchyard-bus-camel-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]

                    at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.3.jar:2.10.3]

                    at org.switchyard.bus.camel.audit.FaultProcessor.process(FaultProcessor.java:45) [switchyard-bus-camel-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]

                    at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.Pipeline.process(Pipeline.java:117) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.Pipeline.process(Pipeline.java:80) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.TryProcessor.process(TryProcessor.java:104) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.TryProcessor.process(TryProcessor.java:78) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.3.jar:2.10.3]

                    at org.switchyard.bus.camel.audit.FaultProcessor.process(FaultProcessor.java:45) [switchyard-bus-camel-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]

                    at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:122) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:61) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:63) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:366) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:337) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:233) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:337) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:159) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:106) [camel-core-2.10.3.jar:2.10.3]

                    at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:92) [camel-core-2.10.3.jar:2.10.3]

                    at org.switchyard.bus.camel.ExchangeDispatcher.dispatch(ExchangeDispatcher.java:87) [switchyard-bus-camel-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]

                    at org.switchyard.bus.camel.CamelExchange.sendInternal(CamelExchange.java:234) [switchyard-bus-camel-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]

                    at org.switchyard.bus.camel.CamelExchange.send(CamelExchange.java:171) [switchyard-bus-camel-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]

                    at org.switchyard.component.jca.endpoint.JMSEndpoint.onMessage(JMSEndpoint.java:141) [switchyard-component-jca-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]

                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_51]

                    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_51]

                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_51]

                    at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_51]

                    at org.switchyard.component.jca.EndpointProxy.delivery(EndpointProxy.java:194) [switchyard-component-jca-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]

                    at org.switchyard.component.jca.EndpointProxy.invoke(EndpointProxy.java:159) [switchyard-component-jca-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]

                    at com.sun.proxy.$Proxy105.onMessage(Unknown Source)

                    at org.hornetq.ra.inflow.HornetQMessageHandler.onMessage(HornetQMessageHandler.java:319)

                    at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:1114)

                    at org.hornetq.core.client.impl.ClientConsumerImpl.access$500(ClientConsumerImpl.java:57)

                    at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:1249)

                    at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:106)

                    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]

                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]

                    at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]

                   

                   

                  21:25:04,953 ERROR [stderr] (Thread-8 (HornetQ-client-global-threads-1731950029)) After

                   

                  I added Arquillian testcase which tests against running EAP+SwitchYard instance. You can try attached one with:

                  mvn package; mvn test -DskipTests=false
                  
                  • 6. Re: Re: Re: Re: NPE using Switchyard BPM with jca and peristence
                    jachym.culka Newbie

                    I've made a mistake with the previously posted sources. It contains one additional interceptor (net.servodata.beei.TransactionInterceptor) that manually suspends transactions, which isn't included in that that compiled jar I attached earlier (that I used to simulate said NPE). (initially I attached only compiled jar without sources, which I added some time later unfortunately with unwanted changes). Sorry for this confusion.

                     

                    I've altered Tomohisa Igarashi's demo by removing that interceptor and unwanted suspendTransaction attribute in switchyard.xml and tried to the Arquillian testcase by the instructions but got error when running test>

                     

                    org.jboss.arquillian.container.spi.client.container.DeploymentException: Cannot deploy: arquillian-service

                    ...

                    Caused by: java.net.ConnectException: JBAS012144: Could not connect to remote://localhost:9999. The connection timed out

                    Anyway, I also tried to run this demo against my standalone server with SY 1.1.0.Final now with HornetQ and H2 XA DS and got the same NPE in SingleSessionCommandService as with ActiveMQ and PostgreSQL. Can you please take a look at the modified version?

                     

                    Thanks

                     

                    Stacktrace with NPE in SingleSessionCommandService with HornetQ as JMS provider:

                     

                    [Server:server-one] Caught exception of type java.lang.NullPointerException with message: null: java.lang.NullPointerException
                    [Server:server-one]     at org.drools.persistence.SingleSessionCommandService$TransactionInterceptor.execute(SingleSessionCommandService.java:515) [drools-persistence-jpa-6.0.0.CR5.jar:6.0.0.CR5]
                    [Server:server-one]     at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:374) [drools-persistence-jpa-6.0.0.CR5.jar:6.0.0.CR5]
                    [Server:server-one]     at org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession.addEventListener(CommandBasedStatefulKnowledgeSession.java:440) [drools-core-6.0.0.CR5.jar:6.0.0.CR5]
                    ....
                    [Server:server-one]     at $Proxy113.onMessage(Unknown Source)  at org.hornetq.ra.inflow.HornetQMessageHandler.onMessage(HornetQMessageHandler.java:313)
                    [Server:server-one]     at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:1016)
                    [Server:server-one]     at org.hornetq.core.client.impl.ClientConsumerImpl.access$400(ClientConsumerImpl.java:52)
                    [Server:server-one]     at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:1161)
                    [Server:server-one]     at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:106)
                    [Server:server-one]     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_07]
                    [Server:server-one]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_07]
                    [Server:server-one]     at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]
                    
                    • 7. Re: NPE using Switchyard BPM with jca and peristence
                      Tomohisa igarashi Master

                      It did reproduce here. So far I'm not sure what is happening though, it seems to be reproducible without JMS. I'll dig into it later.

                      • 8. Re: NPE using Switchyard BPM with jca and peristence
                        Tomohisa igarashi Master

                        forgot to mention about this...

                        I've altered Tomohisa Igarashi's demo by removing that interceptor and unwanted suspendTransaction attribute in switchyard.xml and tried to the Arquillian testcase by the instructions but got error when running test>

                         

                        org.jboss.arquillian.container.spi.client.container.DeploymentException: Cannot deploy: arquillian-service

                        ...

                        Caused by: java.net.ConnectException: JBAS012144: Could not connect to remote://localhost:9999. The connection timed out

                         

                        You need to start the EAP+SwitchYard instance prior to run the Arquillian remote testcase.

                        • 9. Re: NPE using Switchyard BPM with jca and peristence
                          Tomohisa igarashi Master

                          Sorry for not replying earlier - I raised a JIRA to track this issue

                          https://issues.jboss.org/browse/SWITCHYARD-1987

                           

                          I found expected error message "unknown processInstanceId or unknown/unmatched correlationKey" is actually there at first attempt. And then JMS inbound transaction is rolled back, which causes redelivery. Apparently BPM component throws unexpected exception at the redelivery, end up with NullPointerException.