Hello all,

I was following the appfuse tutorial that creates a personDao(it's Prodcut
for me). I followed it exactely but i have this error while running mvn test
-Dtest=PersonDaoTest.

I checked everything but i still can't understand why i have this:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.alcatel.dao.ProductDaoTest
ERROR - TestContextManager.prepareTestInstance(258) | Caught exception while
all
owing TestExecutionListener
[org.springframework.test.context.support.Dependency
injectiontestexecutionliste...@d22462] to prepare test instance
[com.alcatel.dao
.productdaot...@52d1a4]
org.springframework.beans.factory.BeanCreationException: Error creating bean
wit
h name 'com.alcatel.dao.ProductDaoTest': Autowiring of fields failed; nested
exc
eption is org.springframework.beans.factory.BeanCreationException: Could not
aut
owire field: private com.alcatel.dao.ProductDao
com.alcatel.dao.ProductDaoTest.p
roductDao; nested exception is
org.springframework.beans.factory.NoSuchBeanDefin
itionException: No unique bean of type [com.alcatel.dao.ProductDao] is
defined:
Unsatisfied dependency of type [interface com.alcatel.dao.ProductDao]:
expected
at least 1 matching bean
        at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP
ostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.
java:243)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.populateBean(AbstractAutowireCapableBeanFactory.java:959)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:329)
        at
org.springframework.test.context.support.DependencyInjectionTestExecu
tionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:11
0)
        at
org.springframework.test.context.support.DependencyInjectionTestExecu
tionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:7
5)
        at
org.springframework.test.context.TestContextManager.prepareTestInstan
ce(TestContextManager.java:255)
        at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.creat
eTest(SpringJUnit4ClassRunner.java:111)
        at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invok
eTestMethod(SpringJUnit4ClassRunner.java:148)
        at
org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRu
nner.java:51)
        at
org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.
java:44)
        at
org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.jav
a:27)
        at
org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:
37)
        at
org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.ja
va:42)
        at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(S
pringJUnit4ClassRunner.java:97)
        at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.
java:62)
        at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTes
tSet(AbstractDirectoryTestSuite.java:140)
        at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(Ab
stractDirectoryTestSuite.java:127)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Su
refireBooter.java:345)
        at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.j
ava:1009)
Caused by: org.springframework.beans.factory.BeanCreationException: Could
not au
towire field: private com.alcatel.dao.ProductDao
com.alcatel.dao.ProductDaoTest.
productDao; nested exception is
org.springframework.beans.factory.NoSuchBeanDefi
nitionException: No unique bean of type [com.alcatel.dao.ProductDao] is
defined:
 Unsatisfied dependency of type [interface com.alcatel.dao.ProductDao]:
expected
 at least 1 matching bean
        at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP
ostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.j
ava:435)
        at
org.springframework.beans.factory.annotation.InjectionMetadata.inject
Fields(InjectionMetadata.java:105)
        at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP
ostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.
java:240)
        ... 23 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException:
No u
nique bean of type [com.alcatel.dao.ProductDao] is defined: Unsatisfied
dependen
cy of type [interface com.alcatel.dao.ProductDao]: expected at least 1
matching
bean
        at
org.springframework.beans.factory.support.DefaultListableBeanFactory.
resolveDependency(DefaultListableBeanFactory.java:613)
        at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP
ostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.j
ava:412)
        ... 25 more
ERROR - TestContextManager.prepareTestInstance(258) | Caught exception while
all
owing TestExecutionListener
[org.springframework.test.context.support.Dependency
injectiontestexecutionliste...@d22462] to prepare test instance
[com.alcatel.dao
.productdaot...@1fac852]
org.springframework.beans.factory.BeanCreationException: Error creating bean
wit
h name 'com.alcatel.dao.ProductDaoTest': Autowiring of fields failed; nested
exc
eption is org.springframework.beans.factory.BeanCreationException: Could not
aut
owire field: private com.alcatel.dao.ProductDao
com.alcatel.dao.ProductDaoTest.p
roductDao; nested exception is
org.springframework.beans.factory.NoSuchBeanDefin
itionException: No unique bean of type [com.alcatel.dao.ProductDao] is
defined:
Unsatisfied dependency of type [interface com.alcatel.dao.ProductDao]:
expected
at least 1 matching bean
        at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP
ostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.
java:243)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.populateBean(AbstractAutowireCapableBeanFactory.java:959)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:329)
        at
org.springframework.test.context.support.DependencyInjectionTestExecu
tionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:11
0)
        at
org.springframework.test.context.support.DependencyInjectionTestExecu
tionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:7
5)
        at
org.springframework.test.context.TestContextManager.prepareTestInstan
ce(TestContextManager.java:255)
        at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.creat
eTest(SpringJUnit4ClassRunner.java:111)
        at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invok
eTestMethod(SpringJUnit4ClassRunner.java:148)
        at
org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRu
nner.java:51)
        at
org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.
java:44)
        at
org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.jav
a:27)
        at
org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:
37)
        at
org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.ja
va:42)
        at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(S
pringJUnit4ClassRunner.java:97)
        at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.
java:62)
        at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTes
tSet(AbstractDirectoryTestSuite.java:140)
        at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(Ab
stractDirectoryTestSuite.java:127)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Su
refireBooter.java:345)
        at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.j
ava:1009)
Caused by: org.springframework.beans.factory.BeanCreationException: Could
not au
towire field: private com.alcatel.dao.ProductDao
com.alcatel.dao.ProductDaoTest.
productDao; nested exception is
org.springframework.beans.factory.NoSuchBeanDefi
nitionException: No unique bean of type [com.alcatel.dao.ProductDao] is
defined:
 Unsatisfied dependency of type [interface com.alcatel.dao.ProductDao]:
expected
 at least 1 matching bean
        at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP
ostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.j
ava:435)
        at
org.springframework.beans.factory.annotation.InjectionMetadata.inject
Fields(InjectionMetadata.java:105)
        at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP
ostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.
java:240)
        ... 23 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException:
No u
nique bean of type [com.alcatel.dao.ProductDao] is defined: Unsatisfied
dependen
cy of type [interface com.alcatel.dao.ProductDao]: expected at least 1
matching
bean
        at
org.springframework.beans.factory.support.DefaultListableBeanFactory.
resolveDependency(DefaultListableBeanFactory.java:613)
        at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP
ostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.j
ava:412)
        ... 25 more
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 1.989 sec
<<< FA
ILURE!

Results :

Tests in error:
  testFindProductByName(com.alcatel.dao.ProductDaoTest)
  testAddAndRemoveProduct(com.alcatel.dao.ProductDaoTest)

Tests run: 2, Failures: 0, Errors: 2, Skipped: 0

[INFO]
------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] There are test failures.

Please refer to C:\All_Apfuse\projet\myPFEProject\target\surefire-reports
for th
e individual test results.
[INFO]
------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 9 seconds
[INFO] Finished at: Wed Jun 09 01:23:46 CDT 2010
[INFO] Final Memory: 32M/58M
[INFO]
------------------------------------------------------------------------
C:\All_Apfuse\projet\myPFEProject>
-- 
View this message in context: 
http://appfuse.547863.n4.nabble.com/Exception-while-running-Run-the-DAO-Test-tp2249241p2249241.html
Sent from the AppFuse - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to