Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is a IncompatibleClassChangeError exception in Java?
    primarykey
    data
    text
    <p>i am working on a small application and I am trying to use Hibernate Annotations to map my entities. I wanted to test if everything is alright when i got this exception : </p> <pre><code> Exception in thread "main" java.lang.ExceptionInInitializerError at fr.cc2i.intervention.dao.main.Main$HibernateUtil.&lt;clinit&gt;(Main.java:48) at fr.cc2i.intervention.dao.main.Main.test(Main.java:21) at fr.cc2i.intervention.dao.main.Main.main(Main.java:32) Caused by: java.lang.IncompatibleClassChangeError: Implementing class at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632) at java.lang.ClassLoader.defineClass(ClassLoader.java:616) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at fr.cc2i.intervention.dao.main.Main$HibernateUtil.&lt;clinit&gt;(Main.java:44) ... 2 more </code></pre> <p>Can someone explain what is this exception ? This is the first time i see it. Here is the main of my application : </p> <pre><code> package fr.cc2i.intervention.dao.main; import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.AnnotationConfiguration; import fr.cc2i.intervention.dao.beans.Client; import fr.cc2i.intervention.dao.beans.Contrat; public class Main { public static void test(){ Client c = new Client(); c.setCode("123343"); c.setAdresse("fkhdhdmh"); c.setNom("dgsfhgsdfgs"); c.setPhone("53456464"); c.setContrat(new Contrat()); Session session = HibernateUtil.getSession(); session.beginTransaction(); session.save(c); session.getTransaction().commit(); } /** * @param args */ public static void main(String[] args) { Main.test(); } public static class HibernateUtil { private static final SessionFactory sessionFactory; static { try { sessionFactory = new AnnotationConfiguration() .configure().buildSessionFactory(); } catch (Throwable ex) { // Log exception! throw new ExceptionInInitializerError(ex); } } public static Session getSession() throws HibernateException { return sessionFactory.openSession(); } } } </code></pre> <p>My hibernate config is very simple : </p> <pre><code> &lt;!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt; &lt;hibernate-configuration&gt; &lt;session-factory&gt; &lt;!-- Database connection settings --&gt; &lt;property name="connection.driver_class"&gt;org.hsqldb.jdbcDriver&lt;/property&gt; &lt;property name="connection.url"&gt;jdbc:hsqldb:hsql://localhost&lt;/property&gt; &lt;property name="connection.username"&gt;sa&lt;/property&gt; &lt;property name="connection.password"&gt;&lt;/property&gt; &lt;!-- JDBC connection pool (use the built-in) --&gt; &lt;property name="connection.pool_size"&gt;1&lt;/property&gt; &lt;!-- SQL dialect --&gt; &lt;property name="dialect"&gt;org.hibernate.dialect.HSQLDialect&lt;/property&gt; &lt;!-- Enable Hibernate's automatic session context management --&gt; &lt;property name="current_session_context_class"&gt;thread&lt;/property&gt; &lt;!-- Disable the second-level cache --&gt; &lt;property name="cache.provider_class"&gt;org.hibernate.cache.NoCacheProvider&lt;/property&gt; &lt;!-- Echo all executed SQL to stdout --&gt; &lt;property name="show_sql"&gt;true&lt;/property&gt; &lt;!-- Drop and re-create the database schema on startup --&gt; &lt;property name="hbm2ddl.auto"&gt;update&lt;/property&gt; &lt;mapping package="fr.cc2i.intervention.dao.beans.Client" /&gt; &lt;mapping class="fr.cc2i.intervention.dao.beans.Contrat" /&gt; &lt;mapping class="fr.cc2i.intervention.dao.beans.Intervention" /&gt; &lt;mapping class="fr.cc2i.intervention.dao.beans.Technicien" /&gt; &lt;/session-factory&gt; &lt;/hibernate-configuration&gt; </code></pre> <p>Here is the hibernate maven dependency i am using :</p> <pre><code>&lt;properties&gt; &lt;org.springframework.version&gt;3.0.3.RELEASE&lt;/org.springframework.version&gt; &lt;hibernate.version&gt;3.6.0.Beta1&lt;/hibernate.version&gt;&lt;/properties&gt; &lt;dependency&gt; &lt;groupId&gt;org.hibernate&lt;/groupId&gt; &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt; &lt;version&gt;${hibernate.version}&lt;/version&gt; &lt;type&gt;jar&lt;/type&gt; &lt;scope&gt;compile&lt;/scope&gt; &lt;/dependency&gt; </code></pre> <p>Can someone help me please ??</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload