Bug 779285 - (SOA-1673) A jBPM process started from a Seam app. cannot call an ESB service
A jBPM process started from a Seam app. cannot call an ESB service
Status: CLOSED NEXTRELEASE
Product: JBoss Enterprise SOA Platform 5
Classification: JBoss
Component: JBossESB, JBPM - within SOA, Seam (Show other bugs)
5.0.0 ER4
Unspecified Unspecified
urgent Severity urgent
: ---
: ---
Assigned To: Martin Vecera
http://jira.jboss.org/jira/browse/SOA...
: TestBlocker
Depends On: SOA-1234
Blocks:
  Show dependency treegraph
 
Reported: 2009-12-04 11:45 EST by Martin Vecera
Modified: 2010-07-29 10:24 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-07-29 10:24:09 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
dvdstore-no-jbpm.zip (3.60 MB, application/zip)
2009-12-04 11:57 EST, Martin Vecera
no flags Details
soa-seam-int.sar.kev (2.23 MB, application/octet-stream)
2010-02-12 04:39 EST, Kevin Conner
no flags Details
ProxyFactoryClassLoaderProviderInit.java (779 bytes, text/plain)
2010-02-12 04:40 EST, Kevin Conner
no flags Details
ProxyFactoryClassLoaderProviderInitMBean.java (156 bytes, text/plain)
2010-02-12 04:40 EST, Kevin Conner
no flags Details
jboss-seam-dvdstore.ear (4.26 MB, application/octet-stream)
2010-02-17 18:19 EST, David Ward
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker SOA-1673 Blocker Closed A jBPM process started from a Seam app. cannot call an ESB service 2013-08-08 06:15:12 EDT

  None (edit)
Description Martin Vecera 2009-12-04 11:45:28 EST
Complexity: High
Date of First Response: 2009-12-04 15:44:39
project_key: SOA

What we want to achieve?
We need a Seam application (we use dvdstore from Seam examples) to be able to create a new instance of a jBPM process. This process instance should be able to call a deployed ESB service. We want to preserve other Seam functionality, especially the possibility to use jPDL page flow definitions.

How do we want to achieve it?
There is no strict way defined. We tried org.jboss.soa.esb.services.jbpm.actionhandlers.EsbNotifier in the process definition.

What causes the problem?
If there is a separate jbpm-jpdl.jar in the Seam application's EAR, the application can work, but it cannot call an ESB service due to class loading issues (SOA-1234). So the jBPM must be removed from Seam app. to run on SOA-P. This is no problem since process definitions can be deployed separately on the server using jBPM console. What causes a trouble is jPDL page flow definition. It cannot be deployed on the server without Seam libraries (there are unsatisfied dependencies).

Possible solutions (not tested):
1) Remove jBPM from the server side.
2) Install Seam libraries on the server.

We need a fix or a workaround because this feature must be in 5.0.0 GA.
Comment 1 Martin Vecera 2009-12-04 11:46:15 EST
Link: Added: This issue depends SOA-1234
Comment 2 Martin Vecera 2009-12-04 11:57:15 EST
To get a better picture of the situation, see the attached dvdstore-no-jbpm.zip. To reproduce the problem:
1) deploy helloworld
2) deploy par using jbpm console
3) deploy datasource
4) deploy ear
5) go to server:8080/seam-dvdstore
6) login as user1:password
7) Click on Shop -> The Bourne Id -> Add To Cart -> Checkout -> Purchase
8) see the exception
Comment 3 Martin Vecera 2009-12-04 11:57:15 EST
Attachment: Added: dvdstore-no-jbpm.zip
Comment 4 Mark Little 2009-12-04 15:44:39 EST
There really is no good reason to not remember to set the components for an issue, especially when the title of the issue makes them fairly intuitive!
Comment 5 Kevin Conner 2010-02-12 04:29:09 EST
Sorry, but it does not look like this is possible without major changes.  Every time I make progress I uncover something else that needs to be addressed.

