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]