File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Application Frameworks and the fly likes Error: Error registering bean with name 'transactionManager' Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Error: Error registering bean with name Watch "Error: Error registering bean with name New topic

Error: Error registering bean with name 'transactionManager'

Chris Boldon
Ranch Hand

Joined: Aug 10, 2006
Posts: 190
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 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="">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

Joined: Aug 10, 2006
Posts: 190
Answered my own question:

..hibernate.. should be ..hibernate3.. in the xml file in case others have a similar problem.
I agree. Here's the link:
subject: Error: Error registering bean with name 'transactionManager'
It's not a secret anymore!