Results 1 to 7 of 7

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

  1. #1
    Join Date
    Aug 2005
    Posts
    28

    Default [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:
    Code:
    <beans>
    	<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
        	<property name="jndiName" value="java&#58;comp/env/MySqlDS" />
        </bean>
        
    	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="dataSource">
    			<ref bean="dataSource"/>
    		</property>	
    		<property name="mappingResources">
    			<list>
    				<value>/WEB-INF/classes/model/Log.hbm.xml</value>
    				<value>/WEB-INF/classes/model/Picture.hbm.xml</value>
    				<value>/WEB-INF/classes/model/Person.hbm.xml</value>
    				<value>/WEB-INF/classes/model/UserMessage.hbm.xml</value>
    				<value>/WEB-INF/classes/model/SiteMessage.hbm.xml</value>
    				<value>/WEB-INF/classes/model/Tutorial.hbm.xml</value>
    			</list>
    		</property>
    	</bean>
    	
    	<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
    		<property name="sessionFactory">
    			<ref bean="sessionFactory"/>
    		</property>
    	</bean>	
    	
    	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="sessionFactory">
    			<ref bean="sessionFactory"/>
    		</property>
    	</bean>
      ...
    </beans>
    But no matter what I keep getting this error.

    Code:
     &#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
    eption
    java.lang.NoClassDefFoundError&#58; net/sf/hibernate/HibernateException
    is there any config I need to set to make it point to Hibernate3 ?

  2. #2
    Join Date
    Jun 2005
    Location
    Rio de Janeiro - Brazil
    Posts
    8

    Default

    Are you sure hibernate3 jar is in your classpath/lib directory?
    Phillip Calçado \"Shoes\"
    http://www.fragmental.com.br
    \"There is no spoon\" -- Matrix
    \"There is no fork()\" -- AmigaOS
    ________________________________________
    If you\'re not confused, you\'re not paying attention.

  3. #3
    Join Date
    Aug 2005
    Posts
    28

    Default

    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. #4
    Join Date
    Sep 2004
    Posts
    1,086

    Default

    '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. #5
    Join Date
    Aug 2005
    Posts
    28

    Default

    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. #6
    Join Date
    Sep 2004
    Posts
    1,086

    Default

    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. #7
    Join Date
    Aug 2005
    Posts
    28

    Default

    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.

Similar Threads

  1. Spring MVC Web Framework versus Struts
    By biguniverse in forum Web Flow
    Replies: 27
    Last Post: Aug 29th, 2012, 03:57 AM
  2. A Spring Class Loader?
    By azzoti in forum Architecture
    Replies: 8
    Last Post: May 7th, 2005, 04:02 AM
  3. Replies: 14
    Last Post: Feb 21st, 2005, 05:41 PM
  4. Spring and Hibernate3
    By pascal in forum Data
    Replies: 4
    Last Post: Jan 4th, 2005, 01:58 AM
  5. Replies: 5
    Last Post: Sep 2nd, 2004, 12:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •