Announcement Announcement Module
No announcement yet.
[Hibernate3] Spring doesnt seem to recognize hibernate3 :s Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Hibernate3] Spring doesnt seem to recognize hibernate3 :s

    I have changed every occurance of hibernate to hibernate3 (both in source code and bean definitions.

    contents of intranet-dao.xml:
    	<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
        	<property name="jndiName" value="java&#58;comp/env/MySqlDS" />
    	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="dataSource">
    			<ref bean="dataSource"/>
    		<property name="mappingResources">
    	<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
    		<property name="sessionFactory">
    			<ref bean="sessionFactory"/>
    	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="sessionFactory">
    			<ref bean="sessionFactory"/>
    But no matter what I keep getting this error.

     &#91;org.springframework.web.struts.ContextLoaderPlugIn&#93; Context initialization failed
    org.springframework.beans.factory.BeanDefinitionStoreException&#58; Error registering bean with name 'hibernateTemplate' defined in ServletContext resource &#91;/WEB-INF/intranet-dao.xml&#93;&#58;
     Class that bean class &#91;org.springframework.orm.hibernate.HibernateTemplate&#93; depends on not found; nested exception is java.lang.NoClassDefFoundError&#58; net/sf/hibernate/HibernateExc
    java.lang.NoClassDefFoundError&#58; net/sf/hibernate/HibernateException
    is there any config I need to set to make it point to Hibernate3 ?

  • #2
    Are you sure hibernate3 jar is in your classpath/lib directory?


    • #3
      yes, its is located in /WEB-INF/lib along with its dependencies
      also the hibernate-mapping.dtd is version 3.0, and all xdoclet generated mapping files are 3.0 compliant

      The weird thing is, in a windows project it works fine, in linux I keep getting that problem :s


      • #4
        'hibernateTemplate' defined in ServletContext resource [/WEB-INF/intranet-dao.xml]:
        Class that bean class [org.springframework.orm.hibernate.HibernateTemplat e] depends on not found; nested exception is java.lang.NoClassDefFoundError: net/sf/hibernate/HibernateExc
        Wrong version of HibernateTemplate used. Should be org.springframework.orm.hibernate3.HibernateTempla te.


        • #5
          i know...
          I posted all the hibernate references in that xml file, and as far as I can see, the hibernateTemplate has been defined as org.springframework.orm.hibernate3.HibernateTempla te

          unless I'm doing something wrong here I dont know.


          • #6
            You may want to make really, really sure that the xml packed and deployed in is the xml you think you packed and deployed. It's very easy to have multiple versions floating around.


            • #7
              Well, I did, and both the build, dist directories and the war file were all the correct one.
              I still dont know what the cause was but I reinstalled jboss completely and now it does work.
              I suppose something must have resided in the temp folder

              I also added the property hibernateProperties and set the dialact.
              Maybe that that made a difference , i dont know.