java - Cannot convert value of type [com.sun.proxy.$Proxy32 ScopedObject -
i using spring batch, below configurations.
<beans:bean id="symfonyjob" class="com.st.symfony.symfony" p:dir="${symfony.dir}" p:consolepath="${symfony.console.path}" p:strutil-ref="strutil" p:logfilepath="${batch.log.file.path}.#{jobparameters[batch_id]}" scope="step"/> <beans:bean id="importexchangesitemwriter" class="com.st.batch.foundation.importexchangesitemwriter" p:symfony-ref="symfonyjob" p:replytimeout="${import.exchanges.reply.timeout}" scope="step"/> <beans:bean id="importexchangesfileitemreader" class="org.springframework.batch.item.file.multithreadedflatfileitemreader" p:resource="file:${spring.tmp.batch.dir}/#{jobparameters[batch_id]}/exchanges.txt" p:linemapper-ref="stlinemapper" p:startat="#{stepexecutioncontext['startat']}" p:maxitemcount="#{stepexecutioncontext['itemscount']}" scope="step" /> <step id="importexchangesstep"> <tasklet transaction-manager="transactionmanager"> <chunk reader="importexchangesfileitemreader" writer="importexchangesitemwriter" commit-interval="${import.exchanges.commit.interval}" /> </tasklet> </step> <job id="importexchangesjob" restartable="true"> <step id="importexchangesstep.master"> <partition partitioner="importexchangespartitioner" handler="importexchangespartitionhandler" /> </step> </job>
everything working before change scope of symfonyjob , importexchangesitemwriter scope="step". changed scope, getting
error: org.springframework.batch.core.step.abstractstep - encountered error executing step importexchangesstep in job importexchangesjob org.springframework.beans.factory.beancreationexception: error creating bean name 'scopedtarget.importexchangesitemwriter' defined in file [/home/vishal/install/sts-bundle/vfabric-tc-server-developer-2.9.6.release/base-instance/wtpwebapps/spring/web-inf/classes/meta-inf/spring/batch/jobs/foundation/steps/import-exchanges.xml]: initialization of bean failed; nested exception org.springframework.beans.conversionnotsupportedexception: failed convert property value of type 'com.sun.proxy.$proxy32 implementing org.springframework.aop.scope.scopedobject,java.io.serializable,org.springframework.aop.framework.aopinfrastructurebean,org.springframework.aop.springproxy,org.springframework.aop.framework.advised' required type 'com.st.symfony.symfony' property 'symfony'; nested exception java.lang.illegalstateexception: cannot convert value of type [com.sun.proxy.$proxy32 implementing org.springframework.aop.scope.scopedobject,java.io.serializable,org.springframework.aop.framework.aopinfrastructurebean,org.springframework.aop.springproxy,org.springframework.aop.framework.advised] required type [com.st.symfony.symfony] property 'symfony': no matching editors or conversion strategy found @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:532) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:461) @ org.springframework.beans.factory.support.abstractbeanfactory$2.getobject(abstractbeanfactory.java:333) @ org.springframework.batch.core.scope.stepscope.get(stepscope.java:110) @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:329) @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:194) @ org.springframework.aop.target.simplebeantargetsource.gettarget(simplebeantargetsource.java:34) @ org.springframework.aop.framework.jdkdynamicaopproxy.invoke(jdkdynamicaopproxy.java:184) @ com.sun.proxy.$proxy26.write(unknown source) @ org.springframework.batch.core.step.item.simplechunkprocessor.writeitems(simplechunkprocessor.java:175) @ org.springframework.batch.core.step.item.simplechunkprocessor.dowrite(simplechunkprocessor.java:151) @ org.springframework.batch.core.step.item.simplechunkprocessor.write(simplechunkprocessor.java:274) @ org.springframework.batch.core.step.item.simplechunkprocessor.process(simplechunkprocessor.java:199) @ org.springframework.batch.core.step.item.chunkorientedtasklet.execute(chunkorientedtasklet.java:75) @ org.springframework.batch.core.step.tasklet.taskletstep$chunktransactioncallback.dointransaction(taskletstep.java:402) @ org.springframework.batch.core.step.tasklet.taskletstep$chunktransactioncallback.dointransaction(taskletstep.java:326) @ org.springframework.transaction.support.transactiontemplate.execute(transactiontemplate.java:131) @ org.springframework.batch.core.step.tasklet.taskletstep$2.doinchunkcontext(taskletstep.java:267) @ org.springframework.batch.core.scope.context.stepcontextrepeatcallback.doiniteration(stepcontextrepeatcallback.java:77) @ org.springframework.batch.repeat.support.repeattemplate.getnextresult(repeattemplate.java:368) @ org.springframework.batch.repeat.support.repeattemplate.executeinternal(repeattemplate.java:215) @ org.springframework.batch.repeat.support.repeattemplate.iterate(repeattemplate.java:144) @ org.springframework.batch.core.step.tasklet.taskletstep.doexecute(taskletstep.java:253) @ org.springframework.batch.core.step.abstractstep.execute(abstractstep.java:198) @ org.springframework.batch.integration.partition.stepexecutionrequesthandler.handle(stepexecutionrequesthandler.java:64) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ org.springframework.expression.spel.support.reflectivemethodexecutor.execute(reflectivemethodexecutor.java:69) @ org.springframework.expression.spel.ast.methodreference$methodvalueref.getvalue(methodreference.java:97) @ org.springframework.expression.spel.ast.compoundexpression.getvalueinternal(compoundexpression.java:81) @ org.springframework.expression.spel.ast.spelnodeimpl.gettypedvalue(spelnodeimpl.java:102) @ org.springframework.expression.spel.standard.spelexpression.getvalue(spelexpression.java:103) @ org.springframework.integration.util.abstractexpressionevaluator.evaluateexpression(abstractexpressionevaluator.java:126) @ org.springframework.integration.util.messagingmethodinvokerhelper.processinternal(messagingmethodinvokerhelper.java:227) @ org.springframework.integration.util.messagingmethodinvokerhelper.process(messagingmethodinvokerhelper.java:127) @ org.springframework.integration.handler.methodinvokingmessageprocessor.processmessage(methodinvokingmessageprocessor.java:73) @ org.springframework.integration.handler.serviceactivatinghandler.handlerequestmessage(serviceactivatinghandler.java:67) @ org.springframework.integration.handler.abstractreplyproducingmessagehandler.handlemessageinternal(abstractreplyproducingmessagehandler.java:134) @ org.springframework.integration.handler.abstractmessagehandler.handlemessage(abstractmessagehandler.java:73) @ org.springframework.integration.dispatcher.unicastingdispatcher.dodispatch(unicastingdispatcher.java:115) @ org.springframework.integration.dispatcher.unicastingdispatcher.dispatch(unicastingdispatcher.java:102) @ org.springframework.integration.channel.abstractsubscribablechannel.dosend(abstractsubscribablechannel.java:77) @ org.springframework.integration.channel.abstractmessagechannel.send(abstractmessagechannel.java:157) @ org.springframework.integration.core.messagingtemplate.dosend(messagingtemplate.java:288) @ org.springframework.integration.core.messagingtemplate.dosendandreceive(messagingtemplate.java:318) @ org.springframework.integration.core.messagingtemplate.sendandreceive(messagingtemplate.java:239) @ org.springframework.integration.gateway.messaginggatewaysupport.dosendandreceive(messaginggatewaysupport.java:233) @ org.springframework.integration.gateway.messaginggatewaysupport.sendandreceivemessage(messaginggatewaysupport.java:207) @ org.springframework.integration.amqp.inbound.amqpinboundgateway.access$200(amqpinboundgateway.java:47) @ org.springframework.integration.amqp.inbound.amqpinboundgateway$1.onmessage(amqpinboundgateway.java:87) @ org.springframework.amqp.rabbit.listener.abstractmessagelistenercontainer.doinvokelistener(abstractmessagelistenercontainer.java:693) @ org.springframework.amqp.rabbit.listener.abstractmessagelistenercontainer.invokelistener(abstractmessagelistenercontainer.java:586) @ org.springframework.amqp.rabbit.listener.simplemessagelistenercontainer.access$001(simplemessagelistenercontainer.java:75) @ org.springframework.amqp.rabbit.listener.simplemessagelistenercontainer$1.invokelistener(simplemessagelistenercontainer.java:154) @ org.springframework.amqp.rabbit.listener.simplemessagelistenercontainer.invokelistener(simplemessagelistenercontainer.java:1113) @ org.springframework.amqp.rabbit.listener.abstractmessagelistenercontainer.executelistener(abstractmessagelistenercontainer.java:559) @ org.springframework.amqp.rabbit.listener.simplemessagelistenercontainer.doreceiveandexecute(simplemessagelistenercontainer.java:904) @ org.springframework.amqp.rabbit.listener.simplemessagelistenercontainer.receiveandexecute(simplemessagelistenercontainer.java:888) @ org.springframework.amqp.rabbit.listener.simplemessagelistenercontainer.access$500(simplemessagelistenercontainer.java:75) @ org.springframework.amqp.rabbit.listener.simplemessagelistenercontainer$asyncmessageprocessingconsumer.run(simplemessagelistenercontainer.java:989) @ java.lang.thread.run(thread.java:724) caused by: org.springframework.beans.conversionnotsupportedexception: failed convert property value of type 'com.sun.proxy.$proxy32 implementing org.springframework.aop.scope.scopedobject,java.io.serializable,org.springframework.aop.framework.aopinfrastructurebean,org.springframework.aop.springproxy,org.springframework.aop.framework.advised' required type 'com.st.symfony.symfony' property 'symfony'; nested exception java.lang.illegalstateexception: cannot convert value of type [com.sun.proxy.$proxy32 implementing org.springframework.aop.scope.scopedobject,java.io.serializable,org.springframework.aop.framework.aopinfrastructurebean,org.springframework.aop.springproxy,org.springframework.aop.framework.advised] required type [com.st.symfony.symfony] property 'symfony': no matching editors or conversion strategy found @ org.springframework.beans.beanwrapperimpl.convertifnecessary(beanwrapperimpl.java:463) @ org.springframework.beans.beanwrapperimpl.convertforproperty(beanwrapperimpl.java:494) @ org.springframework.beans.beanwrapperimpl.convertforproperty(beanwrapperimpl.java:488) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.convertforproperty(abstractautowirecapablebeanfactory.java:1437) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.applypropertyvalues(abstractautowirecapablebeanfactory.java:1396) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.populatebean(abstractautowirecapablebeanfactory.java:1132) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:522) ... 62 more caused by: java.lang.illegalstateexception: cannot convert value of type [com.sun.proxy.$proxy32 implementing org.springframework.aop.scope.scopedobject,java.io.serializable,org.springframework.aop.framework.aopinfrastructurebean,org.springframework.aop.springproxy,org.springframework.aop.framework.advised] required type [com.st.symfony.symfony] property 'symfony': no matching editors or conversion strategy found @ org.springframework.beans.typeconverterdelegate.convertifnecessary(typeconverterdelegate.java:264) @ org.springframework.beans.beanwrapperimpl.convertifnecessary(beanwrapperimpl.java:448) ... 68 more
it working though reader had scope step add writer, started getting error.
i saw error different scenario:
i did not follow proper pattern hibernatedao bean, required interface methods , pass interface type in service layer spring bean property instead of dao implementation class.
applicationcontext.xml
<bean id="myentitydao" class="com.me.etc.myentitydaoimpl" parent="hibernatedao"/> <bean id="myentityservice class="com.me.etc.myentityserviceimpl"> <property name="myentitydao" ref="myentitydao" /> </bean>
myentityserviceimpl.java
class myentityserviceimpl extends myentityservice { . . . // got error when had property of class myentitydaoimpl private myentitydaointerface myentitydao; // changed setter match @required public setmyentitydao(myentitydaointerface myentitydao) { this.myentitydao = myentitydao; } . . . }
spring wanted interface pass in, instead of implemented class file caused "cannot convert value of type" error.
Comments
Post a Comment