File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate Spring Integration problem

 
Jasmine Verma
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having problems Integrating Hibernate2.0.1 with Spring 1.2.4.

My project.xml looks like this. Before you go and start going through this ugly code, which most of you would even not bother to look at, but i seriously need help with this. One thing i will make clear before you go ahead and read all this. I am not deploying my Application on web at all and this has many entries where you would see stuff related to web deployment.

I am junit to test my code.

I am ONLY INTERSTED IN INTEGRATING HIBERNATE 2.0.1/SPRING 1.2.4.

I specifically need help in getting to know the hibernate dependencies and their version which i truely believe could be a problem.

when i try to run my code using this file , I get an error



org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'SessionFactory' defined in class path resource [spring-manual-test.xml]: Bean class [org.springframework.orm.hibernate2.LocalSessionFactoryBean] not found; nested exception is java.lang.ClassNotFoundException: org.springframework.orm.hibernate2.LocalSessionFactoryBean
java.lang.ClassNotFoundException: org.springframework.orm.hibernate2.LocalSessionFactoryBean
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:108)
at org.springframework.beans.factory.support.BeanDefinitionReaderUtils.createBeanDefinition(BeanDefinitionReaderUtils.java:65)
at org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser.parseBeanDefinitionElement(DefaultXmlBeanDefinitionParser.java:426)
at org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser.parseBeanDefinitionElement(DefaultXmlBeanDefinitionParser.java:392)
at org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser.parseBeanDefinitions(DefaultXmlBeanDefinitionParser.java:307)
at org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser.registerBeanDefinitions(DefaultXmlBeanDefinitionParser.java:191)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:295)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:223)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:173)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:148)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:126)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:142)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:81)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:89)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:269)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:87)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:72)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:63)
at com.tuscan.dao.DaoManualTest.setUp(testDaoManualTest.java:19)
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)



__________________________________________________ Project.xml below
<?xml version="1.0" encoding="UTF-8"?>
<project>
<!-- the version of maven's project object model -->
<pomVersion>3</pomVersion>

<!-- a unique name for this project -->
<id>tax</id>
<groupId>tax</groupId>


<organization>
<name>taxing</name>
</organization>

<!-- a short but descriptive name for the project -->
<name>spring</name>


<currentVersion>0.1-SNAPSHOT</currentVersion>


<inceptionYear>2005</inceptionYear>

<!-- The hostname/directory of the web server that hosts the project's web site. Used when the web site is deployed. -->
<siteAddress>tuscan.tusc.local</siteAddress>
<siteDirectory>/srv/www/htdocs/projects/spring</siteDirectory>

<!-- The URL to the project's homepage. -->
<url>http://tuscan.tusc.local/projects/spring/index.html</url>

<!-- The Java package name of the project. This value is used when generating JavaDoc. -->
<package>com.tusc</package>

<!-- jar files the project is dependent on -->
<dependencies>
<dependency>
<groupId>acegisecurity</groupId>
<artifactId>acegi-security</artifactId>
<version>0.9.0</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>

<dependency> <!-- required for Hibernate -->
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
<version>2.7.5</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>

<dependency> <!-- Not on ibiblio -->
<groupId>ajaxtags</groupId>
<artifactId>ajaxtags</artifactId>
<version>1.0.1</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>

<dependency> <!-- required for Hibernate -->
<groupId>cglib</groupId>
<artifactId>cglib-full</artifactId>
<version>2.0.1</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>

<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.7.0</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>

<dependency>
<groupId>commons-betwixt</groupId>
<artifactId>commons-betwixt</artifactId>
<version>0.7</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>

<dependency> <!-- Required by Acegi -->
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.3</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>

<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.1</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>

<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
<version>1.7</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.0</version>
<properties>
<war.bundle>false</war.bundle>
</properties>
</dependency>

<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.1</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>

<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.4</version>
<properties>
<war.bundle>false</war.bundle> <!-- Included with Tomcat -->
</properties>
</dependency>

<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.1.4</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>

<dependency>
<groupId>displaytag</groupId>
<artifactId>displaytag</artifactId>
<version>1.0</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>

<dependency>
<groupId>dwr</groupId>
<artifactId>dwr</artifactId>
<version>1.0RC3</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>

<dependency> <!-- required for Hibernate -->
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.4</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>

<dependency> <!-- required for Hibernate -->
<groupId>ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>0.7</version>
<properties>
<war.bundle>true</war.bundle> <!-- But watch for Windows undeploy bug in Tomcat 5.5 -->
</properties>
</dependency>

<dependency> <!-- required for Hibernate -->
<groupId>hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>2.0.1</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>

