You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by stanlick <st...@gmail.com> on 2009/06/11 17:25:31 UTC
StrutsTestCase and Spring 2.5
I am on a project with a new combination of jars and testing Struts
interceptors. I have added the struts2-junit-plugin-2.1.2.jar and also
spring-test.jar. When I run my subclass test of StrutsTestCase I get the
following exception:
SEVERE: [20:44.438] ********** FATAL ERROR STARTING UP STRUTS-SPRING
INTEGRATION **********
Looks like the Spring listener was not configured for your web app!
Nothing will work until WebApplicationContextUtils returns a valid
ApplicationContext.
You might need to add the following to web.xml:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
Why is the web.xml being considered?
Peace,
Scott
--
View this message in context: http://www.nabble.com/StrutsTestCase-and-Spring-2.5-tp23983515p23983515.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: StrutsTestCase and Spring 2.5
Posted by st...@gmail.com.
Thanks bro! I think I hated annotations until today. Was the
StrutsTestCase moved into a plug-in recently?
On Thu, Jun 11, 2009 at 10:41 AM, Wes Wannemacher <we...@wantii.com> wrote:
> Scott, it is just complaining because you are trying to do something
> Spring-ish in your unit test, but Spring is not initialized... Try
> annotating the test class with something like the following -
>
> @RunWith(SpringJUnit4ClassRunner.class)
> @ContextConfiguration(locations={"classpath*:applicationContext-test.xml"})
> public class ...
>
>
> That's the easy way, but if you are using an older JDK|JUnit then
> you'll have to figure out how to start Spring.
>
> -Wes
>
> On Thu, Jun 11, 2009 at 11:25 AM, stanlick<st...@gmail.com> wrote:
> >
> > I am on a project with a new combination of jars and testing Struts
> > interceptors. I have added the struts2-junit-plugin-2.1.2.jar and also
> > spring-test.jar. When I run my subclass test of StrutsTestCase I get the
> > following exception:
> >
> > SEVERE: [20:44.438] ********** FATAL ERROR STARTING UP STRUTS-SPRING
> > INTEGRATION **********
> > Looks like the Spring listener was not configured for your web app!
> > Nothing will work until WebApplicationContextUtils returns a valid
> > ApplicationContext.
> > You might need to add the following to web.xml:
> > <listener>
> >
> >
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> > </listener>
> >
> >
> > Why is the web.xml being considered?
> >
> > Peace,
> > Scott
> > --
> > View this message in context:
> http://www.nabble.com/StrutsTestCase-and-Spring-2.5-tp23983515p23983515.html
> > Sent from the Struts - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
>
> --
> Wes Wannemacher
> Author - Struts 2 In Practice
> Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
> http://www.manning.com/wannemacher
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: StrutsTestCase and Spring 2.5
Posted by Wes Wannemacher <we...@wantii.com>.
Scott, it is just complaining because you are trying to do something
Spring-ish in your unit test, but Spring is not initialized... Try
annotating the test class with something like the following -
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath*:applicationContext-test.xml"})
public class ...
That's the easy way, but if you are using an older JDK|JUnit then
you'll have to figure out how to start Spring.
-Wes
On Thu, Jun 11, 2009 at 11:25 AM, stanlick<st...@gmail.com> wrote:
>
> I am on a project with a new combination of jars and testing Struts
> interceptors. I have added the struts2-junit-plugin-2.1.2.jar and also
> spring-test.jar. When I run my subclass test of StrutsTestCase I get the
> following exception:
>
> SEVERE: [20:44.438] ********** FATAL ERROR STARTING UP STRUTS-SPRING
> INTEGRATION **********
> Looks like the Spring listener was not configured for your web app!
> Nothing will work until WebApplicationContextUtils returns a valid
> ApplicationContext.
> You might need to add the following to web.xml:
> <listener>
>
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> </listener>
>
>
> Why is the web.xml being considered?
>
> Peace,
> Scott
> --
> View this message in context: http://www.nabble.com/StrutsTestCase-and-Spring-2.5-tp23983515p23983515.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org