I don't believe there's a bug here as I haven't heard of anyone else having this problem.

Matt

On Jan 16, 2008, at 1:50 AM, os57741 wrote:


Matt,
I discovered how to solve the problem.
After having put the Controller and its Test in the web module one should
run from the project root
mvn again.
After that has run you can go to  the web module and the
PersonControllerTest and jetty:run-war will build successfully and the
sample application runs!!!!

This is not in the tutorial so I suppose it is not the way it should be ,
but at least it works !
Should I enter this in JIRI ?


mraible wrote:

On 1/15/08, os57741 <[EMAIL PROTECTED]> wrote:

Matt,
I have to apologize that I am confusing you again.
Please forget my last posting.
I discovered that one of my colleagues used my PC to test if a manually
modified applicationContext.xml in the snapshot would work.

This was reason for me to do a complete new setup, accurately following
your
instructions.
Again the same result.
When I run the PersonControllerTest from the core module it runs fine.

This shouldn't be possible. Your Controller and its Tests should be in
the web module. I'd suggest downloading the completed sample app from
the following URL.

http://appfuse-demos.googlecode.com/files/appfuse-demos-2.0.1.tar.gz

Matt

When I run the PersonControllerTest fro the web module the compiler says
that it cannot find the nl.osix.dsm.model package.
The applicationContext.xml in the snapshot in the repository is empty.

Is it possible to change the classpath manually? How should I do that.
Again my apologies for the confusion.






os57741 wrote:

Matt,
I am sorry that I informed you wrong.
I suppose that this is the proper file:

.m2\repository\nl\osix\dsm\project3-core\1.0-SNAPSHOT/project3- core-1.0-SNAPSHOT.jar
This one contains the required bean definitions.
Sorry for the confusion.



os57741 wrote:

Matt,
Is this the jar you are looking for ?

The applicationContext.xml in it is empty .
How come ?



mraible wrote:

It is a classpath problem as far as I can tell - the code for loading
context files in BaseControllerTestCase is as follows:

23      protected String[] getConfigLocations() {
24          setAutowireMode(AUTOWIRE_BY_NAME);
25          return new String[] {
26 "classpath:/applicationContext- resources.xml",
27                  "classpath:/applicationContext-dao.xml",
28                  "classpath:/applicationContext-service.xml",
29                  "classpath*:/applicationContext.xml", // for
modular archetypes
30                  "/WEB-INF/applicationContext*.xml",
31                  "/WEB-INF/dispatcher-servlet.xml"
32              };
33      }

Line 29 is not finding the applicationContext.xml file at the root of the "core" JAR. You might look in .m2/repository/yourgroupid/ core- archetype/version/name.jar and make sure the applicationContext.xml at its root directory has the bean definitions you're looking for.

Matt

On Jan 11, 2008, at 3:22 PM, os57741 wrote:


Do you need any other info.
Could it be a classpath problem ?
Should I run mvn -X test > log ?


mraible wrote:

If your PersonControllerTest extends BaseControllerTestCase and
you've successfully installed the "core" module - this shouldn't be
happening. I'd like to say it's a bug, but I haven't heard of
anyone
else experiencing this issue.

Matt

On Jan 11, 2008, at 2:59 PM, os57741 wrote:


The test does NOT pass.
It gives again the same error
###########################################

--------------------------------------------------------------------
--
---------
Test set: nl.osix.dsm.webapp.controller.PersonControllerTest

--------------------------------------------------------------------
--
---------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed:
11.297 sec
<<< FAILURE!
testHandleRequest
(nl.osix.dsm.webapp.controller.PersonControllerTest)  Time
elapsed: 11.234 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.NoSuchBeanDefinitionExceptio n:
No
bean
named 'personManager' is defined
##############################################################
I checked again, but there is no
web/src/main/resources/applicationContext.xml


mraible wrote:

If you run "mvn test" from project3\web, does your
PersonControllerTest pass? The only thing I can think of is
there's a
web/src/main/resources/applicationContext.xml that's overriding
the
one from core.

Matt

On Jan 11, 2008, at 2:24 PM, os57741 wrote:


My C:\source\project3\core\src\main\resources
\applicationContext.xml

##############################################
<?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";
       default-lazy-init="true">



    <bean id="personDao"
