-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: IncompatibleClassChangeError (Hibernate 3.2)
PostPosted: Wed Oct 25, 2006 4:18 am 
Newbie

Joined: Wed Oct 25, 2006 2:41 am
Posts: 7
Hibernate version:

3.2

Mapping documents:

persist.xml (in META-INF which also contains correctly populated services directory containing persistence providers)...

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/ ... ce_1_0.xsd"
version="1.0">

<persistence-unit name="sample" transaction-type="RESOURCE_LOCAL">
<class>com.somedomain.adhoc.ejb3.Person</class>

<properties>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.username" value="root" />
<property name="hibernate.connection.password" value="root" />
<property name="hibernate.connection.url" value="jdbc:mysql://localhost/test" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
<property name="hibernate.hbm2ddl.auto" value="update" />
</properties>

</persistence-unit>
</persistence>



Code between sessionFactory.openSession() and session.close():


EntityManagerFactory emf = Persistence.createEntityManagerFactory("sample", new HashMap());
EntityManager em = emf.createEntityManager();
EntityTransaction tx = em.getTransaction();
tx.begin();
em.persist(new Person("Ben Franklin"));
tx.commit();
em.close();


Full stack trace of any exception that occurs:

Exception in thread "main" java.lang.IncompatibleClassChangeError
at org.hibernate.ejb.Version.<clinit>(Version.java:15)
at org.hibernate.ejb.Ejb3Configuration.<clinit>(Ejb3Configuration.java:112)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:119)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
at com.webfuture.adhoc.ejb3.Runner.run(Runner.java:31)
at com.webfuture.adhoc.ejb3.Runner.main(Runner.java:16)

Name and version of the database you are using:

MySQL 5.0.21

The generated SQL (show_sql=true):

N/A - does not get that far

Debug level Hibernate log excerpt:

N/A

Tried using binaries found here. After that did not work, tried compiling using source supplied in the above downloads, but to no avail (same issue).

Are the classes in the distribution compatiable with each other?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 25, 2006 12:01 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
yes they are. Whcih VM are you using?

_________________
Emmanuel


Top
 Profile  
 
 Post subject: MySQL Log4j
PostPosted: Wed Oct 25, 2006 1:31 pm 
Newbie

Joined: Wed Oct 25, 2006 2:41 am
Posts: 7
After further debugging, it looks as if the problem centers on the incompatibility of log4j classes in the MySQL distribution compared with those of the Hibnerate 3.2 distribution.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 25, 2006 8:13 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Hibernate has not hard dependency on log4j
We use commons logging as an abstraction

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 17, 2006 11:55 am 
Beginner
Beginner

Joined: Thu Nov 16, 2006 11:34 am
Posts: 26
Location: Boston
I had the same problem and was solved.

One of the reasons could be checking any incompatible hibernate jars in your distribution (App server like JBoss 4.X Vs your own application's WEB-INF/lib).


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.