Have you tried downloading the source for the tutorial and comparing? You can find the source for all tutorials at http://appfuse-demos.googlecode.com.
Matt On Mon, Sep 8, 2008 at 4:45 PM, Pablo Alcaraz <[EMAIL PROTECTED]> wrote: > Hello! > > I am using the archetype Spring MVC Modular with JPA. > > I have a problem when I am following the instructions to generate the > personManager class. > > In http://appfuse.org/display/APF/Using+JPA the instructions says I have to > register in core/src/main/resources/applicationContext.xml the bean > personDao. > > In http://appfuse.org/display/APF/Services the documentation says that I > have to register personManager in > src/main/webapp/WEB-INF/applicationContext.xml. I write this: > > <bean id="personManager" > class="org.appfuse.service.impl.GenericManagerImpl"> <constructor-arg > ref="personDao"/> > </bean> > > but eclipse says: > > cvc-id.1: There is no ID/IDREF binding for IDREF 'personDao' > > which is true because that bean is in > > core/src/main/resources/applicationContext.xml > > I follow and I write the test described in > http://appfuse.org/display/APF/Using+Spring+MVC . I switch my mind to the > web directory and I "Create a PersonControllerTest.java class in > src/test/java/**/webapp/controller:" > > > I open follow this instruction > > Open src/main/webapp/WEB-INF/dispatcher-servlet.xml and add a bean > definition for personController: > > <bean id="personController" > class="org.appfuse.tutorial.webapp.controller.PersonController"> > <property name="personManager" ref="personManager"/> > </bean> > > > then I do mvn install from the root of the build and I get this error > because one beand definition is invisible to the test. How can I fix this? > I'd like to keep the core separated of the web: > > ------------------------------------------------------------------------------- > Test set: mytest.app.webapp.controller.PersonControllerTest > ------------------------------------------------------------------------------- > Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 6.026 sec > <<< FAILURE! > testHandleRequest(mytest.app.webapp.controller.PersonControllerTest) Time > elapsed: 5.988 sec <<< ERROR! > org.springframework.beans.factory.BeanCreationException: Error creating bean > with name 'personController' defined in ServletContext resource > [/WEB-INF/dispatcher-servlet.xml]: Cannot resolve reference to bean > 'personManager' while setting bean property 'personManager'; nested > exception is > org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean > named 'personManager' is defined > at > org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275) > at > org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104) > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1244) > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1008) > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470) > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) > at java.security.AccessController.doPrivileged(Native Method) > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) > at > org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) > at > org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220) > at > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) > at > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) > at > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) > at > org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429) > at > org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729) > at > org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381) > at > org.appfuse.webapp.controller.BaseControllerTestCase.loadContextLocations(BaseControllerTestCase.java:62) > at > org.springframework.test.AbstractSingleSpringContextTests.loadContext(AbstractSingleSpringContextTests.java:187) > at > org.springframework.test.AbstractSpringContextTests.getContext(AbstractSpringContextTests.java:140) > at > org.springframework.test.AbstractSingleSpringContextTests.setUp(AbstractSingleSpringContextTests.java:100) > at junit.framework.TestCase.runBare(TestCase.java:132) > at > org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:76) > at junit.framework.TestResult$1.protect(TestResult.java:110) > at junit.framework.TestResult.runProtected(TestResult.java:128) > at junit.framework.TestResult.run(TestResult.java:113) > at junit.framework.TestCase.run(TestCase.java:124) > at junit.framework.TestSuite.runTest(TestSuite.java:232) > at junit.framework.TestSuite.run(TestSuite.java:227) > at > org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81) > at > org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62) > at > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140) > at > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.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(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at > org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338) > at > org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997) > Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: > No bean named 'personManager' is defined > at > org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:387) > at > org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:968) > at > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:246) > at > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) > at > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) > at > org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269) > ... 38 more > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
