Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] Make Teneo/Hibernate work with jcl-over-slf4j replacing org.apache.commons.logging(How to make Teneo/Hibernate work with jcl-over-slf4j replacing org.apache.commons.logging version 1.1.1?)
[Teneo] Make Teneo/Hibernate work with jcl-over-slf4j replacing org.apache.commons.logging [message #1694869] Fri, 08 May 2015 14:50 Go to next message
Timo Rohrberg is currently offline Timo RohrbergFriend
Messages: 69
Registered: September 2011
Location: Karlsruhe
Member
Hello everybody,

I have a weired problem here: I am using Eclipse Teneo/Hibernate version 2.1.0 and everything is running fine as long as I have the bundle org.apache.commons.logging version 1.1.1.v201101211721 activated.

Once I replace the org.apache.commons.logging bundle by the jcl-over-slfj4 bundle in the recent version 1.7.12, I always get the following stack-trace when trying to create an EntityManager instance via the HbEntityDataStore:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.cfg.Configuration
	at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.createConfiguration(HbEntityDataStore.java:199) ~[na:na]
	at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.getConfiguration(HbEntityDataStore.java:350) ~[na:na]
	at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.mapModel(HbEntityDataStore.java:277) ~[na:na]
	at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.initialize(HbEntityDataStore.java:118) ~[na:na]
	at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.getEntityManagerFactory(HbEntityDataStore.java:333) ~[na:na]
	at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.createEntityManager(HbEntityDataStore.java:390) ~[na:na]


I can only speculate that somehow the jcl-over-slf4j bundle version 1.7.12 does not provide what the org.hibernate.cfg.Configuration is expecting. However, the documentation of slf4j clearly states that the jcl-over-slf4j bundle version 1.7.12 provides the same api as org.apache.commons.logging version 1.1.1.

Do you guys have any hint?

Thanks a lot.

Regards
Timo
Re: [Teneo] Make Teneo/Hibernate work with jcl-over-slf4j replacing org.apache.commons.logging [message #1694972 is a reply to message #1694869] Mon, 11 May 2015 06:54 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hey Timo,
Indeed strange, I checked the hibernate configuration code and can only see the slfj being used. But Teneo needs apache
commons logging for its own logging. So can be related to that somehow...

gr. Martin

On 08-05-15 16:50, Timo Rohrberg wrote:
> Hello everybody,
>
> I have a weired problem here: I am using Eclipse Teneo/Hibernate version 2.1.0 and everything is running fine as long as
> I have the bundle org.apache.commons.logging version 1.1.1.v201101211721 activated.
>
> Once I replace the org.apache.commons.logging bundle by the jcl-over-slfj4 bundle in the recent version 1.7.12, I always
> get the following stack-trace when trying to create an EntityManager instance via the HbEntityDataStore:
>
>
> Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.cfg.Configuration
> at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.createConfiguration(HbEntityDataStore.java:199) ~[na:na]
> at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.getConfiguration(HbEntityDataStore.java:350) ~[na:na]
> at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.mapModel(HbEntityDataStore.java:277) ~[na:na]
> at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.initialize(HbEntityDataStore.java:118) ~[na:na]
> at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.getEntityManagerFactory(HbEntityDataStore.java:333) ~[na:na]
> at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.createEntityManager(HbEntityDataStore.java:390) ~[na:na]
>
>
> I can only speculate that somehow the jcl-over-slf4j bundle version 1.7.12 does not provide what the
> org.hibernate.cfg.Configuration is expecting. However, the documentation of slf4j clearly states that the jcl-over-slf4j
> bundle version 1.7.12 provides the same api as org.apache.commons.logging version 1.1.1.
>
> Do you guys have any hint?
>
> Thanks a lot.
>
> Regards
> Timo


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Teneo] Make Teneo/Hibernate work with jcl-over-slf4j replacing org.apache.commons.logging [message #1695627 is a reply to message #1694972] Mon, 18 May 2015 08:41 Go to previous message
Timo Rohrberg is currently offline Timo RohrbergFriend
Messages: 69
Registered: September 2011
Location: Karlsruhe
Member
Hi Martin,

thank you for your answer. Unfortunately, I have been sick last week and could not react to your response.

Now, I further analyzed the problem and could solve it with a slight change in the Teneo dependencies. The problem is that you bundle the SLF4J API version 1.6.1 within the org.hibernate bundle. In my application, I am using a newer version of SLF4J and this leads to the following exception when initializing the hibernate framework:

Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader (instance of org/eclipse/osgi/internal/loader/EquinoxClassLoader) 
of the current class, org/slf4j/LoggerFactory, and the class loader (instance of org/eclipse/osgi/internal/loader/EquinoxClassLoader) for the method's defining class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type org/sl
f4j/ILoggerFactory used in the signature
	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:273) ~[slf4j.api_1.7.12.jar:1.7.12]
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241) ~[slf4j.api_1.7.12.jar:1.7.12]
	at org.jboss.logging.Slf4jLoggerProvider.getLogger(Slf4jLoggerProvider.java:29) ~[na:na]
	at org.jboss.logging.LoggerProviders.find(LoggerProviders.java:33) ~[na:na]
	at org.jboss.logging.LoggerProviders.<clinit>(LoggerProviders.java:28) ~[na:na]
	at org.jboss.logging.Logger.getLogger(Logger.java:2163) ~[na:na]
	at org.jboss.logging.Logger$1.run(Logger.java:2263) ~[na:na]
	at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_25]
	at org.jboss.logging.Logger.getMessageLogger(Logger.java:2227) ~[na:na]
	at org.jboss.logging.Logger.getMessageLogger(Logger.java:2214) ~[na:na]
	at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:194) ~[na:na]
	at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.createConfiguration(HbEntityDataStore.java:199) ~[na:na]
	at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.getConfiguration(HbEntityDataStore.java:350) ~[na:na]
	at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.mapModel(HbEntityDataStore.java:277) ~[na:na]
	at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.initialize(HbEntityDataStore.java:118) ~[na:na]
	at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.getEntityManagerFactory(HbEntityDataStore.java:333) ~[na:na]
	at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.createEntityManager(HbEntityDataStore.java:390) ~[na:na]
	at de.vitasystems.platform.services.persistence.hibernate.internal.HibernatePersistenceService.getEntityManager(HibernatePersistenceService.java:585) ~[na:na]
	at de.vitasystems.platform.services.persistence.hibernate.internal.HibernatePersistenceService.query(HibernatePersistenceService.java:160) ~[na:na]
	at de.vitasystems.platform.services.osgi.auth.impl.internal.AuthorizationServiceImpl.findPermissionInDB(AuthorizationServiceImpl.java:55) ~[na:na]
	at de.vitasystems.platform.services.osgi.auth.impl.internal.AuthorizationServiceImpl.bootstrapPermissions(AuthorizationServiceImpl.java:39) ~[na:na]
	at de.vitasystems.platform.services.rest.patient.impl.internal.KateAppSettingsServiceImpl.activate(KateAppSettingsServiceImpl.java:72) ~[na:na]
	... 42 common frames omitted


I solved the problem by removing the SLF4J API from the org.hibernate bundle and repackaging that bundle (see attached JAR) and the feature. Now, my SLF4J API and implementation is used that I provide via the target platform.

I personally think it is not a good option to bundle third-party-libraries directly within the bundles of the teneo dependencies. This limits the user to the versions of the bundled libraries. Could you at least remove the SLF4J API from the org.hibernate bundle? If you don't want to make that change globally, could you please provide and maintain an alternative version of the org.hibernate bundle without the SLF4J API packaged? That would help us a lot!

Thank you for your help.

Regards
Timo
Previous Topic:ECPProject
Next Topic:[Edapt] Customize load options
Goto Forum:
  


Current Time: Sun Jul 05 12:02:53 GMT 2020

Powered by FUDForum. Page generated in 0.02076 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top