Problems Resuming BA Transaction in SOA-P Business Process
jeffdelong May 28, 2008 11:06 PMI have taken the NightOut demo to run as an orchestrated business process usingWS BusinessActivity. To do this I:
1) Modified the BasicClient to call a single Web server call edNightOut, which is deployed on the ESB as a jPDL process NightOutBAProcess, which is deployed as an ESB hosted web service NightOutBAProcessServiceWS.
2) NightOutBAProcessServiceWS consist of the following actions:
a) SmooksTransformer action to covert XML data to Java object (Reservation).
b) WSBATxAction to start a userBusinessActivity and place the txContext in the ESBMessage. WSBATxAction is based on Pavel Kadlec's contribution (discussed in another forum thread).
c) BpmProcessor action with StartProcessInstanceCommand to start the NightOutBAProcess, and copy context variables including the txContext, as well as business data from the SOAPMessage (number of seats, etc.)
c) SOAPProcessor action to provide web service interface / WSDL mapping.
3) jBPM context variables are used to maintain initial business request data in a Reservation object (number of seats to reserve, etc.), status of responses from services (e.g., restaurantStatus, theatreStatus, taxiStatus) and txContext.
4) RestaurantBA, TheaterBA, and TaxiBA web services are proxied as ESB Services using SOAPClient. OGNL is used by the SOAClient action to map Reservation attributes to the SOAP message parameters.
5) ESBActionHandler copies the reservation object and txContext onto the ESBMessage and invokes the Restaurant, Theater, and Taxi ESB services.
6) WSBATXActions are incorporated in the Restaurant, Theatre, and Taxi ESB services to resume the userBusinessActivity (i.e., set it on the current thread). They use the txContext that is on the ESBMessage.
7) The SOAPClient invokes the appropriate web service.
8) The xxxStatus context variables are then used to determine the process flow.
8) UBA complete/cancel/close are also implemented as with the WSBATXAction, where the action invokes the appropriate action on the UserBusinessActivity using the txContext.
The problem I am having is that when the web services are invoked (e.g., RestaurantBA), I get a null pointer exception:
19:37:03,826 ERROR [SOAPFaultHelperJAXWS] SOAP request exception
java.lang.NullPointerException
at com.jboss.jbosstm.xts.demo.services.theatre.TheatreServiceBA.bookSeats(TheatreServiceBA.java:83)
Which is
transactionId = activityManager.currentTransaction().toString();
The following is from the console immediately before the exception.
19:37:03,771 INFO [WSBATxAction] Associating WS-Transaction 'BusinessActivityIdentifier: urn:7f000001:da1f:483d910a:12e9a' with current thread
19:37:03,771 INFO [STDOUT] &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
19:37:03,771 INFO [STDOUT] requestMap is: {bookSeats.how_many=1}
19:37:03,771 INFO [STDOUT] &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
19:37:03,772 INFO [STDOUT] Message structure:
19:37:03,772 INFO [STDOUT] [ message: [ JBOSS_XML ]
header: [ To: JMSEpr [ PortReference < <wsa:Address jms://127.0.0.1:1099/queue/Restaurant/>, <wsa:ReferenceProperties jbossesb:java.naming.factory.initial : org.jnp.interfaces.NamingContextFactory/>, <wsa:ReferenceProperties jbossesb:java.naming.provider.url : localhost/>, <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/> > ] ReplyTo: EPR: PortReference < <wsa:Address logical:JBossESB-Internal#JBpmCallbackService/>, <wsa:ReferenceProperties jbossesb:esbToBpmVars : />, <wsa:ReferenceProperties jbossesb:jbpmTokenId : 84/>, <wsa:ReferenceProperties jbossesb:jbpmNodeId : 91/>, <wsa:ReferenceProperties jbossesb:jbpmProcessInstId : 25/>, <wsa:ReferenceProperties jbossesb:jbpmProcessNodeVersionCounter91_84 : 0/>, <wsa:ReferenceProperties jbossesb:type : urn:jboss/esb/epr/type/logical/> > MessageID: ID:JBM-49508 RelatesTo: jms:correlationID#5f38b038-a636-4ca6-aac2-390a42ce6c3e ]
context: [ ]
body: [ objects: {org.jboss.soa.esb.message.defaultEntry={bookSeats.how_many=1}, Reservation=org.jboss.nightout.Reservation@10d6f2f, txContext=<?xml version="1.0" encoding="UTF-8"?><wscoor:CoordinationContextType xmlns:wscoor="http://schemas.xmlsoap.org/ws/2004/10/wscoor"><wscoor:Identifier>urn:7f000001:da1f:483d910a:12e9a</wscoor:Identifier><wscoor:CoordinationType>http://schemas.xmlsoap.org/ws/2004/10/wsba/AtomicOutcome</wscoor:CoordinationType><wscoor:RegistrationService><wsa:Address xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://localhost:8080/xts/soap/RegistrationCoordinator</wsa:Address><wsa:ReferenceParameters xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"><wsarj:InstanceIdentifier xmlns:wsarj="http://schemas.arjuna.com/ws/2005/10/wsarj">7f000001:da1f:483d910a:12e9a</wsarj:InstanceIdentifier></wsa:ReferenceParameters></wscoor:RegistrationService></wscoor:CoordinationContextType>} ]
fault: [ ]
attachments: [ Named:{}, Unnamed:[] ]
properties: [ {org.jboss.soa.esb.message.time.dod=Wed May 28 19:37:03 MDT 2008, org.jboss.soa.esb.message.time.dob=Deferred serialized value: fe9806, org.jboss.soa.esb.message.source=Deferred serialized value: aedf8f, org.jboss.soa.esb.message.transport.type=Deferred serialized value: d73f47, javax.jms.message.redelivered=false} ] ]
19:37:03,826 ERROR [SOAPFaultHelperJAXWS] SOAP request exception
java.lang.NullPointerException
at com.jboss.jbosstm.xts.demo.services.theatre.TheatreServiceBA.bookSeats
Thanks,
Jeff