Announcement Announcement Module
Collapse
No announcement yet.
Ehcache problems with Hibernate 3.2 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ehcache problems with Hibernate 3.2

    Hi everyone
    I'm currently upgrading our architecture, that uses Hibernate, Spring and JSF to brand new versions of each framework.
    (Spring 1.2.7 to 2.0, Hibernate 3.1 to 3.2 and JSF/MyFaces 1.1 to the new release).
    Now I'm stuck in a EhCache problem, that says that a method init is being called from a different class than the expected (EhCacheProvider instead of CacheManager).

    How can I prevent this kind of behavior?

    Thanks and best regards

  • #2
    More informations:
    Exception ocurring

    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sessionFactory' defined in URL [file:/C:/rafa/lucas/saturn/web/WEB-INF/classes/contextoTesteDao.xml]: Invocation of init method failed; nested exception is java.lang.IllegalAccessError: tried to access method net.sf.ehcache.CacheManager.<init>()V from class org.hibernate.cache.EhCacheProvider
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:927)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:415)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 42)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:141)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:239)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:155)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:297)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:348)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:92)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:77)
    at org.jnovice.tests.dao.HibernateBaseTestcase.<clini t>(HibernateBaseTestcase.java:59)
    ... 10 more
    Caused by: java.lang.IllegalAccessError: tried to access method net.sf.ehcache.CacheManager.<init>()V from class org.hibernate.cache.EhCacheProvider
    at org.hibernate.cache.EhCacheProvider.start(EhCacheP rovider.java:124)
    at org.hibernate.impl.SessionFactoryImpl.<init>(Sessi onFactoryImpl.java:180)
    at org.hibernate.cfg.Configuration.buildSessionFactor y(Configuration.java:1213)
    at org.springframework.orm.hibernate3.LocalSessionFac toryBean.newSessionFactory(LocalSessionFactoryBean .java:901)
    at org.springframework.orm.hibernate3.LocalSessionFac toryBean.afterPropertiesSet(LocalSessionFactoryBea n.java:827)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:957)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:924)
    ... 20 more

    DAO configuration

    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
    "http://www.springframework.org/dtd/spring-beans.dtd">

    <!--
    #### DAO Context : Contém as configurações de acesso aos dados da Aplicacao. ####
    -->
    <beans>
    <bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
    <property name="driverClassName">
    <value>com.mysql.jdbc.Driver</value>
    </property>
    <property name="url">
    <value>jdbc:mysql://localhost:3306/g7</value>
    </property>
    <property name="username">
    <!-- value>g7</value> -->
    <value>root</value>
    </property>
    <property name="password">
    <value></value>
    <!-- value>g7java</value> -->
    </property>
    </bean>

    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
    <property name="dataSource">
    <ref bean="dataSource" />
    </property>
    <property name="configLocation">
    <value>hibernate-cfg.xml</value>
    </property>
    <property name="configurationClass">
    <value>org.hibernate.cfg.AnnotationConfiguration </value>
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">org.hibernate.dialect.MySQ LInnoDBDialect</prop>
    <prop key="hibernate.hbm2ddl.auto">update</prop>
    <prop key="hibernate.show_sql">true</prop>
    <!-- <prop key="transaction.factory_class">org.hibernate.tran saction.JTATransactionFactory</prop> -->
    <prop key="hibernate.cache.provider_class">org.hibernate .cache.EhCacheProvider</prop>
    <prop key="net.sf.ehcache.configurationResourceName">ehc ache.xml</prop>
    </props>
    </property>
    </bean>

    Thanks in advance

    Rafael Nami

    Comment


    • #3
      If you are using Hibernate 3.2 make sure you use the proper EhCache version (which is 1.2 at least I think) (ehcache is already provided with Hibernate).

      Comment


      • #4
        Costin
        I'm already using EHCACHE 1.2, but still it's failing.
        For now, I've switched to OSCache, and it's working.
        Tonight I'll try again.

        Thanks

        Rafael Nami

        Comment


        • #5
          ehcache 1.2.3

          try to Update to ehcache 1.2.3. I had the same problem and it resolved in that version.

          Comment


          • #6
            can you tell me how to resolve the above problem

            Hi,
            I am also getting same problem, I am not able to proceed further.
            Please tell me the procedure to solve out this problem.



            Thanks in Advance,
            SAikumar

            Comment

            Working...
            X