If you want to zip up and send me your project, I can try to fix #1.  The
solution I provided seems like it should work.

Matt

On 2/8/07, viggo <[EMAIL PROTECTED]> wrote:



1. I copied applicationContext-resources.xml to the
core/src/test/resources,
but it didn't work either.
2. I copied log4j.xml from the web module to the core module, and the
warning is gone :)

So, it seems we have an issue with modular projects.
ClassNotFoundException..hmm..classpath/classloader issue?


Matt Raible-3 wrote:
>
> Looks like you've found an issue with how modular projects are setup.
> Unfortunately, I did all the tutorials using the "basic" archetype, so I
> haven't found all the issues you might encounter. Try putting the
attached
> file in core/src/test/resources:
>
> If that works, please enter an issue in JIRA and I'll fix it in the
> modular
> archetypes.
>
> As for log4j.xml - that might be a bug too. Try copying the one from web
> into core/src/test/resources.
>
> Thanks,
>
> Matt
>
> On 2/8/07, viggo <[EMAIL PROTECTED]> wrote:
>>
>>
>> I have a modular spring project, so I guess that the
>> applicationContext-resources.xml must be put into
>> core/src/main/resources?
>> I
>> tried it, and ended up with this error:
>> Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.782sec
>> <<< FAILURE!
>> testFindPersonByLastName(com.xpoints.dao.PersonDaoTest)  Time elapsed:
>> 0.564
>> sec  <<< ERROR!
>> org.springframework.beans.factory.CannotLoadBeanClassException: Cannot
>> find
>> class [org.apache.commons.dbcp.BasicDataSource] for bean with name
>> 'dataSource' defined in URL
>>
>>
[file:/home/viggo/workspace/xpoints-trunk/xpoints-core/target/classes/applicationContext-
>> resources.xml];
>> nested exception is java.lang.ClassNotFoundException:
>> org.apache.commons.dbcp.BasicDataSource
>> Caused by: java.lang.ClassNotFoundException:
>> org.apache.commons.dbcp.BasicDataSource
>>         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>>         at java.security.AccessController.doPrivileged(Native Method)
>>         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>         at
>> org.apache.maven.surefire.booter.IsolatedClassLoader.loadClass(
>> IsolatedClassLoader.java:100)
>>         at org.springframework.util.ClassUtils.forName(ClassUtils.java
>> :183)
>>         at
>>
>>
org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass
>> (AbstractBeanDefinition.java:317)
>>
>>
>> - log4j.xml: When a modular project is created, isn't a log4j.xmlcreated
>> for the core module? I only got a log4j.xml in the web module! And in
>> that
>> file it's already created what you told me to insert.
>>
>>
>> Matt Raible-3 wrote:
>> >
>> > 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.731sec
>> >> <<< 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
>> >
>> >
>>
>> --
>> View this message in context:
>>
http://www.nabble.com/Error-creating-bean-with-name-%27sessionFactory%22-tf3196130s2369.html#a8874888
>> 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
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>        xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";>
>
>     <bean id="propertyConfigurer"
> class="
org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
>         <property name="locations">
>             <list>
>                 <value>classpath:jdbc.properties</value>
>                 <value>classpath:mail.properties</value>
>             </list>
>         </property>
>     </bean>
>
>     <bean id="dataSource"
> class="org.springframework.jdbc.datasource.DriverManagerDataSource">
>         <property name="driverClassName" value="${jdbc.driverClassName
}"/>
>         <property name="url" value="${jdbc.url}"/>
>         <property name="username" value="${jdbc.username}"/>
>         <property name="password" value="${jdbc.password}"/>
>     </bean>
> </beans>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

--
View this message in context:
http://www.nabble.com/Error-creating-bean-with-name-%27sessionFactory%22-tf3196130s2369.html#a8875131
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

Reply via email to