Announcement Announcement Module
No announcement yet.
Ehcache problems with Hibernate 3.2 Page Title Module
Move Remove Collapse
Conversation Detail Module
  • 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 AutowireCapableBeanFactory.initializeBean(Abstract
    at AutowireCapableBeanFactory.createBean(AbstractAuto
    at BeanFactory$1.getObject( 42)
    at ingletonBeanRegistry.getSingleton(DefaultSingleton
    at BeanFactory.getBean(
    at BeanFactory.getBean(
    at istableBeanFactory.preInstantiateSingletons(Defaul
    at ationContext.refresh(AbstractApplicationContext.ja va:348)
    at plicationContext.<init>(ClassPathXmlApplicationCon
    at plicationContext.<init>(ClassPathXmlApplicationCon
    at org.jnovice.tests.dao.HibernateBaseTestcase.<clini t>(
    ... 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
    at org.hibernate.impl.SessionFactoryImpl.<init>(Sessi
    at org.hibernate.cfg.Configuration.buildSessionFactor y(
    at org.springframework.orm.hibernate3.LocalSessionFac toryBean.newSessionFactory(LocalSessionFactoryBean .java:901)
    at org.springframework.orm.hibernate3.LocalSessionFac toryBean.afterPropertiesSet(LocalSessionFactoryBea
    at AutowireCapableBeanFactory.invokeInitMethods(Abstr
    at AutowireCapableBeanFactory.initializeBean(Abstract
    ... 20 more

    DAO configuration


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

    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
    <property name="dataSource">
    <ref bean="dataSource" />
    <property name="configLocation">
    <property name="configurationClass">
    <value>org.hibernate.cfg.AnnotationConfiguration </value>
    <property name="hibernateProperties">
    <prop key="hibernate.dialect">org.hibernate.dialect.MySQ LInnoDBDialect</prop>
    <prop key="">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>

    Thanks in advance

    Rafael Nami


    • #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).


      • #4
        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.


        Rafael Nami


        • #5
          ehcache 1.2.3

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


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

            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,