2012-02-20 31 views
1

エラーメッセージは - Error creating bean with name 'agencyDetailsInterfaceService' defined in class path resourceです。以下dao hibernateのJunitテストを実行しようとすると、次のエラーが表示されます

スタックトレース:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'agencyDetailsInterfaceService' defined in class path resource [spring/aas-service.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type '$Proxy51 implementing com.qbe.us.aas.service.IAgencyBatchOutService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised' to required type 'com.qbe.us.aas.service.impl.AgencyBatchOutService' for property 'agencyBatchOutService'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [$Proxy51 implementing com.qbe.us.aas.service.IAgencyBatchOutService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [com.qbe.us.aas.service.impl.AgencyBatchOutService] for property 'agencyBatchOutService': no matching editors or conversion strategy found 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580) 
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) 
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) 
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93) 
    at com.qbe.us.aas.dao.hibernate.AccountDecPrintHibernateDaoJunitTest.setUp(AccountDecPrintHibernateDaoJunitTest.java:36) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:618) 
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) 
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) 
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) 
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27) 
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) 
    at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79) 
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71) 
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) 
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) 
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) 
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) 
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) 
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) 
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236) 
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) 
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) 
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type '$Proxy51 implementing com.qbe.us.aas.service.IAgencyBatchOutService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised' to required type 'com.qbe.us.aas.service.impl.AgencyBatchOutService' for property 'agencyBatchOutService'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [$Proxy51 implementing com.qbe.us.aas.service.IAgencyBatchOutService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [com.qbe.us.aas.service.impl.AgencyBatchOutService] for property 'agencyBatchOutService': no matching editors or conversion strategy found 
    at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:462) 
    at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:499) 
    at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:493) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1371) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1330) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) 
    ... 35 more 
Caused by: java.lang.IllegalStateException: Cannot convert value of type [$Proxy51 implementing com.qbe.us.aas.service.IAgencyBatchOutService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [com.qbe.us.aas.service.impl.AgencyBatchOutService] for property 'agencyBatchOutService': no matching editors or conversion strategy found 
    at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231) 
    at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:447) 
    ... 41 more 
+0

このエラーが発生する理由については何か提案があります。必要なJARファイルがすべてあると思います。 – AJ1986

+0

は、アノテーションまたはxmlで構成されたBeanですか? –

+0

投稿されたスタックトレースの最初の行を読み終えたら、さらに詳しい情報があります。 – madth3

答えて

1

あなたは、実装タイプの代わりに、インタフェースIAgencyBatchOutServiceとしてプロパティagencyBatchOutServiceを宣言することはできますか?。

実装を使用する必要がある場合は、<aop:config proxy-target-class="true">を使用して、Springにcglibプロキシを強制的に使用させます。

+0

投稿これは、この特定のシナリオにrealtedされていないので、すべての私のDao Junitと同じエラーを与える.. – AJ1986

+0

@ AJ1986それを試してみませんか? AgencyBatchOutServiceの代わりにAgencyDetailsInterfaceServiceのタイプをIAgencyBatchOutServiceに設定すると、同じエラーが発生します。 –

関連する問題