-
Dec 5th, 2010, 10:16 PM
#11
not able to execute unit test for spring JPA
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'employeeService' defined in class path resource [com/ibm/dw/spring2/dwspring2-service.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'entityManagerFactory' defined in class path resource [com/ibm/dw/spring2/dwspring2-service.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Must start with Java agent to use InstrumentationLoadTimeWeaver. See Spring documentation.
at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveReference(BeanDefinitio nValueResolver.java:275)
at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveValueIfNecessary(BeanDe finitionValueResolver.java:104)
I have seen other thread and try to test , i have run app from Eclipse ,
here is the contecxt def
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="employeeService" class="com.ibm.dw.spring2.EmployeeDAO">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerE ntityManagerFactoryBean">
<property name="loadTimeWeaver">
<bean
class="org.springframework.instrument.classloading .InstrumentationLoadTimeWeaver" />
</property>
<property name="dataSource" ref="dataSource" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.TopLinkJ paVendorAdapter">
<property name="showSql" value="true" />
<property name="generateDdl" value="true" />
<property name="databasePlatform"
value="oracle.toplink.essentials.platform.database .PostgreSQLPlatform" />
<!-- <property name="databasePlatform" value="oracle.toplink.essentials.platform.database .DB2Platform"/> -->
</bean>
</property><!--
<property name="loadTimeWeaver">
<bean
class="org.springframework.instrument.classloading .SimpleLoadTimeWeaver" />
</property>
--></bean>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
<!-- <property name="driverClassName" value="com.ibm.db2.jcc.DB2Driver"/> -->
<!-- <property name="url" value="jdbc:db2://192.168.23.36:50000/dwspring"/>
<property name="url" value="jdbc:hsqldb:hsql://localhost/dwspring" /> -->
<property name="driverClassName" value="org.postgresql.Driver" />
<property name="url" value="jdbc
ostgresql://localhost:5432/postgres" />
<property name="username" value="postgres" />
<property name="password" value="admin" />
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionM anager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="employeeDAO" class="com.ibm.dw.spring2.EmployeeDAO">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
</beans>
please help me out to solve it.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules