Jump to content

Issue - Hibernate Conn in spring in iReport 3.7.0


shrije

Recommended Posts

I get the following issue in creating hibernate connection using spring in iReport 3.7.0

Error creating bean with name 'entityManagerFactory' defined in class path resource [analysis-server-dao-spring-config.xml]: Cannot create inner bean 'org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#19c21c1' of type [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter] while setting bean property 'jpaVendorAdapter'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#19c21c1' defined in class path resource [analysis-server-dao-spring-config.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/hibernate/ejb/HibernatePersistence

The spring file is being tested successfully and used in my test cases and applications. The class is already added in classpath through jar file like other jar files. I am using hibernate version 3.4.0 GA and spring version 2.5.5.. I tried the following to fix the issue

1. Restarted iReport after closing the application.

2. Exploded the jar file containing the class and added the same folder in the class path.

 

But in vain. Please help me. Please find the attached spring file code. I have replaced the company name and component name from the file with "company" and "component".

 

Code:
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"	xsi:schemaLocation="       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">	<bean		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">		<property name="locations">			<value>component.properties</value>		</property>		<property name="placeholderPrefix" value="$DB{" />		<property name="ignoreUnresolvablePlaceholders" value="true" />	</bean>	<bean id="entityManagerFactory"		class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">		<property name="persistenceUnitName" value="component" />		<property name="dataSource" ref="componentDataSource" />		<property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml" />		<property name="jpaVendorAdapter">			<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">				<property name="database" value="$DB{db.database.type}" />				<property name="showSql" value="true" />				<property name="generateDdl" value="true" />			</bean>		</property>	</bean>	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">		<property name="entityManagerFactory" ref="entityManagerFactory" />		<property name="dataSource" ref="componentDataSource" />	</bean>	<tx:annotation-driven transaction-manager="transactionManager" />	<bean id="componentDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">		<property name="driverClass" value="$DB{db.connection.driver_class}" />		<property name="jdbcUrl" value="$DB{db.connection.url}" />		<property name="user" value="$DB{db.connection.username}" />		<property name="password" value="$DB{db.connection.password}" />	</bean>	<bean id="componentProgressDao"		class="com.company.iii.component.dao.impl.componentProgressDaoEjb3Impl">		<property name="entityManagerFactory" ref="entityManagerFactory" />	</bean>	<bean id="componentrequestDao"		class="com.company.iii.component.dao.impl.componentrequestDaoEjb3Impl">		<property name="entityManagerFactory" ref="entityManagerFactory" />	</bean>	<bean id="componentResultDao"		class="com.company.iii.component.dao.impl.componentResultDaoEjb3Impl">		<property name="entityManagerFactory" ref="entityManagerFactory" />	</bean>	<bean id="aggregateRequestDao"		class="com.company.iii.component.dao.impl.AggregateRequestDaoEjb3Impl">		<property name="entityManagerFactory" ref="entityManagerFactory" />	</bean>	<bean id="parameterGroupDao"		class="com.company.iii.component.dao.impl.ParameterGroupDaoEjb3Impl">		<property name="entityManagerFactory" ref="entityManagerFactory" />	</bean>	<bean id="parameterDao"		class="com.company.iii.component.dao.impl.ParameterDaoEjb3Impl">		<property name="entityManagerFactory" ref="entityManagerFactory" />	</bean>	<bean id="componentAlgorithmDao"		class="com.company.iii.component.dao.impl.componentAlgorithmDaoEjb3Impl">		<property name="entityManagerFactory" ref="entityManagerFactory" />	</bean>	<bean id="markerDao" class="com.company.iii.component.dao.impl.MarkerDaoEjb3Impl">		<property name="entityManagerFactory" ref="entityManagerFactory" />	</bean>	<bean id="parameterDefinitionDao"		class="com.company.iii.component.dao.impl.ParameterDefinitionDaoEjb3Impl">		<property name="entityManagerFactory" ref="entityManagerFactory" />	</bean>	<bean id="parameterDefinitionGroupDao"		class="com.company.iii.component.dao.impl.ParameterDefinitionGroupDaoEjb3Impl">		<property name="entityManagerFactory" ref="entityManagerFactory" />	</bean></beans>
Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...