Announcement Announcement Module
Collapse
No announcement yet.
Problem Hibernate 3 - Spring 1.2 RC1 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem Hibernate 3 - Spring 1.2 RC1

    I get the following exception when I'm trying to create a SessionFactory in the applicationContext:

    Exception in thread "main" org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sessionFactory' defined in class path resource [org/bejug/jobs/properties/applicationContext.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: net/sf/hibernate/HibernateException
    java.lang.NoClassDefFoundError: net/sf/hibernate/HibernateException
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
    at java.lang.Class.getDeclaredMethods(Unknown Source)
    at java.beans.Introspector$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.beans.Introspector.getPublicDeclaredMethods(U nknown Source)
    at java.beans.Introspector.getTargetMethodInfo(Unknow n Source)
    at java.beans.Introspector.getBeanInfo(Unknown Source)
    at java.beans.Introspector.getBeanInfo(Unknown Source)
    at org.springframework.beans.CachedIntrospectionResul ts.<init>(CachedIntrospectionResults.java:140)
    at org.springframework.beans.CachedIntrospectionResul ts.forClass(CachedIntrospectionResults.java:82)
    at org.springframework.beans.BeanWrapperImpl.setIntro spectionClass(BeanWrapperImpl.java:299)
    at org.springframework.beans.BeanWrapperImpl.setWrapp edInstance(BeanWrapperImpl.java:257)
    at org.springframework.beans.BeanWrapperImpl.setWrapp edInstance(BeanWrapperImpl.java:239)
    at org.springframework.beans.BeanWrapperImpl.<init>(B eanWrapperImpl.java:192)
    at org.springframework.beans.factory.support.Abstract BeanFactory.createBeanWrapper(AbstractBeanFactory. java:557)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:317)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:257)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:222)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:146)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:285)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:317)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:80)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:65)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:56)
    at org.bejug.jobs.backend.framework.JavaJobsApplicati onContext.<init>(JavaJobsApplicationContext.java:3 5)
    at org.bejug.jobs.backend.framework.JavaJobsApplicati onContext.main(JavaJobsApplicationContext.java:49)

    My applicationContext is the following:

    <?xml version="1.0" encoding="UTF-8"?>
    <!--
    Copyright (C) 2005 The Java Community

    This program is free software; you can redistribute it and/or modify it under
    the terms of the GNU General Public License as published by the Free Software
    Foundation; either version 2 of the License, or (at your option) any later
    version.

    This program is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along with
    this program; if not, write to the Free Software Foundation, Inc., 59 Temple
    Place, Suite 330, Boston, MA 02111-1307 USA.

    -->
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
    "http://www.springframework.org/dtd/spring-beans.dtd">

    <beans>
    <bean id="propertyConfigurer"
    class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
    <property name="locations">
    <list>
    <value>classpath:org/bejug/jobs/properties/jdbc.properties</value>
    <value>classpath:org/bejug/jobs/properties/hibernate.properties</value>
    </list>
    </property>
    </bean>

    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
    <property name="driverClassName">
    <value>${jdbc.driverClassName}</value>
    </property>
    <property name="url">
    <value>${jdbc.url}</value>
    </property>
    <property name="username">
    <value>${jdbc.username}</value>
    </property>
    <property name="password">
    <value>${jdbc.password}</value>
    </property>
    </bean>

    <bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSess ionFactoryBean">
    <property name="dataSource">
    <ref local="dataSource"/>
    </property>
    <property name="mappingResources">
    <list>
    </list>
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">${hibernate.dialect}</prop>
    <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
    <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.a uto}</prop>
    </props>
    </property>
    </bean>
    </beans>

    Now, I see that the HibernateException is in another package in Hibernate 3.
    I thought Spring 1.2 RC1 supports Hibernate 3?
    Anyone encoutered the same problem?

  • #2
    You need to change some packages (in app. context and elsewhere). Take a look at this thread.

    For example:
    org.springframework.orm.hibernate
    should become
    org.springframework.orm.hibernate3

    Comment


    • #3
      Thx mate!

      That solved my prob!

      Comment

      Working...
      X