cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Activiti/JPA example when using Activiti 5.20 in TomCat+MySql

waltable
Champ in-the-making
Champ in-the-making
I have slighted changed activiti-spring-jpa example that is shiped with Activiti 5.20 to use MySql.
It worked fine when using JUnit, however, when I deployed it in TomCat I got an exception

21-May-2016 23:44:05.903 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class org.activiti.explorer.servlet.WebConfigurer
java.lang.NoClassDefFoundError: javax/persistence/ValidationMode

Steps:

a) I have created a clean TomCat 9.0 installation
b) I created a jar file containing the JPAStringTest java files and configuration files
c) I placed this jar file inside C:\Tomcat 9.0\webapps\activiti-explorer-5.20\WEB-INF\lib
d) I placed the configuration files into C:\Tomcat 9.0\webapps\activiti-explorer-5.20\WEB-INF\classes

I am attaching the exception and configuration files.

My guess is that there is a conflict between the libraries used by the example and the libraries used by activiti 5.20
4 REPLIES 4

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

Is ValidationMode in the class path?

Regards
Martin

waltable
Champ in-the-making
Champ in-the-making
The pom of the activiti-spring example indicates        
<dependency>
            <groupId>javax.persistence</groupId>
            <artifactId>persistence-api</artifactId>
            <scope>provided</scope>
  </dependency>

the local Maven repository download two jars when generating activiti

javax.persistance.1.0 & javax.persistance.1.0.2

javax/persistence/ValidationMode is not available in any of these jars

Checking in the internet, I saw the following explanation:

This error occurs because JPA 1 API is brought in, but method getValidationMode exists only since JPA 2.

However, I do not know what jar would be compatible with activiti.

What puzzle me is that I am just using activiti spring example with is bundle with the distribution. It works fine when using JUnit test, but fails when deployed in TomCat inside activiti-explorer.war

Therefore, the activiti-explorer.war may be incomplete (missing a required jar, but which one should be added?)




waltable
Champ in-the-making
Champ in-the-making
I was finally able to find the issue Smiley Sad
Activiti pom's indicates (by design) that JPA, hibernate, javax, etc to have test or provided scope. Therefore, the required libraries are not included in the activiti war file. In addition, activiti pom indicates javax.persistance 1.0. Most of hibernate 4.x libraries use a new version. The issue was to find a consistent set of libraries to correctly deploy with activiti.

jbarrez
Star Contributor
Star Contributor
Thanks for posting the solution you found!