Discussion:
Hibernate 3.2 as JPA provider in Websphere 6.1 feature pack 15
(too old to reply)
m***@gmx.de
2008-08-12 10:41:50 UTC
Permalink
Hi,
I’m currently trying to set up Hibernate 3.2 as JPA provider in WebSphere 6.1 with feature pack 15 (Base 6.1.0.15 EJB 3.0 6.1.0.15), but unfortunately without success. After starting my test application, several hibernate log messages show up as expected:

\[12.08.08 11:59:42:381 CEST] 00000019 Version I org.hibernate.cfg.annotations.Version Hibernate Annotations 3.4.0.CR2
\[12.08.08 11:59:42:413 CEST] 00000019 Environment I org.hibernate.cfg.Environment Hibernate 3.3.0.CR2
...
\[12.08.08 11:59:44:694 CEST] 00000019 SettingsFacto I org.hibernate.cfg.SettingsFactory buildSettings Default entity-mode: pojo
\[12.08.08 11:59:44:709 CEST] 00000019 SettingsFacto I org.hibernate.cfg.SettingsFactory buildSettings Named query checking : enabled

A few seconds later a class not found exception is thrown and the application is stopped:

\[12.08.08 11:59:45:334 CEST] 00000019 SystemErr R Caused by: java.lang.NoClassDefFoundError: org.apache.commons.collections.map.LRUMap
at org.hibernate.util.SimpleMRUCache.init(SimpleMRUCache.java:71)
at org.hibernate.util.SimpleMRUCache. (SimpleMRUCache.java:55)
at org.hibernate.util.SimpleMRUCache. (SimpleMRUCache.java:50)
at org.hibernate.engine.query.QueryPlanCache. (QueryPlanCache.java:65)
at org.hibernate.impl.SessionFactoryImpl. (SessionFactoryImpl.java:176)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
at com.ibm.ws.jpa.management.JPAPUnitInfo.getFactory(JPAPUnitInfo.java:978)

From within a session bean, I can successfully instantiate this class (org.apache.commons.collections.map.LRUMap).
The class is contained in commons-collections.jar, which is deployed together with all the other hibernate relevant libraries:
- antlr-2.7.6.jar
- asm-attrs.jar
- asm.jar
- cglib-2.1.3.jar
- commons-collections-2.1.1.jar
- dom4j.jar
- hibernate-annotations.jar
- hibernate-commons-annotations.jar
- hibernate-core.jar
- hibernate-entitymanager.jar
- hibernate-validator.jar
- hibernate3.jar
- javassist.jar
- slf4j-api.jar
- slf4j-jdk14-1.5.2.jar

I've tried several ways to deploy these libraries:
- As part of the ear archive
- As shared libraries configured in the websphere admin console
- With application classloader policy set to PARENT_LAST or PARENT_FIRST

My persistence.xml is:
persistence xmlns="http://java.sun.com/xml/ns/persistence" ....
.
... org.hibernate.ejb.HibernatePersistence
... jdbc/MyDB2DS
...
.....
.....
...
.



Any help appreciated...

thx
Mathias
Randy Schnier
2008-08-12 19:22:48 UTC
Permalink
If you haven't already, you may want to consult the EJB 3.0 feature pack InfoCenter article on Configuring Alternate JPA Providers, at the following URL: http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.ejbfep.multiplatform.doc/info/ae/ae/tejb_jpa3rdparty.html

