File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

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


projectDAO:


test:
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();
test.test();
}

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

project = new Project();
project.setProjectId("1234");
project.setProjectName("Test Project");
dao.saveProject(project);
}
}


application-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
<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>
</bean>

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

<!-- 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>

<bean id="projectDAO" class="com.x.pmo.dao.ProjectDAO">
<property name="sessionFactory"><ref local="sessionFactory"/></property>
</bean>
</beans>
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.
 
 
subject: Error: Error registering bean with name 'transactionManager'
 
Similar Threads
hibernate_springs
Spring Framework and Hibernate
Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/transactio
Error: Hibernate operation: could not retrieve snapshot
Hibernate, Spring and H2