jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Raible" <mrai...@gmail.com>
Subject Re: Cactus 1.7.2 setting the wrong locale?
Date Wed, 16 Aug 2006 02:47:16 GMT
Here's my Cactus test:

public class UserCactusTest extends ServletTestCase {
    private UserController list = new UserController();
    private UserFormController form = new UserFormController();

    protected void setUp() throws Exception {
        super.setUp();
        ApplicationContext ctx =
            WebApplicationContextUtils
                .getRequiredWebApplicationContext(
                    session.getServletContext());
        UserManager userManager =
            (UserManager) ctx.getBean("userManager");
        list.setUserManager(userManager);
        form.setUserManager(userManager);
        // needed to prevent NPE with getMessageSourceAccessor()
        form.setApplicationContext(ctx);
    }

    public void beginAddUser(WebRequest wRequest) {
        wRequest.addParameter("firstName", "Dion", "post");
        wRequest.addParameter("lastName", "Almaer", "post");
    }

    public void testAddUser() throws Exception {
        form.handleRequest(request, response);
        assertNotNull(request.getSession().getAttribute("message"));
    }

    public void testUserList() throws Exception {
        ModelAndView mav = list.handleRequest(request, response);
        Map m = mav.getModel();
        assertNotNull(m.get("users"));
        assertEquals("userList", mav.getViewName());
    }
}

Full stack trace (you asked for it ;-):

   [cactus] Testsuite: org.appfuse.web.UserCactusTest
   [cactus] Tests run: 2, Failures: 0, Errors: 1, Time elapsed: 0.551 sec

   [cactus] ------------- Standard Error -----------------
   [cactus] log4j:WARN No appenders could be found for logger
(org.apache.cactus.internal.configuration.ConfigurationInitializer).
   [cactus] log4j:WARN Please initialize the log4j system properly.
   [cactus] ------------- ---------------- ---------------
   [cactus] Testcase: testAddUser(org.appfuse.web.UserCactusTest):
 Caused an ERROR
   [cactus] No message found under code 'user.saved' for locale 'en_US'.
   [cactus] org.springframework.context.NoSuchMessageException: No
message found under code 'user.saved' for locale 'en_US'.
   [cactus]     at
org.springframework.context.support.DelegatingMessageSource.getMessage(DelegatingMessageSource.java:65)
   [cactus]     at
org.springframework.context.support.AbstractApplicationContext.getMessage(AbstractApplicationContext.java:732)
   [cactus]     at
org.springframework.context.support.MessageSourceAccessor.getMessage(MessageSourceAccessor.java:149)
   [cactus]     at
org.appfuse.web.UserFormController.onSubmit(UserFormController.java:90)
   [cactus]     at
org.springframework.web.servlet.mvc.SimpleFormController.processFormSubmission(SimpleFormController.java:258)
   [cactus]     at
org.appfuse.web.UserFormController.processFormSubmission(UserFormController.java:69)
   [cactus]     at
org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:250)
   [cactus]     at
org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
   [cactus]     at
org.appfuse.web.UserCactusTest.testAddUser(UserCactusTest.java:36)
   [cactus]     at
org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:153)
   [cactus]     at
org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:119)
   [cactus]     at
org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:93)
   [cactus]     at
org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:224)
   [cactus]     at
org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java)
   [cactus]     at
org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:101)
   [cactus]     at
org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:224)
   [cactus]     at
org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java)
   [cactus]     at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
   [cactus]     at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   [cactus]     at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
   [cactus]     at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
   [cactus]     at
com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:142)
   [cactus]     at
com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:58)
   [cactus]     at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
   [cactus]     at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
   [cactus]     at
org.appfuse.web.MessageFilter.doFilter(MessageFilter.java:33)
[cactus]     at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
   [cactus]     at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
   [cactus]     at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
   [cactus]     at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
   [cactus]     at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
   [cactus]     at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
   [cactus]     at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
   [cactus]     at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
   [cactus]     at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
   [cactus]     at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
   [cactus]     at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
   [cactus]     at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
   [cactus]     at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
   [cactus]     at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
   [cactus]     at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   [cactus]     at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
   [cactus]     at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
   [cactus]     at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
   [cactus]     at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
   [cactus]     at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
   [cactus]     at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
   [cactus]     at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
   [cactus]     at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
   [cactus]     at java.lang.Thread.run(Thread.java:613)


   [cactus] Test org.appfuse.web.UserCactusTest FAILED

Here's the stack trace if I do the same action in Tomcat.  Like I
said, the same WAR that Cactus uses works fine in Tomcat - here's that
stack trace:

DEBUG - UserFormController.onSubmit(77) | entering 'onSubmit' method...
DEBUG - UserValidator.validate(17) | entering 'validate' method...
DEBUG - UserController.handleRequest(24) | entering 'handleRequest' method...

Matt



On 8/15/06, Kazuhito SUGURI <suguri.kazuhito@lab.ntt.co.jp> wrote:
> Hi Matt,
>
> In article <7feebe1f0608151718p367442e3ibf723aace29dfc27@mail.gmail.com>,
> Tue, 15 Aug 2006 18:18:18 -0600,
> "Matt Raible" <mraible@gmail.com> wrote:
> mraible> I'm testing a Spring MVC 2.0 (RC1) application with Cactus.  When I
> mraible> run my cactified WAR in Tomcat, everything works fine.  However, when
> mraible> I run it in Cactus, I get:
> mraible>
> mraible>    [cactus] No message found under code 'user.saved' for locale 'en_US'.
> mraible>    [cactus] org.springframework.context.NoSuchMessageException: No
> mraible> message found under code 'user.saved' for locale 'en_US'.
> mraible>    [cactus]     at
> mraible> org.springframework.context.support.DelegatingMessageSource.getMessage(DelegatingMessageSource.java:65)
> mraible>    [cactus]     at
> mraible> org.springframework.context.support.AbstractApplicationContext.getMessage(AbstractApplicationContext.java:698)
> mraible>    [cactus]     at
> mraible> org.springframework.context.support.MessageSourceAccessor.getMessage(MessageSourceAccessor.java:149)
> mraible>    [cactus]     at
> mraible> org.appfuse.web.UserFormController.onSubmit(UserFormController.java:90)
>
> I cannot find any Cactus classes from the stack trace.
> Could you post the full stack trace?
>
> Best Regards,
> ----
> Kazuhito SUGURI
>

Mime
View raw message