Announcement Announcement Module
Collapse
No announcement yet.
IncompatibleClassChangeError Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • IncompatibleClassChangeError

    I'm trying to setup a working hibernate distribution using spring-mvc.

    The error I'm getting is:

    Code:
    javax.servlet.ServletException: Servlet.init() for servlet springapp threw exception
    	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
    	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
    	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
    	java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    	java.lang.Thread.run(Thread.java:680)
    root cause
    
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [hibernate.hbm.xml]: Invocation of init method failed; nested exception is java.lang.IncompatibleClassChangeError: Implementing class
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    	org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
    	org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
    	org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
    	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    	org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567)
    	org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
    	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
    	org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:631)
    	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:588)
    	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:645)
    	org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:508)
    	org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:449)
    	org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:133)
    	javax.servlet.GenericServlet.init(GenericServlet.java:160)
    	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
    	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
    	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
    	java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    	java.lang.Thread.run(Thread.java:680)
    root cause
    
    java.lang.IncompatibleClassChangeError: Implementing class
    	java.lang.ClassLoader.defineClass1(Native Method)
    	java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    	java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    	java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    	org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2836)
    	org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1160)
    	org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1668)
    	org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546)
    	java.lang.Class.getDeclaredConstructors0(Native Method)
    	java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    	java.lang.Class.getConstructor0(Class.java:2699)
    	java.lang.Class.getDeclaredConstructor(Class.java:1985)
    	org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:104)
    	org.springframework.orm.hibernate3.LocalSessionFactoryBean.newConfiguration(LocalSessionFactoryBean.java:818)
    	org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:549)
    	org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:188)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    	org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
    	org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
    	org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
    	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    	org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567)
    	org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
    	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
    	org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:631)
    	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:588)
    	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:645)
    	org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:508)
    	org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:449)
    	org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:133)
    	javax.servlet.GenericServlet.init(GenericServlet.java:160)
    	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
    	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
    	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
    	java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    	java.lang.Thread.run(Thread.java:680)
    I probably have some incompatible jars installed.

    Here's my pom.xml dependencies contents

    Code:
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-webmvc</artifactId>
    			<version>3.1.1.RELEASE</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-orm</artifactId>
    			<version>3.1.1.RELEASE</version>
    		</dependency>
    		<dependency>
    			<groupId>org.hibernate</groupId>
    			<artifactId>hibernate-entitymanager</artifactId>
    			<version>3.6.10.Final</version>
    		</dependency>
    		<dependency>
    			<groupId>org.hibernate</groupId>
    			<artifactId>hibernate-commons-annotations</artifactId>
    			<version>3.3.0.ga</version>
    		</dependency>
    		<dependency>
    			<groupId>org.hibernate</groupId>
    			<artifactId>hibernate-annotations</artifactId>
    			<version>3.5.6-Final</version>
    		</dependency>
    		<dependency>
    			<groupId>mysql</groupId>
    			<artifactId>mysql-connector-java</artifactId>
    			<version>5.1.18</version>
    		</dependency>

    Code:
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans
    	http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
    	<bean id="sessionFactory"
    		class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    
    		<property name="dataSource">
    			<ref bean="dataSource" />
    		</property>
    
    		<property name="hibernateProperties">
    			<props>
    				<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
    				<prop key="hibernate.show_sql">true</prop>
    			</props>
    		</property>
    
    		<property name="annotatedClasses">
    			<list>
    				<value>org.geiregat.jonas.entity.User</value>
    			</list>
    		</property>
    I have no clue on where to search for compatibility notes or anything like that.
    Any help is appreciated!
    Last edited by jonas_g; Mar 4th, 2012, 10:09 AM.

  • #2
    Hello

    Is that the complete error stack trace?

    About the error shown
    Code:
    org.springframework.beans.factory.BeanCreationException: 
    Error creating bean with name 'sessionFactory' defined in class path resource [hibernate.hbm.xml]: 
    Invocation of init method failed; nested exception is java.lang.IncompatibleClassChangeError: 
    Implementing class
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(...)
    Post the complete sessionFactory bean definition, in your definition you are not closing the bean with </bean>, so I could assume there are more properties defined there, perhaps some of them is the problem

    BTW If you are working with MySQL 5, you have avalable MySQL5Dialect
    BTW If you are working with Spring 3.1 why in your hibernate.hbm.xml appear spring-beans-2.5.xsd yet?

    Post your dataSource bean definition too

    Comment

    Working...
    X