tags:

views:

1381

answers:

2

I am in the process of developing Integration Test scripts for our spring application. When I run the test from ant I am getting the following error message: Any ideal as why?

Testcase:

testgetDefaultItemForStoreWithInvalidStoreId(com.xyz.business.admin.role.RoleUtilityUnitTest):  
Caused an ERROR Error creating bean with name 'groundingService' defined in URL 
[file:/C:/workspace/_EACE1_0_06/EB_Ace_Vob/Business/build/classess/businessContext.xml]: Error 
setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested 
PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.TypeMismatchException: 
Failed to convert property value of type [$Proxy47] to required type 
[com.xyz.business.grounding.service.OdometerPdfStatement] for property 'odometerPdfStatement'; nested exception 
is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy47] to required type 
[com.xyz.business.grounding.service.OdometerPdfStatement] for property 'odometerPdfStatement': no matching editors or 
conversion strategy found org.springframework.beans.factory.BeanCreationException: Error creating bean with 
name 'groundingService' defined in 
URL [file:/C:/workspace/_EACE1_0_06/EB_Ace_Vob/Business/build/classess/businessContext.xml]: Error 
setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested 
PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.TypeMismatchException: 
Failed to convert property value of type [$Proxy47] to required type 
[com.xyz.business.grounding.service.OdometerPdfStatement] for property 'odometerPdfStatement'; 
nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy47] to 
required type [com.xyz.business.grounding.service.OdometerPdfStatement] for property 'odometerPdfStatement': 
no matching editors or conversion strategy found Caused by: 
org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessException details (1) are: 
PropertyAccessException 1:

OdometerPDFStatement is a class (not an interface)

I have the following:

    <bean id="odometerPdfStatement" class="com.xyz.business.grounding.service.OdometerPdfStatement"/>


<bean id="groundingService" class="com.xyz.business.grounding.service.GroundingServiceImpl">
 <property name="groundingInformationManager" ref="groundingInformationManager"/>
 <property name="codeManager" ref="codeManager"/>
 <property name="userManager" ref="userManager"/>
 <property name="configurator" ref="groundingConfigurator"/>
 <property name="velocityPropertyFilePath" value="velocity.properties"/>
 <property name="velocityTemplate" value="OdometerStatement.vm"/>
 <property name="odometerStatementXSLResourceFile" value="classpath:OdometerStatement2xsl-fo.xsl"/>
 <property name="imagePropertyFile" value="classpath:images.properties"/>
 <property name="odometerPdfStatement" ref="odometerPdfStatement"/>
 <property name="inspectionInformationManager" ref="inspectionInformationManager"/>
 <property name="saleEventManager" ref="saleEventManager"/>
 <property name="vehicleHistoryManager" ref="vehicleHistoryManager"/>
</bean>
A: 

It looks like you need to add the cglib jar to your classpath. Cglib insures that Spring can proxy concrete classes, not just interfaces.

Robert Munteanu
I have the following in my class path: cglib-nodep-2.1_3.jar. Note that I am able to run my test script in the IDE with no issues. Using RAD 7.0.X as the IDE.
boyd4715
A: 

I've had this a few times. It means that the proxy that spring created does not implement the correct inteface.

I suggest you put a break point on the injector and inspect that $Proxy47 to ascertain what it is implementing.

Also if that class om.xyz.business.grounding.service.OdometerPdfStatement implements 2 interfaces I'm not sure how spring decides which one to use when proxying. I suspect it might implement two interfaces and the proxy is being created on the other one.

Michael Wiles
We are using Spring 2.0.x with JUnit 4.6 any know issues with that? Should I drop it to JUnit 3.8?
boyd4715
Also, the integration testing I am doing is a backend application - Ear with EJB -
boyd4715