Announcement Announcement Module
Collapse
No announcement yet.
Nested exception is java.lang.IncompatibleClassChange Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Nested exception is java.lang.IncompatibleClassChange

    Hi All,

    I think I have a pretty usual problem. Although my application is successfull in tests, is failed to start on Tomcat 6.0. I use the same applicationContext.xml in both testing and deploying on Tomcat. When I build my tests start and run using applicationContext.xml - so all is well. Unfortunately, when I deploy it throws an exception:

    Code:
    SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IncompatibleClassChangeError: Implementing class
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
            at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
            at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
            at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:557)
            at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
            at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
            at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
            at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
            at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
            at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
            at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
            at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
            at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
            at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
            at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
            at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:521)
            at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1359)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
            at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
            at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
            at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1500)
            at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:849)
            at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:351)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
            at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
            at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
            at java.lang.Thread.run(Thread.java:662)
    Caused by: java.lang.IncompatibleClassChangeError: Implementing class
    From this exception I can't understand which libraries are in conflict state or what had happened...

    my applicationContext.xml

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:context="http://www.springframework.org/schema/context"
    	xmlns:tx="http://www.springframework.org/schema/tx"
    	xmlns:jaxws="http://cxf.apache.org/jaxws"
            xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans
    		http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    		http://www.springframework.org/schema/tx
    		http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
    		http://www.springframework.org/schema/context
    		http://www.springframework.org/schema/context/spring-context-2.5.xsd
    			http://cxf.apache.org/core
    			http://cxf.apache.org/schemas/core.xsd
    			http://cxf.apache.org/jaxws
    			http://cxf.apache.org/schemas/jaxws.xsd">
    
        <context:annotation-config/>
    
        <!--
        This is for configuring the transactional behavior based on annotations. By default the txManager wired,
        should have the bean name "transactionManager" but you can also specify custom a bean name with the
        transaction-manager parameter.
         -->
        <tx:annotation-driven transaction-manager="transactionManager"/>
    
        <!--
        Connection pool. Parameters are located in application.properties file.
         -->
        <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
            <property name="driverClass" value="net.sourceforge.jtds.jdbc.Driver"/>
            <property name="jdbcUrl" value="jdbc:jtds:sqlserver://XCollectDBtest:1111/XCollect_Dev"/>
            <property name="user" value="user"/>
            <property name="password" value="password"/>
            <property name="minPoolSize" value="5"/>
            <property name="maxPoolSize" value="20"/>
            <property name="acquireIncrement" value="1"/>
            <property name="idleConnectionTestPeriod" value="100"/>
            <property name="maxStatements" value="0"/>
            <property name="checkoutTimeout" value="60000"/>
        </bean>
    
        <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"
            destroy-method="destroy">
            <property name="annotatedClasses">
                <list>
                    <value>ru.fasp.xcollector.model.NaturalPerson</value>
                </list>
            </property>
            <property name="dataSource" ref="dataSource"/>
            <property name="hibernateProperties">
                <props>
                    <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
                    <prop key="hibernate.bytecode.use_reflection_optimizer">true</prop>
                    <prop key="hibernate.show_sql">true</prop>
                    <prop key="hibernate.c3p0.min_size">5</prop>
                    <prop key="hibernate.c3p0.max_size">20</prop>
                    <prop key="hibernate.c3p0.timeout">1800</prop>
                    <prop key="hibernate.c3p0.max_statements">50</prop>
                    <prop key="hibernate.cache.use_second_level_cache">true</prop>
                    <prop key="hibernate.cache.use_query_cache">true</prop>
                    <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.infinispan.InfinispanRegionFactory</prop>
                </props>
            </property>
        </bean>
    
        <bean id="transactionManager"
    		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
            <property name="sessionFactory" ref="sessionFactory"/>
        </bean>
    
        <!-- Interceptor for hibernate calls to be able to create and close sessions -->
        <bean id="hibernateInterceptor" class="org.springframework.orm.hibernate3.HibernateInterceptor">
            <property name="sessionFactory" ref="sessionFactory"/>
        </bean>
    
        <!-- Beans' declarations -->
        <!-- Daos' declarations -->
        <bean id="naturalPersonDao" class="ru.fasp.xcollector.dao.impl.NaturalPersonDaoImpl">
            <property name="sessionFactory" ref="sessionFactory"/>
        </bean>
    
        <!-- Spring manage ServiceBean -->
        <bean id="naturalPersonService" class="ru.fasp.xcollector.service.impl.NaturalPersonServiceImpl">
            <property name="naturalPersonDao" ref="naturalPersonDao"/>
        </bean>
    
    </beans>

  • #2
    I can't understand which libraries are in conflict state
    Incompatible Hibernate jars?

    Comment


    • #3
      Hi, Amila!

      I'm using following Hibernate dependencies

      Code:
              <!-- Hibernate framework start-->
      
      <!--        <dependency>
                  <groupId>org.hibernate</groupId>
                  <artifactId>hibernate-core</artifactId>
                  <version>3.5.6-Final</version>
                  <type>pom</type>
              </dependency>
              <dependency>
                  <groupId>org.hibernate</groupId>
                  <artifactId>hibernate-annotations</artifactId>
                  <version>3.5.6-Final</version>
              </dependency>
              <dependency>
                  <groupId>org.hibernate</groupId>
                  <artifactId>hibernate-commons-annotations</artifactId>
                  <version>3.3.0.ga</version>
                  <type>pom</type>
              </dependency>-->
              <!-- This is used for obtaining jdbc connection pool. -->
      <!--        <dependency>
                  <groupId>org.hibernate</groupId>
                  <artifactId>hibernate-c3p0</artifactId>
                  <version>3.5.6-Final</version>
              </dependency>
              <dependency>
                  <groupId>org.hibernate.java-persistence</groupId>
                  <artifactId>jpa-api</artifactId>
                  <version>2.0-cr-1</version>
              </dependency>-->
              <!-- Hibernate framework end -->
      Honestly, I don't have aby idea whether some of them could be in the conflict state or not. Because for me it's really confusing that I can test this app....

      Comment


      • #4
        Hi Laura,

        Isn't hibernate dependencies on your pom.xml commented?

        Anyway, make hibernate-commons-annotations version also same as the other hibernate jars.

        Comment

        Working...
        X