• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Error: Error registering bean with name 'transactionManager'

Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting the following error:

Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'transactionManager' defined in class path resource [applicationContext.xml]: Class that bean class [org.springframework.orm.hibernate.HibernateTransactionManager] depends on not found; nested exception is java.lang.NoClassDefFoundError: net/sf/hibernate/HibernateException
java.lang.NoClassDefFoundError: net/sf/hibernate/HibernateException



package com.x.pmo.test;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.x.pmo.dao.ProjectDAO;
import com.x.pmo.vo.Project;

public class Test {
private ApplicationContext ctx = null;
private Project project = null;
private ProjectDAO dao = null;
String path = "applicationContext.xml";

public static void main(String[] args) {

Test test = new Test();

public void test() {
ctx = new ClassPathXmlApplicationContext(path);
dao = (ProjectDAO) ctx.getBean("projectDAO");

project = new Project();
project.setProjectName("Test Project");


<?xml version="1.0" encoding="UTF-8"?>

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName"><value>com.mysql.jdbc.Driver</value></property>
<property name="url"><value>jdbc:mysql://localhost:3306/project</value></property>
<property name="username"><value>xxx</value></property>
<property name="password"><value>xxx</value></property>

<!-- Hibernate SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
<property name="dataSource"><ref local="dataSource"/></property>
<property name="mappingResources">
<property name="hibernateProperties">
<prop key="hibernate.dialect">net.sf.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>

<!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
<bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager">
<property name="sessionFactory"><ref local="sessionFactory"/></property>

<bean id="projectDAO" class="com.x.pmo.dao.ProjectDAO">
<property name="sessionFactory"><ref local="sessionFactory"/></property>

Chris Boldon
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Answered my own question:

..hibernate.. should be ..hibernate3.. in the xml file in case others have a similar problem.
A teeny tiny vulgar attempt to get you to buy our stuff
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic