java.lang.IncompatibleClassChangeError for using org.hibernate.cfg.AnnotationConfiguration
I've just started using hibernate annotations for my POJO mappings in my Sping+Hibernate based project (JDK 1.6.0_23) and I'm getting this error regarding incompatibility between classes. The sessionFactory is configured as:
<bean id="sessionFactory"
class="org.springfram开发者_高级运维ework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="configLocation" value="classpath:hibernate.cfg.xml"/>
<property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration" />
<property name="namingStrategy">
<bean class="org.hibernate.cfg.ImprovedNamingStrategy" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">no</prop>
<prop key="hibernate.connection.isolation">3</prop>
<prop key="hibernate.transaction.factory_class">com.atomikos.icatch.jta.hibernate3.AtomikosJTATransactionFactory </prop>
<prop key="hibernate.transaction.manager_lookup_class">com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup</prop>
</props>
</property>
</bean>
In my Maven project file I've set the following dependencies: javax.persistence persistence-api 1.0 jar false org.hibernate hibernate-annotations ${hibernate.version} jar false org.hibernate hibernate-core ${hibernate.version} jar false org.hibernate hibernate-ehcache ${hibernate.version} jar false 2.5.5 3.5.6-Final 0.5
Could anyone give me a hint as to how to solve the problem? Thank you
Peter
I had the same problem but you can find the answers here : What is a IncompatibleClassChangeError exception in Java?
it could be due to older version of hibernate entity manager or hibernate annotation, which is not match if you use newest hibernate core jar. check both jars and try to upgrade it to newest version 3.5.x
精彩评论