Bug 778779 (SOA-1234) - Seam applications include jBPM JAR and cause ClassCastExceptions - SEAM sample "DVDStore" app fails
Summary: Seam applications include jBPM JAR and cause ClassCastExceptions - SEAM sampl...
Keywords:
Status: CLOSED WONTFIX
Alias: SOA-1234
Product: JBoss Enterprise SOA Platform 4
Classification: JBoss
Component: JBPM - within SOA
Version: 4.3 GA
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: FUTURE
Assignee: Kevin Conner
QA Contact:
URL: http://jira.jboss.org/jira/browse/SOA...
Whiteboard:
Depends On:
Blocks: SOA-1673
TreeView+ depends on / blocked
 
Reported: 2009-03-17 14:09 UTC by Burr Sutter
Modified: 2011-11-01 20:16 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Standard SOA Platform 4.3 Distribution
Last Closed: 2011-11-01 20:16:53 UTC
Type: Bug


Attachments (Terms of Use)
ManagedJbpmContext.java (4.80 KB, text/plain)
2009-04-08 16:00 UTC, Kevin Conner
no flags Details
seam.diffs (8.37 KB, application/octet-stream)
2009-06-10 11:27 UTC, Kevin Conner
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker SOA-1234 0 None None None Never

Description Burr Sutter 2009-03-17 14:09:36 UTC
Date of First Response: 2009-03-17 10:56:10
project_key: SOA

SOA Platform ships at least 2 jbpm-jpdl.jars:
-  seamfp\lib\jbpm-jpdl.jar - this one is included with any MySeamApp.ear that is created
- jboss-as\server\default\deploy\jbpm.esb\jbpm-jpdl.jar - this one is already "in container"

If you take Seam DVDStore and include a use of EsbNotifier or EsbActionHandler in its JPDL (e.g. ordermanagement1.jpdl.xml) like so:
          <action name="ShipItAction"					class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbNotifier">
	<esbCategoryName>FirstServiceESB</esbCategoryName>
	<esbServiceName>SimpleListener</esbServiceName>
         </action>
   
The result is a classcastexception since we have two copies of jBPM

Comment 1 Burr Sutter 2009-03-17 14:44:08 UTC
From Jay B: 
"The problem is that /server/default/deploy/jbpm.esb is in a different classloader branch and so the jar is not visible out side of it.  If the jar is in the /server/default/lib then it would ( or should ) be shared by all below it - i.e. the deployed apps"

Comment 2 Mike Harvey 2009-03-17 14:56:10 UTC
Assigned to Ondrej Skutka, JBoss SEam QE

Comment 3 Mike Harvey 2009-03-17 14:57:20 UTC
My bad, I don't think this should go to Ondrej yet.  Unassigned.

Comment 4 Mark Little 2009-03-17 15:27:14 UTC
Is this the Seam FP? I thought the FP had the same versions of jBPM as the SOA-P GA?

Comment 5 Burr Sutter 2009-03-17 15:40:42 UTC
This is related to "seamfp" in the distro, it could be that the JARs are identical but the problem is that we are loading this both twice and that the container could be instantiating the EsbActionHandler (or EsbNotifier) from one classloader (e.g. jbpm.esb/jbpm-jpdl.jar) and the jBPM Action interface from mySeamApp.ear.

The Seam recommendation is to place jbpm-jpdl.jar in your Seam-based .ear.  

Or as Jay B stated "remove the jar from both locations and drop into default/lib" which I've not tried.

Note: the solution should also apply to the drools jars as well.


Comment 6 Burr Sutter 2009-03-18 12:12:49 UTC
More detailed steps to reproduce:
1) quickstart\helloworld - ant deploy
2) quikcstart\helloworld - ant runtest (verify it work)
3) Add EsbNotifier targeting Hello World into
seamfp\examples\dvdstore\resources\ordermanagement1.jpdl.xml like so
           <action name="ShipItAction"
                            class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbNotifier">
                            <esbCategoryName>FirstServiceESB</esbCategoryName>
                            <esbServiceName>SimpleListener</esbServiceName>
                        </action>