class="nl.osix.dsm.dao.hibernate.PersonDaoHibernate">
<property name="sessionFactory" ref="sessionFactory"/>
    </bean>

    <!-- END SNIPPET: personDao -->



    <!-- Add new DAOs here -->

    <!-- Add new Managers here -->

    <bean id="personManager"
class="org.appfuse.service.impl.GenericManagerImpl" >
       <constructor-arg ref="personDao"/>
    </bean>

</beans
##############################################


mraible wrote:

Please post the contents of core/src/main/resources/
applicationContext.xml and make sure you don't have a web/src/
main/
resources/applicationContext.xml file.

Matt

On Jan 11, 2008, at 1:06 PM, os57741 wrote:


Matt,
One step further.
I have did as you said.
(there is nothing in the
project3/web/src/main/webapp/WEB-INF/ applicationContext.xml
file)
Then I defined the PersonControllerTest and modified the
dispatcher-servlet.xml with PersonController bean

    <bean id="personController"
class="nl.osix.dsm.webapp.controller.PersonController">
<property name="personManager" ref="personManager"/>
       </bean>

When I run the PersonControllerTest from the project root it
runs.
If I run jetty:run-war from the web directory I get the
following
error:

########################################
Test set: nl.osix.dsm.webapp.controller.PersonControllerTest

----------------------------------------------------------------
--
--
--
---------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time
elapsed:
4.656 sec
<<< FAILURE!
testHandleRequest
(nl.osix.dsm.webapp.controller.PersonControllerTest)  Time
elapsed: 4.625 sec  <<< ERROR!
org.springframework.beans.factory.BeanCreationException: E rror
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:
 N
o
bean
named 'personManager' is defined
##################################################




mraible wrote:

Your personManager and personDao bean definitions should both
be in
core/src/main/resources/applicationContext.xml.

Matt

On Jan 11, 2008, at 10:16 AM, os57741 wrote:


Matt,
Sorry, to bother you again, but I still have problem,
probably due
a lack of
knowledge cq experience.

In the core module I have defined a personDao interface.
The personDao test is running.

I get a problem as soon as I run jetty in the web module.

It  probably has to do with the personManager.
This is the content of the
project3/web/src/main/webapp/WEB-INF/ applicationContext.xml
file

###################################
<?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"
       default-lazy-init="true">

   <bean id="personManager"
class="org.appfuse.service.impl.GenericManagerImpl">
       <constructor-arg ref ="personDao"/>

   </bean>
   </beans>
###############################################
When I run   mvn jetty:run-war I get the following 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.BeanCreationException:
Error
creating bean with name 'personManager' defined in
ServletContext
resource
[/WEB-INF/applicationContext.xml]: Cannot resolve reference
to
bean
'personDao' while setting constructor argument; nested
exception is

org.springframework.beans.factory.NoSuchBeanDefinitionExceptio
n:
 N
o
bean
named 'personDao' is defined

The personDao is defined but apparently spring cannot find
it.
What am I doing wrong?
Once again, thanks for your time.

By the way: I got confused about the action class as a
PersonAction
exists
in the service-tutorial








mraible wrote:

Controller should go in the web module, as stated in the
tutorial.
You are correct that Actions are for Struts - maybe you're
reading
the wrong tutorial?

Matt

On Jan 9, 2008, at 12:45 AM, os57741 wrote:


Matt, Thanks for answering.
Yes, I applied the proper names, but should I put the
controller
stuff in
the core module or in the web module (as generated by the
archetype)?
And about the Action stuff: I have the idea that that is
not
used
by Spring
MVC but by Struts? Is that right?




mraible wrote:

If you're using Spring MVC, you should use $
{groupId}.webapp.controller as your package name. You can
find $
{groupId} in pom.xml as the value for <groupId>.

HTH,

Matt

On Jan 8, 2008, at 2:43 PM, os57741 wrote:


Hi Everybody,
I am going through the tutorials. I have setup a modular
Spring
MVC
configuration.
Some tests work, some don't.
I suspect that I didn't put the packages in the correct
location.
The
Services tutorial is not clear on that.
The Dao stuff I have put in the core module and the
controller
stuff in the
webapp module.
I am not sure if I understood well where to put the
following
packages:
- service with the PersonManager interface
- service.impl with the PersonManagerImpl class

