I use Tomcat 8 to deploy my servlets.
My environnement uses :
- postgres 9.6 / jdbc driver 42
- hibernate 4.3.11
- emf 2.11
- teneo 2.1.0 (2017)
- spring 4.3
- cxf 3.1.11
I use spring to load my bean from XML, CXF to expose my servlets and my webservices. My modeling is built with EMF and i use teneo to have the session factory (and create the hibernate mapping from my emf model).
When the servlet is launched i've the following errors after the teneo initialize :
A) when I put teneo into the common tomcat classloader
Caused by: java.lang.NoClassDefFoundError: org/hibernate/collection/AbstractPersistentCollection
at org.eclipse.emf.teneo.hibernate.EMFInterceptor.<clinit>(EMFInterceptor.java:91)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.eclipse.emf.teneo.classloader.ClassLoaderResolver.classForName(ClassLoaderResolver.java:50)
at org.eclipse.emf.teneo.extension.DefaultExtensionManager.getExtension(DefaultExtensionManager.java:127)
at org.eclipse.emf.teneo.extension.DefaultExtensionManager.getExtension(DefaultExtensionManager.java:254)
at org.eclipse.emf.teneo.hibernate.HbContext.createInterceptor(HbContext.java:87)
at org.eclipse.emf.teneo.hibernate.HbSessionDataStore.setInterceptor(HbSessionDataStore.java:158)
at org.eclipse.emf.teneo.hibernate.HbDataStore.initializeDataStore(HbDataStore.java:322)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.emf.teneo.hibernate.EMFInterceptor
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.eclipse.emf.teneo.classloader.ClassLoaderResolver.classForName(ClassLoaderResolver.java:50)
at org.eclipse.emf.teneo.extension.DefaultExtensionManager.getExtension(DefaultExtensionManager.java:127)
at org.eclipse.emf.teneo.extension.DefaultExtensionManager.getExtension(DefaultExtensionManager.java:254)
at org.eclipse.emf.teneo.hibernate.HbContext.createInterceptor(HbContext.java:87)
at org.eclipse.emf.teneo.hibernate.HbSessionDataStore.setInterceptor(HbSessionDataStore.java:158)
at org.eclipse.emf.teneo.hibernate.HbDataStore.initializeDataStore(HbDataStore.java:322)
at org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initialize(HbSessionDataStore.java:106)
searching old class from hibernate 3.x, in hibernate 4.x its into internal package...how to change that ?
its a classloader problem...in the common classloader of tomcat I declared (with the common.loader property) all jar (including emf, teneo...). The default classloader of teneo.hibernate is the ContextClassLoaderStrategy (=> it uses Thread.currentThread().getContextClassLoader()). I tested to change it with the ClassClassLoaderStrategy...doesn't work too :'(
Any idea ?
B) when I put teneo into each Webapp tomcat classloader and in the common tomcat classloader
Caused by: org.eclipse.emf.teneo.extension.TeneoExtensionException: The requested extension org.eclipse.emf.teneo.PersistenceOptions does not implement the inte rface org.eclipse.emf.teneo.extension.ExtensionPoint
30659 at org.eclipse.emf.teneo.extension.DefaultExtensionManager.getExtension(DefaultExtensionManager.java:131)
30660 at org.eclipse.emf.teneo.extension.DefaultExtensionManager.getExtension(DefaultExtensionManager.java:264)
30661 at org.eclipse.emf.teneo.hibernate.HbDataStore.setDataStoreProperties(HbDataStore.java:453)
From teneo code :
Class clz1 = ClassLoaderResolver.classForName(extension.getClassName());
/* */
/* */
/* 132 */ if(!ExtensionPoint.class.isAssignableFrom(clz1)) {
/* 133 */ throw new TeneoExtensionException("The requested extension " + clz1.getName() + " does not implement the interface " + ExtensionPoint.class.getName());
/* */
I'm lost ^^ any idea ?
[Updated on: Fri, 14 April 2017 13:29]
Report message to a moderator