3 Replies Latest reply on Oct 23, 2009 8:38 AM by Pascal Schmiel

    ClassCastExeption

    Pascal Schmiel Newbie

      Hi,

      I have configured JBossCache as 2nd lvl cache for Hibernate.
      I use Tomcat 5.5 as servlet container, JOTM, Hibernate 3.3.2GA and JBoss Cache 3.2.0.

      When starting my app it dies with the following error:

      Caused by: java.lang.ClassCastException: org.hibernate.cache.jbc2.MultiplexedJBossCacheRegionFactory cannot be cast to org.hibernate.cache.RegionFactory
       at org.hibernate.cfg.SettingsFactory.createRegionFactory(SettingsFactory.java:384)


      The relevant part of my configuration looks like this:

      <property name="hibernateProperties">
       <props>
       <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
       <prop key="hibernate.query.substitutions">true 1, false 0</prop>
       <prop key="hibernate.show_sql">${db.showSql}</prop>
       <prop key="hibernate.connection.autoReconnect">true</prop>
       <prop key="hibernate.connection.autoReconnectForPools">true</prop>
       <prop key="hibernate.connection.release_mode">auto</prop>
       <prop key="hibernate.connection.is-connection-validation-required">true</prop>
      
       <prop key="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JOTMTransactionManagerLookup</prop>
       <prop key="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</prop>
       <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.jbc2.MultiplexedJBossCacheRegionFactory</prop>
      
       <prop key="hibernate.cache.use_second_level_cache">true</prop>
       <prop key="hibernate.cache.use_query_cache">false</prop>
      
       <!-- hibernate search -->
       <prop key="hibernate.search.analyzer">org.apache.lucene.analysis.SimpleAnalyzer</prop>
       <prop key="hibernate.search.default.directory_provider">org.hibernate.search.store.FSDirectoryProvider</prop>
       <prop key="hibernate.search.default.optimizer.operation_limit.max">${db.searchIndexOptimizeAfterOperations}</prop>
       <prop key="hibernate.search.default.indexBase">${db.searchIndexBase}</prop>
       <prop key="hibernate.search.indexing_strategy">manual</prop>
       <!--- <prop key="hibernate.search.default.indexwriter.transaction.ram_buffer_size">256</prop>
       <prop key="hibernate.search.default.indexwriter.transaction.merge_factor">100</prop>
       <prop key="hibernate.search.default.indexwriter.transaction.max_merge_docs">1000</prop> -->
      
       <!-- Enable Hibernate stats when running test -->
       <prop key="hibernate.generate_statistics">${hibernateStats}</prop>
       </props>
       </property>


        • 1. Re: ClassCastExeption
          Pascal Schmiel Newbie

          Here are my library versions:

          -rw-r--r-- 1 root root 2309955 22. Okt 16:44 hibernate-core-3.3.2.GA.jar
          -rw-r--r-- 1 root root 60062 21. Aug 20:03 hibernate-jbosscache2-3.3.2.GA.jar


          /usr/local/lib64/java/jdk/bin/jar tvf hibernate-core-3.3.2.GA.jar | grep org.hibernate.cache.RegionFactory
           939 Wed Jun 24 01:55:42 CEST 2009 org/hibernate/cache/RegionFactory.class


          /usr/local/lib64/java/jdk/bin/jar tvf hibernate-jbosscache2-3.3.2.GA.jar | grep org.hibernate.cache.jbc2.MultiplexedJBossCacheRegionFactory
           695 Wed Jun 24 01:57:18 CEST 2009 org/hibernate/cache/jbc2/MultiplexedJBossCacheRegionFactory.class



          • 2. Re: ClassCastExeption
            Brian Stansberry Master

            My first suggestion is to look for multiple copies of hibernate-core.jar on the classpath.

            • 3. Re: ClassCastExeption
              Pascal Schmiel Newbie

              I have re-deployed all hibernate related jars. Now I get the following error:

              23.10.09 14:32:37 FATAL [s.OptimisticLockingInterceptor: 55] No transaction manager lookup class has been defined. Transactions cannot be used and thus OPTIMISTIC locking cannot be used! Expect errors!! (main)


              23.10.09 14:32:37 FATAL [s.OptimisticLockingInterceptor: 55] No transaction manager lookup class has been defined. Transactions cannot be used and thus OPTIMISTIC locking cannot be used! Expect errors!! (main)


              Relevant part of config:

              <prop key="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JOTMTransactionManagerLookup</prop>
              


              JOTMTransactionManagerLookup.class is in $CLASSPATH

              Matches in /usr/local/opt/tomcat/webapps/Joca-JCL-Handler/WEB-INF/lib/hibernate-core-3.3.2.GA.jar:
               1625 Wed Jun 24 01:55:44 CEST 2009 org/hibernate/transaction/JOTMTransactionManagerLookup.class