4) in seamfp\examples\dvdstore - ant
5) copy the generated .ear to the deploy directory
6) http://localhost:8080/seam-dvd
7) buy a DVD as user1, password
8) sign-in as manager
9) Approve/ship the order - get to the point in the workflow that triggers EsbNotifier.

Comment 7 Burr Sutter 2009-03-31 19:03:46 UTC
Potential work-around:
1. Ensure that the ONLY copy of jbpm-jpdl.jar exists in  $SOAP_HOME/jbpm-jpdl. This means that you'll have to get rid of a few copies of said jar, including the one that seam-gen will try to install in your WAR/EAR.

2. In your Seam components.xml file, add the following. Note that you will NOT be specifying the process definitions here, even if they exist within the EAR. My process definitions did for the example app that I wrote.

<bpm:jbpm>
     <bpm:process-definitions></bpm:process-definitions>
     <bpm:pageflow-definitions></bpm:pageflow-definitions>
</bpm:jbpm>

3. Next, let's modify the jbpm-cfg.xml file in the jbpm.esb archive (found in $JBOSS_HOME/server/$JBOSS_SERVER/deploy). Here, you'll need to change the persistence service factory from the JtaPersistenceServiceFactory to org.jbpm.persistence.db.DbPersistenceServiceFactory.

4.  Do *not* include a copy of hibernate.cfg.xml or jbbpm.cfg.xml in the Seam EAR that you deploy. Also, do not include the process definitions in that EAR. Instead, export the process as a .par and deployed it through jBPM admin tool (step 6).

5. Now comes the jBPM/ESB integration. We can start by using the ESB service node that's available OOTB from jBPM -- just point it to your desired web service.

6. Now, deploy your process archive (.par) to BPM using the BPM deployer, and make sure that your ESB archive is deployed as well.

Comment 8 Kevin Conner 2009-04-07 09:40:02 UTC
Please note, there is an issue with the workaround included by Burr wrt the jBPM configuration.  I am already working through this with a consultant.

Comment 9 Kevin Conner 2009-04-08 15:58:40 UTC
I believe the following modified seam ManagedJbpmContext  is necessary in order to use the jBPM jta persistence.

Comment 10 Kevin Conner 2009-04-08 16:00:36 UTC
Attachment: Added: ManagedJbpmContext.java


Comment 11 Kevin Conner 2009-04-08 16:02:12 UTC
The attached ManagedJbpmContext manages the jBPM context around the transaction lifecycles, closing the jBPM context prior to the transaction termination and recreating on subsequent transactions.

Comment 12 Pete Muir 2009-04-14 11:04:57 UTC
Link: Added: This issue is related to JBSEAM-4110


Comment 13 Marek Novotny 2009-04-14 11:22:30 UTC
Link: Added: This issue is duplicated by JBPAPP-1883


Comment 14 Kevin Conner 2009-06-10 11:27:53 UTC
Further work was done on this and the following diffs were provided to the seam team.

Comment 15 Kevin Conner 2009-06-10 11:27:53 UTC
Attachment: Added: seam.diffs


Comment 16 Martin Vecera 2009-12-01 14:58:27 UTC
Link: Added: This issue is a dependency of JBQA-2518


Comment 18 Martin Vecera 2009-12-04 16:46:15 UTC
Link: Added: This issue is a dependency of SOA-1673


Comment 19 David Le Sage 2010-02-09 06:25:37 UTC
I have added this draft text to the Release Notes:


https://jira.jboss.org/jira/browse/SOA-1234

    There is a problem running Seam applications, such as the "DVDStore" sample, causing
    ClassCastExceptions. This error occurs because Seam assumes that jBPM is embedded
    within the deployment, resulting in two copies being run.


Comment 20 Anne-Louise Tangring 2010-02-25 18:34:16 UTC
This issue is not approved for SOA 4.3 CP03. If this needs to be reconsidered, please raise the issue with the SOA PM team.

Comment 21 trev 2010-03-09 11:13:32 UTC
issues documented as far as possible for the 5.0.0 release, will need further work for a final resolution.


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