I did manage to get the dvdstore running but, in the process, broke the jbpm-console (seam related).  Therefore I think the best course of action is to revert to a scoped ear and use ServiceInvoker directly from a jBPM action.

So far the steps have been as follows

Within deploy/jbossesb.esb
- remove jackrabbit and lucene-core jars
  (Removes JCR message store)

Within jboss-seam-dvdstore.ear
- remove jboss-seam.jar, lib/hibernate-commons-annotations.jar, lib/jboss-el.jar, lib/lucene-core.jar, lib/hibernate-search.jar

Then add deploy/soa-seam-int.sar (as attached)

The sar attempts to address two issues with the seam deployment
- setting up the correct ProxyFactoryClassLoaderProvider so that it pulls in from the context classloader
- setting up jBPM to do the same (<string name="jbpm.class.loader" value="context" />)

Unfortunately these then cause the jbpm-console to break with the following

java.lang.NullPointerException
	org.jboss.seam.jsf.SeamViewHandler.calculateLocale(SeamViewHandler.java:55)
	com.sun.facelets.FaceletViewHandler.calculateLocale(FaceletViewHandler.java:790)
	javax.faces.application.ViewHandlerWrapper.calculateLocale(ViewHandlerWrapper.java:102)
	com.sun.faces.application.ViewHandlerImpl.createView(ViewHandlerImpl.java:372)
	org.jboss.seam.jsf.SeamViewHandler.createView(SeamViewHandler.java:68)
	com.sun.facelets.FaceletViewHandler.createView(FaceletViewHandler.java:803)

So there is some corruption happening as a result of these settings.

I am now of the opinion that we need to spend some serious time looking at this, and provide a tighter integration for SOA.  I suspect the only way forward for now is, as stated above, to revert to a scoped ear file and directly use ServiceInvoker.  No ESB class referring to jBPM should be used, including EsbNotifier, EsbActionHandler and JBpmObjectMapper.

For scoping the ear I changes jboss-app.xml to

    <loader-repository>
        seam.jboss.org:loader=seam-dvd
        <loader-repository-config>
            java2ParentDelegation=false
        </loader-repository-config>
    </loader-repository>

Comment 6 Kevin Conner 2010-02-12 04:29:40 EST
Sorry Martin, this is as far as I can go for now.
Comment 7 Kevin Conner 2010-02-12 04:39:31 EST
sar file
Comment 8 Kevin Conner 2010-02-12 04:39:31 EST
Attachment: Added: soa-seam-int.sar.kev
Comment 9 Kevin Conner 2010-02-12 04:40:05 EST
MBean
Comment 10 Kevin Conner 2010-02-12 04:40:05 EST
Attachment: Added: ProxyFactoryClassLoaderProviderInit.java
Comment 11 Kevin Conner 2010-02-12 04:40:17 EST
Attachment: Added: ProxyFactoryClassLoaderProviderInitMBean.java
Comment 12 Len DiMaggio 2010-02-12 10:59:30 EST
Blocked Tests: Added: SEAM testing is blocked
Affects Testing: Added: [Blocks Testing]
Comment 13 David Ward 2010-02-17 18:17:41 EST
I am providing a deployable ear given Kevin's suggestion.  Here's what I did:

1) Started with SOA-P 5 CR2's seam example dvdstore AS IS.  (ant archive creates jboss-seam-dvdstore.ear)  Leave jbpm-jpdl.jar in there!

2) Created my own ActionHandler that calls ServiceInvoker.  Okay, this is not *completely* true.  What I did was I started with EsbNotifier that comes with the ESB and I broke it out (along with it's handful of dependent classes to support variable mappings) and put it into it's own package.  This does what Kev suggested without depending on ESB/jBPM code, but additionally supports variable mapping.  See attached: jboss-seam-dvdstore.ear/SOA-1673.jar for source files.

3) Scoped the ear exactly as Kev suggested.  See attached:  jboss-seam-dvdstore.ear/META-INF/jboss-app.xml

