-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate, EhCache und TransactionManager
PostPosted: Thu Jan 06, 2011 6:29 am 
Beginner
Beginner

Joined: Thu Jan 06, 2011 6:19 am
Posts: 25
Hallo,

ich bin neu hier und auch im Thema Hibernate.

Ich habe bisher mit einer älteren Hibernate-Version gearbeitet und wollte nun auf hibernate-core 3.6.0.Final aktualisieren. Dabei habe ich auch meine Ehcache-Abhängigkeit von 1.5.0 auf 2.3.0 (ehcache-core) aktualisiert und nun bekomme ich beim Starten meiner Tests folgenden Fehler:

Code:
Caused by: java.lang.NoSuchMethodError: net.sf.ehcache.config.Configuration.setDefaultTransactionManager(Ljava/lang/Object;)V
   at net.sf.ehcache.hibernate.EhCacheRegionFactory.start(EhCacheRegionFactory.java:70)
   at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:236)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1842)
   at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:814)
   at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:732)


Ich verwende deb JDBC-basierten Transaktionmanager in meiner Hibernate-Konfiguration wie folgt:

Code:
<tx:annotation-driven transaction-manager="mytransactionManager"/>
<bean id="mytransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
   <property name="sessionFactory" ref="mySessionFactory" />
</bean>


An der SessionFactory definiere ich die Hibernate-Properties, u.a. auch Cache Factory Class wie folgt:

Code:
     <bean id="mySessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
      <property name="dataSource" ref="${...}" />
      <property name="annotatedClasses">
         <list>
            ....
         </list>
      </property>
      <property name="hibernateProperties">
         <props>
          <prop key="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.EhCacheRegionFactory</prop>
            <prop key="hibernate.cache.use_second_level_cache">true</prop>
            <prop key="hibernate.cache.use_minimal_puts">true</prop>
            <prop key="hibernate.cache.use_query_cache">true</prop>
                                 ....
         </props>
      </property>
   </bean>


Was mache ich falsch? Muss ich einen anderen TransactionManager verwenden?

Grüße,
Jacqueline.


Top
 Profile  
 
 Post subject: Re: Hibernate, EhCache und TransactionManager
PostPosted: Thu Jan 06, 2011 9:29 am 
Beginner
Beginner

Joined: Thu Jan 06, 2011 6:19 am
Posts: 25
Gelöst!

Es lagen mehrere (zwei) ehcache Abhängigkeiten im classpath.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.