-- Randy
Post by m***@gmx.de
Hi,
\[12.08.08 11:59:42:381 CEST] 00000019 Version I org.hibernate.cfg.annotations.Version Hibernate Annotations 3.4.0.CR2
\[12.08.08 11:59:42:413 CEST] 00000019 Environment I org.hibernate.cfg.Environment Hibernate 3.3.0.CR2
...
\[12.08.08 11:59:44:694 CEST] 00000019 SettingsFacto I org.hibernate.cfg.SettingsFactory buildSettings Default entity-mode: pojo
\[12.08.08 11:59:44:709 CEST] 00000019 SettingsFacto I org.hibernate.cfg.SettingsFactory buildSettings Named query checking : enabled
\[12.08.08 11:59:45:334 CEST] 00000019 SystemErr R Caused by: java.lang.NoClassDefFoundError: org.apache.commons.collections.map.LRUMap
at org.hibernate.util.SimpleMRUCache.init(SimpleMRUCache.java:71)
at org.hibernate.util.SimpleMRUCache. (SimpleMRUCache.java:55)
at org.hibernate.util.SimpleMRUCache. (SimpleMRUCache.java:50)
at org.hibernate.engine.query.QueryPlanCache. (QueryPlanCache.java:65)
at org.hibernate.impl.SessionFactoryImpl. (SessionFactoryImpl.java:176)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
at com.ibm.ws.jpa.management.JPAPUnitInfo.getFactory(JPAPUnitInfo.java:978)
From within a session bean, I can successfully instantiate this class (org.apache.commons.collections.map.LRUMap).
- antlr-2.7.6.jar
- asm-attrs.jar
- asm.jar
- cglib-2.1.3.jar
- commons-collections-2.1.1.jar
- dom4j.jar
- hibernate-annotations.jar
- hibernate-commons-annotations.jar
- hibernate-core.jar
- hibernate-entitymanager.jar
- hibernate-validator.jar
- hibernate3.jar
- javassist.jar
- slf4j-api.jar
- slf4j-jdk14-1.5.2.jar
- As part of the ear archive
- As shared libraries configured in the websphere admin console
- With application classloader policy set to PARENT_LAST or PARENT_FIRST
persistence xmlns="http://java.sun.com/xml/ns/persistence" ....
.
... org.hibernate.ejb.HibernatePersistence
... jdbc/MyDB2DS
...
.....
.....
...
.
Any help appreciated...
thx
Mathias
m***@yahoo.com
2008-09-17 19:25:43 UTC
Permalink
We are also trying to use Hibernate3.2 as the JPA provoder in Websphere6.1
Are you able to set it up?. Can you please share how to confogure Hibernate as the JPA provider.
I had gone through the Information center , but it would be very helpful if you can tell me what are the steps.
a***@aguasdealicante.es
2008-10-29 20:17:47 UTC
Permalink
Hi,
we are working with Hibernate 3.2 and WebSphere 6.1 feature pack 13, and all libraries are copied into application (EAR), and declarates into web manifest (WAR). It's works fine.

But, your message subject says Hibernate 3.2 but your console output says Hibernate 3.3.0 CR2, really your problem is with 3.3.0 version, no?

I'm trying to port from 3.2 to 3.3.1 version, but i've a lot of problems with slf4j logger. how to make it?

A detail, in 3.3.1 the cglib-2.1.3.jar is rename as hibernate-cglib-repack-2.1_3.jar.

Thanks
Adolfo
a***@aguasdealicante.es
2008-10-30 16:42:25 UTC
Permalink
Hi,
hibernate 3.3.x use commons-collections-3.1.jar
hibernate 3.2.x use commons-collections-2.1.1.jar

The only solution that I found to my sl4j problems is refactory sl4j-api.jar and sl4j-jdk14-1-5.2 into only one sl4j.jar.

My hibernate.properties are:

hibernate.show_sql false
hibernate.dialect org.hibernate.dialect.DB2Dialect
hibernate.connection.datasource java:comp/env/pooldb2
hibernate.connection.release_mode auto
hibernate.cache.provider_class org.hibernate.cache.NoCacheProvider
hibernate.cache.use_second_level_cache false
hibernate.cache.use_query_cache false
hibernate.transaction.factory_class org.hibernate.transaction.CMTTransactionFactory
hibernate.transaction.manager_lookup_class org.hibernate.transaction.WebSphereExtendedJTATransactionLookup
hibernate.transaction.flush_before_completion true
hibernate.transaction.auto_close_session true
hibernate.current_session_context_class jta

I hope this help you.

Regards,
Adolfo

Loading...