4) Edited the processdefinition to invoke the custom ActionHandler, which called the FirstServiceESB/SimpleListener ESB Service and also maps a bpm variable to the esb body content.  See attached: jboss-seam-dvdstore.ear/ordermanagement1.jpdl.xml

Now, once I re-packaged the jboss-seam-dvdstore.ear, here are the test steps:

1) deploy helloworld esb service
2) deploy datasource
3) deploy ear
4) go to server:8080/seam-dvdstore
5) login as user1:password
6) Click on Shop -> The Bourne Id -> Add To Cart -> Checkout -> Purchase -> Confirm
7) see the ESB Service output in the server console:

18:05:05,192 INFO  [STDOUT] &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
18:05:05,254 INFO  [STDOUT] Body: 1
18:05:05,255 INFO  [STDOUT] &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
18:05:05,262 INFO  [STDOUT] Message structure: 
18:05:05,262 INFO  [STDOUT] [1].

"ta-da".  So, Kev was spot-on.  Of course.  ;) 

I will post a link back here for the wiki page I'm authoring documenting this workaround.
Comment 14 David Ward 2010-02-17 18:19:20 EST
jboss-seam-dvdstore.ear that works per my above comment.
Comment 15 David Ward 2010-02-17 18:19:20 EST
Attachment: Added: jboss-seam-dvdstore.ear
Comment 16 David Ward 2010-02-17 18:21:17 EST
Oops, forgot one other thing I had to do: make the custom ActionHandler class available to the classloader.  To do this, I edited jboss-seam-dvdstore.ear/META-INF/application.xml and added this:

    <module>
        <java>SOA-1673.jar</java>
    </module>
Comment 17 David Ward 2010-02-18 11:19:05 EST
Here is the requested wiki page: http://community.jboss.org/wiki/WorkaroundforSeamESBjBPMClassloadingIssue
Comment 18 Pete Muir 2010-02-19 13:21:27 EST
Have you investigated using jbpm as a shared (installed) library?
Comment 19 David Ward 2010-02-19 15:41:57 EST
Pete, that's only an option if the version of jBPM is exactly the same across the ESB, any deployed Seam applications, and any direct usage of jBPM by other applications.  Scoping the application would allow for different library versions.

Aside, and maybe this is more of a forum discussion, I'd like to offer my opinion in this circumstance.  I'm not trying to dance around the issue, which there definitely is one, however if a customer asked me about this, I would question why architecturally (or maybe more infrastructurally), they would want to deploy their Seam app in the same VM as the ESB to begin with.  The ESB is for systems integration / service orchestration / etc.  Seam is an application framework that could interact with it, although I would consider it best to run that on it's own "system" separate from the ESB.  It could be scaled differently, secured differently, managed differently, etc.  The only reason Seam is even included in SOA-P is because it "comes along for the ride" with EAP... and I question if it really should...
Comment 20 David Ward 2010-02-19 15:44:43 EST
To clarrify, I meant to say "I question if Seam really should be included in SOA-P... "
Comment 21 Kevin Conner 2010-02-22 05:29:24 EST
Pete, the original intention was to use jBPM as a shared library and my initial comments on 12th Feb go some way to doing this.  This exposes other issues, however, and I feel we need to spend more time understanding these before we can move forward.  This is why I suggested the safer route of using a scoped deployment in the meantime.
Comment 22 trev 2010-03-09 06:13:32 EST
issues documented as far as possible for the 5.0.0 release, will need further work for a final resolution.
Comment 23 John Graham 2010-07-29 10:24:09 EDT
Work to mitigate this is complete. Future issues with Seam/jBPM/ESB integration should be registered in separate JIRAs.

Note You need to log in before you can comment on or make changes to this bug.