Bug 1043663

Summary: ClassNotFoundExceptions when deploying idempotent consumer with JpaMessageIdRepository
Product: [JBoss] JBoss Fuse Service Works 6 Reporter: Daniel Tschan, Puzzle ITC <tschan+redhat>
Component: SwitchYardAssignee: Tomohisa Igarashi <toigaras>
Status: MODIFIED --- QA Contact: Matej Melko <mmelko>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.0.0CC: atangrin, jcordes, serviceworks, soa-p-jira, toigaras
Target Milestone: DR1   
Target Release: 6.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
If you attempt to run an Idempotent JPA consumer, ClassNotFoundExceptions will be raised for the Spring and Hibernate components. To work around this problem, you must make two changes, the first being to a Camel module within the server and the second to your application: Edit the JBOSS_HOME/modules/system/layers/soa/org/apache/camel/jpa/main/module.xml file to include the following module dependencies: <programlisting> <![CDATA[ <module name="org.hibernate"/> <module name="org.javassist"/> ]]> </programlisting> Secondly, modify your application so that it contains a APP/src/main/resources/META-INF/jboss-deployment-structure.xml file, (specifying a dependency on the Spring framework). <programlisting> <![CDATA[ <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1"> <deployment> <dependencies> <module name="org.springframework"/> </dependencies> </deployment> </jboss-deployment-structure> ]]> </programlisting>
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Daniel Tschan, Puzzle ITC 2013-12-16 20:52:41 UTC
Description of problem:
When trying to deploying an idempotent consumer with a JpaMessageIdRepository to JBoss Fuse ServiceWorks multiple ClassNotFoundExceptions occur.

Version-Release number of selected component (if applicable):
JBoss Fuse ServiceWorks Beta (Build ER6)

How reproducible:
Always, see test case here: https://github.com/dtschan/switchyard-idempotent-jpa

Steps to Reproduce:
1. Set JBOSS_HOME to an installation of JBoss Fuse ServiceWorks Beta
1. "mvn package -DskipTest"
2. "mvn test" or run test in JBoss Developer Studio

Actual results:
Test fails because of multiple ClassNotFoundExceptions. Various Spring classes required by the Camel version used by JBoss FSW, like PlatformTransactionManager or JpaTemplate, cannot be found.
Additionally a ClassNotFoundException regarding HibernateProxy is thrown.

Expected results:
Test succeeds.

Additional info:
Workaround:
In the file "modules/system/layers/soa/org/apache/camel/jpa/main/module.xml"
replace the line
  <module name="org.springframework"/> 
with
  <module name="org.springframework" export="true"/> 
 
Now the test succeeds. However this is not a good solution, as now the whole spring stack is exported. Additionally the ClassNotFoundException regarding HibernateProxy is still thrown.

Comment 3 Tomohisa Igarashi 2013-12-18 04:28:51 UTC
Your application works with following 2 changes:

1) Add ${APP}/src/main/resources/META-INF/jboss-deployment-structure.xml:
----------
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">  
    <deployment>  
        <dependencies>  
            <module name="org.springframework"/>  
        </dependencies>  
    </deployment>
</jboss-deployment-structure>  
----------

2) Modify ${JBOSS_HOME}/modules/system/layers/soa/org/apache/camel/jpa/main/module.xml:
----------
@@ --- org.apache.camel.jpa-module.xml.orig	2013-12-18 13:14:36.338589593 +0900
+++ jboss-eap-6.1/modules/system/layers/soa/org/apache/camel/jpa/main/module.xml	2013-12-18 13:17:58.502034223 +0900 -23,6 +23,8
         <module name="org.apache.camel.core"/>
         <module name="org.apache.camel.spring"/>
         <module name="org.apache.commons.logging"/>
+        <module name="org.hibernate"/>
+        <module name="org.javassist"/>
         <module name="org.springframework"/>
         <module name="org.slf4j"/>
     </dependencies>
----------

Maybe we can add 2) by default in the FSW at some point.