1 Reply Latest reply on Oct 8, 2007 2:36 PM by Joe Reger

    NoClassDefFoundError: Hibernate 3.2.3.GA and JBossCache 2.0.

    Joe Reger Newbie

      I'm having trouble getting Hibernate to work with JBossCache 2.0. I'm running on Tomcat 5.5. Could be a jar problem of some sort on my side but I was cautious about adding/updating to jbosscache 2.0.

      Hibernate 3.2.3.ga
      JBossCache 2.0.0.GA
      JGroups 2.6.0-beta-1

      I get this error when HibernateUtil starts up:

      java.lang.NoClassDefFoundError: org/jboss/cache/TransactionManagerLookup
       at java.lang.Class.getDeclaredConstructors0(Native Method)
       at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
       at java.lang.Class.getConstructor0(Unknown Source)
       at java.lang.Class.newInstance0(Unknown Source)
       at java.lang.Class.newInstance(Unknown Source)
       at org.hibernate.cfg.SettingsFactory.createCacheProvider(SettingsFactory.java:371)
       at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:241)
       at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)


      It looks like SettingsFactory.createCacheProvider() is looking for a hard-coded "org.jboss.cache.TransactionManagerLookup" which in JBossCache 2.0 should probably be "org.jboss.cache.transaction.GenericTransactionManagerLookup". I'm configuring Hibernate programatically:
      conf.setProperty("hibernate.cache.use_second_level_cache", "true");
      conf.setProperty("hibernate.cache.provider_class", "org.hibernate.cache.TreeCacheProvider");
      conf.setProperty("hibernate.cache.use_structured_entries", "true");
      conf.setProperty("hibernate.cache.use_query_cache", "true");
      conf.setProperty("hibernate.cache.usage", "transactional");


      I've searched my entire codebase and never use "TransactionManagerLookup".

      Question: Am I using the correct value for "hibernate.cache.provider_class" in my programmatic Hibernate configuration?

      Let me know if there's more info I can provide. Thanks for the help,

      Joe

      The top of my treecache.xml looks like:
      <mbean code="org.jboss.cache.jmx.CacheJmxWrapper" name="jboss.cache:service=TreeCache">
       <depends>jboss:service=Naming</depends>
       <depends>jboss:service=TransactionManager</depends>
       <attribute name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup</attribute>