On 2/8/07, viggo <[EMAIL PROTECTED]> wrote:
Hi, I've tried to get through the Persistence chapter in the tutorial section.
I
have added a Person model object which extends org.appfuse.modelUser. Besides that, I have followed the instructions in the Persistence and Hibernate chapter. When running mvn test -Dtest=PersonDaoTest I get the following error: Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.731 sec <<< FAILURE! testFindPersonByLastName(com.xpoints.dao.PersonDaoTest) Time elapsed:
0.553
sec <<< ERROR! org.springframework.beans.factory.BeanCreationException: Error creating
bean
with name 'sessionFactory' defined in URL
[jar:file:/home/viggo/.m2/repository/org/appfuse/appfuse-hibernate/2.0-m3-SNAPSHOT/appfuse- hibernate-2.0-m3-SNAPSHOT.jar!/applicationContext-dao.xml]:
Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'dataSource' is defined Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException
:
No bean named 'dataSource' is defined Seems that the bean 'dataSource' doesn't exist in the applicationContext-dao.xml. I have extracted the core model classes from appfuse, and excluded it in the pom.xml, explained in one of the
tutorials.
Can that be the reason? Is there anything else I have missed?
Are you upgrading from M2 to M3? If so, I forgot something in the release notes and just added it: The applicationContext-resources.xml has been added to src/main/resources of the archetypes and included in web.xml (using classpath*:/applicationContext-resources.xml). You'll need to download this file<http://fisheye4.cenqua.com/browse/%7Eraw,r=2120/appfuse/trunk/web/common/src/main/resources/applicationContext-resources.xml>into your project for it to work correctly.
And another little question: I get this warning as well: log4j:WARN No appenders could be found for logger (com.xpoints.dao.PersonDaoTest). log4j:WARN Please initialize the log4j system properly. Where do I have to define the appender?
If you add the following to src/main/resources/log4j.xml, it should fix this problem: <logger name="com.xpoints"> <level value="DEBUG"/> </logger> Hope this helps, Matt
-- View this message in context:
http://www.nabble.com/Error-creating-bean-with-name-%27sessionFactory%22-tf3196130s2369.html#a8874552
Sent from the AppFuse - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- http://raibledesigns.com