I also wonder if there shouldn't be webapp.action
package
with a
PersonAction class.
Where else should I put the setPersonManager methods ?
Any help very much appreciated.



--
View this message in context: http://www.nabble.com/
Location-of-
Controller-and-Service-packages-in-Modular-Spring- MVC-
tp14699664s2369p14699664.html
Sent from the AppFuse - User mailing list archive at
Nabble.com.


----------------------------------------------------------
--
--
--
--
--
-
To unsubscribe, e-mail: users-
[EMAIL PROTECTED]
For additional commands, e-mail: users-
[EMAIL PROTECTED]



-----------------------------------------------------------
--
--
--
--
--
To unsubscribe, e-mail: users-
[EMAIL PROTECTED]
For additional commands, e-mail: users-
[EMAIL PROTECTED]




--
View this message in context: http://www.nabble.com/
Location-of-
Controller-and-Service-packages-in-Modular-Spring-MVC-
tp14699664s2369p14706620.html
Sent from the AppFuse - User mailing list archive at
Nabble.com.


------------------------------------------------------------
--
--
--
--
-
To unsubscribe, e-mail: users-
[EMAIL PROTECTED]
For additional commands, e-mail: users-
[EMAIL PROTECTED]



-------------------------------------------------------------
--
--
--
--
To unsubscribe, e-mail: users-
[EMAIL PROTECTED]
For additional commands, e-mail: users-
[EMAIL PROTECTED]




--
View this message in context: http://www.nabble.com/
Location-of-
Controller-and-Service-packages-in-Modular-Spring-MVC-
tp14699664s2369p14761160.html
Sent from the AppFuse - User mailing list archive at
Nabble.com.


--------------------------------------------------------------
--
--
--
-
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail: users-
[EMAIL PROTECTED]



---------------------------------------------------------------
--
--
--
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail: users-
[EMAIL PROTECTED]




--
View this message in context:
http://www.nabble.com/Location-of-
Controller-and-Service-packages-in-Modular-Spring-MVC-
tp14699664s2369p14763913.html
Sent from the AppFuse - User mailing list archive at
Nabble.com.


----------------------------------------------------------------
--
--
-
To unsubscribe, e-mail: users- [EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]



-----------------------------------------------------------------
--
--
To unsubscribe, e-mail: users- [EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]




--
View this message in context: http://www.nabble.com/ Location-of-
Controller-and-Service-packages-in-Modular-Spring-MVC-
tp14699664s2369p14764748.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


------------------------------------------------------------------
--
-
To unsubscribe, e-mail: users- [EMAIL PROTECTED] For additional commands, e-mail: users- [EMAIL PROTECTED]



-------------------------------------------------------------------
--
To unsubscribe, e-mail: users- [EMAIL PROTECTED] For additional commands, e-mail: users- [EMAIL PROTECTED]




--
View this message in context: http://www.nabble.com/ Location-of-
Controller-and-Service-packages-in-Modular-Spring-MVC-
tp14699664s2369p14766035.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


--------------------------------------------------------------------
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: users- [EMAIL PROTECTED]



-------------------------------------------------------------------- -
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: users- [EMAIL PROTECTED]




--
View this message in context: http://www.nabble.com/Location-of-
Controller-and-Service-packages-in-Modular-Spring-MVC-
tp14699664s2369p14766471.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


-------------------------------------------------------------------- -
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]



http://www.nabble.com/file/p14767329/project3-core-1.0- SNAPSHOT.jar
project3-core-1.0-SNAPSHOT.jar

http://www.nabble.com/file/p14817981/project3-core-1.0- SNAPSHOT.jar
project3-core-1.0-SNAPSHOT.jar


--
View this message in context:
http://www.nabble.com/Location-of-Controller-and-Service-packages- in-Modular-Spring-MVC-tp14699664s2369p14841412.html
Sent from the AppFuse - User mailing list archive at Nabble.com.

-------------------------------------------------------------------- -
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]




--
View this message in context: http://www.nabble.com/Location-of- Controller-and-Service-packages-in-Modular-Spring-MVC- tp14699664s2369p14876226.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
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]

Reply via email to