<dependency> <!-- Not on ibiblio -->
<groupId>jaf</groupId>
<artifactId>activation</artifactId>
<version>1.0.2-upd2</version>
<properties>
<war.bundle>false</war.bundle> <!-- This should be in Tomcat's common\lib -->
</properties>
</dependency>

<dependency> <!-- Not on ibiblio -->
<groupId>javamail</groupId>
<artifactId>javamail</artifactId>
<version>1.3.2</version>
<properties>
<war.bundle>false</war.bundle> <!-- This should be in Tomcat's common\lib -->
</properties>
</dependency>

<dependency>
<groupId>jspapi</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0-20040521</version>
</dependency>

<dependency> <!-- Java Standard Tag Library API classes -->
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>3.1.11</version>
</dependency>

<dependency> <!-- Not on ibiblio -->
<groupId>oracle</groupId>
<artifactId>classes12</artifactId>
<jar>classes12.jar</jar>
<properties>
<war.bundle>false</war.bundle>
</properties>
</dependency>

<dependency> <!-- Required by Acegi -->
<groupId>oro</groupId>
<artifactId>oro</artifactId>
<version>2.0.8</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>

<dependency>
<groupId>servletapi</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4-20040521</version>
</dependency>

<dependency>
<groupId>springframework</groupId>
<artifactId>spring</artifactId>
<version>1.2.6</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>

<dependency>
<groupId>springmodules</groupId>
<artifactId>springmodules-validator</artifactId>
<version>0.2</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>

<dependency> <!-- Not on ibiblio -->
<groupId>sun</groupId>
<artifactId>jta</artifactId>
<version>1.0.1B</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>

<dependency>
<groupId>taglibs</groupId> <!-- Apache JSTL implementation, also requires JSTL API jar -->
<artifactId>standard</artifactId>
<version>1.1.2</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>

<dependency>
<groupId>valuelist</groupId> <!-- Not on ibiblio -->
<artifactId>valuelist</artifactId>
<version>0.1.7</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
</dependencies>

<build>
<sourceDirectory>src/java</sourceDirectory>
<unitTestSourceDirectory>src/test</unitTestSourceDirectory>

<!-- Unit test cases -->
<unitTest>
<includes>
<include>**/*TestCase.java</include>
</includes>
<excludes>
</excludes>
<resources>
<resource>
<directory>src/test</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
</unitTest>

<!-- Resources that are packaged up inside the JAR file -->
<resources>
<resource>
<directory>src/java</directory>
<includes>
<include>**/*.hbm.xml</include>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
</build>

<reports>
<report>maven-checkstyle-plugin</report>
<!-- <report>maven-clover-plugin</report> -->
<report>maven-javadoc-plugin</report>
<report>maven-jcoverage-plugin</report>
<report>maven-jdepend-plugin</report>
<report>maven-junit-report-plugin</report>
<report>maven-jxr-plugin</report>
<report>maven-simian-plugin</report>
<report>maven-tasklist-plugin</report>
</reports>
</project>


Please help,
Jasmine
 
Sabarish Sasidharan
Ranch Hand
Posts: 73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jasmine Verma:

org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'SessionFactory' defined in class path resource [spring-manual-test.xml]: Bean class [org.springframework.orm.hibernate2.LocalSessionFactoryBean] not found; nested exception is java.lang.ClassNotFoundException: org.springframework.orm.hibernate2.LocalSessionFactoryBean
java.lang.ClassNotFoundException: org.springframework.orm.hibernate2.LocalSessionFactoryBean


Shouldn't you be using org.springframework.orm.hibernate.LocalSessionFactoryBean instead of org.springframework.orm.hibernate2.LocalSessionFactoryBean ? The extra '2' might be the culprit.
 
Jasmine Verma
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have used working with it after removing 2
org.springframework.orm.hibernate2.LocalSessionFactoryBean

from the above line of code.
I get the same error saying class not found, have you used hibernate 2 with spring 2.1.6.
if you have please post your project.xml, it will greatly help me also with the dependencies it requires which is also one of the problems

org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'SessionFactory' defined in class path resource [spring-manual-test.xml]: Bean class [org.springframework.orm.hibernate2.LocalSessionFactoryBean] not found; nested exception is java.lang.ClassNotFoundException: org.springframework.orm.hibernate2.LocalSessionFactoryBean
java.lang.ClassNotFoundException: org.springframework.orm.hibernate2.LocalSessionFactoryBean
 
Sabarish Sasidharan
Ranch Hand
Posts: 73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post the stack trace that you get when you try without the '2'?

And also pls paste the section from spring applicationContext.xml wherein u have configured your hibernate stuff...
 
Sabarish Sasidharan
Ranch Hand
Posts: 73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it seems ur spring applicationContext file is spring-manual-test.xml... so if you can get the relevant sections from there and paste them here it would be convenient
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic