Hi John,
Try adding net.sourceforge.stripes.integration.spring to your
Extension.Packages (you'll notice this is also something that
is done in ContactFormActionBeanTest), so that you now have,
in web.xml:
<init-param>
<param-name>Extension.Packages</param-name>
<param-value>
net.sourceforge.stripes.integration.spring,
stripesbook.ext,
org.stripesstuff.stripersist,
org.stripesstuff.plugin.security
</param-value>
</init-param>
If that still doesn't work, perhaps you could send me your
WAR file and I could try to determine why you are getting
an error?
Cheers,
Frederic Daoud
On Tue, 11 Nov 2008 07:31:59 -0800 (PST), "jborys"
<[EMAIL PROTECTED]> said:
>
> I did add that. I am still getting the same error.
>
> I thought perhaps i added it incorrectly, so I downloaded the latest
> version
> of your code from the pragmatic web site (both web.xml and the
> ContactFormActionBeanTest.java) and tried to run it as a JUNIT test and
> received the same error.
>
> In that Java class is the following statement:
> mockServletContext.addInitParameter("contextConfigLocation",
> "/WEB-INF/applicationContext-test.xml");
>
> And in the web.xml is the ContextLoaderListener:
> <listener>
>
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> </listener>
>
> Additionally, I reread the chapter going back to section 12.2 on
> injecting
> Spring Beans.
>
> I then tried adding the context-param you mentioned to the web.xml and
> that
> failed with the same error as well.
>
> Here is my web.xml:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
> >
> <context-param>
> <param-name>
> javax.servlet.jsp.jstl.fmt.localizationContext
> </param-name>
> <param-value>StripesResources</param-value>
> </context-param>
>
> <context-param>
> <param-name>contextConfigLocation</param-name>
> <param-value>/WEB-INF/applicationContext-test.xml</param-value>
> </context-param>
>
> <listener>
>
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> </listener>
>
> <!-- listener>
> <listener-class> org.apache.tiles.web.startup.TilesListener
> </listener-class>
> </listener-->
>
> <filter>
> <filter-name>StripesFilter</filter-name>
> <filter-class>
> net.sourceforge.stripes.controller.StripesFilter
> </filter-class>
> <init-param>
> <param-name>ActionResolver.Packages</param-name>
> <param-value>stripesbook.action,stripesbook.view</param-value>
> </init-param>
> <init-param>
> <param-name>Extension.Packages</param-name>
> <param-value>
> stripesbook.ext,
> org.stripesstuff.stripersist,
> org.stripesstuff.plugin.security
> </param-value>
> </init-param>
> <init-param>
> <param-name>SecurityManager.Class</param-name>
> <param-value>
> stripesbook.nonext.MySecurityManager
> </param-value>
> </init-param>
> <init-param>
> <param-name>LocalePicker.Locales</param-name>
> <param-value>en,fr</param-value>
> </init-param>
> </filter>
>
> <servlet>
> <servlet-name>DispatcherServlet</servlet-name>
> <servlet-class>
> net.sourceforge.stripes.controller.DispatcherServlet
> </servlet-class>
> <load-on-startup>1</load-on-startup>
> </servlet>
>
> <filter-mapping>
> <filter-name>StripesFilter</filter-name>
> <servlet-name>DispatcherServlet</servlet-name>
> <dispatcher>REQUEST</dispatcher>
> <dispatcher>FORWARD</dispatcher>
> </filter-mapping>
>
> <servlet-mapping>
> <servlet-name>DispatcherServlet</servlet-name>
> <url-pattern>*.action</url-pattern>
> </servlet-mapping>
>
> <welcome-file-list>
> <welcome-file>index.jsp</welcome-file>
> </welcome-file-list>
>
> <error-page>
> <error-code>404</error-code>
> <location>/WEB-INF/jsp/not_found.jsp</location>
> </error-page>
>
> <error-page>
> <error-code>401</error-code>
> <location>/WEB-INF/jsp/unauthorized.jsp</location>
> </error-page>
> </web-app>
>
>
>
>
> It looks like I have those things you mentioned so what else could I be
> missing?
>
>
>
> "
> Hi John,
>
> The file goes in WEB-INF/applicationContext-test.xml. However, as I
> explain on page 272 of the final PDF, you also have to add a context
> parameter named "contextConfigLocation" with the value
> "/WEB-INF/applicationContext-test.xml". This is done in
> email_27/src/stripesbook/test/stripesmock/ContactFormActionBeanTest.java
> because the chapter deals with testing with mock objects. To use this
> configuration in the web application as opposed to a mock test, you
> have to do the equivalent configuration in web.xml:
>
> <context-param>
> <param-name>contextConfigLocation</param-name>
> <param-value>/WEB-INF/applicationContext-test.xml</param-value>
> </context-param>
>
> That will tell Spring which configuration to use.
> Hope that helps."
> --
> View this message in context:
> http://www.nabble.com/MockServletContext-in-Stripes-book.-tp20383811p20441956.html
> Sent from the stripes-users mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
> world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users