Announcement Announcement Module
Collapse
No announcement yet.
printWriter() error Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • printWriter() error

    Hello,
    I am very new to spring and have just been put on a project with an existing spring web application. I was also told the people who wrote the app did not know how to properly implement spring. Anyways I am trying to to setup a very simple controller (hello world) in the existing environment. I am getting an error and am not sure how to go about resolving it.

    I am getting a 404 on the jsp and tomcat is showing a printWriterI() error. Below is the code, and the error:

    JSP:

    <%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <html>
    <head>
    <title>merge test</title>
    </head>
    <body>
    ${message}
    <p>This is a test of the emergency broadcasting system!</p>
    </body>
    </html>


    Controller:

    @Controller
    @RequestMapping("/gcap/merge")
    public class MergeController {

    private static final Logger log = Logger.getLogger(MergeController.class);

    @PreAuthorize("isAuthenticated()")
    @RequestMapping(value = "mergeData", method = RequestMethod.GET)
    public ModelAndView mergeData(){

    log.info("GOT TO MergeController");

    String message = "MERGE MY DATA";
    return new ModelAndView("mergetest","message",message);
    }

    }

    Jun 21, 2012 9:02:59 AM org.apache.catalina.core.ApplicationDispatcher invoke
    SEVERE: Servlet.service() for servlet CfmServlet threw exception
    java.lang.IllegalStateException: getWriter() has already been called for this response
    at org.apache.catalina.connector.Response.getOutputSt ream(Response.java:573)
    at org.apache.catalina.connector.ResponseFacade.getOu tputStream(ResponseFacade.java:183)
    at coldfusion.tagext.io.cache.ehcache.GenericResponse Wrapper.<init>(GenericResponseWrapper.java:56)
    at coldfusion.filter.CachingFilter.invoke(CachingFilt er.java:50)
    at coldfusion.CfmServlet.service(CfmServlet.java:200)
    at coldfusion.bootstrap.BootstrapServlet.service(Boot strapServlet.java:89)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.ApplicationDispatcher.inv oke(ApplicationDispatcher.java:654)
    at org.apache.catalina.core.ApplicationDispatcher.pro cessRequest(ApplicationDispatcher.java:447)
    at org.apache.catalina.core.ApplicationDispatcher.doF orward(ApplicationDispatcher.java:379)
    at org.apache.catalina.core.ApplicationDispatcher.for ward(ApplicationDispatcher.java:292)
    at org.apache.catalina.core.StandardHostValve.custom( StandardHostValve.java:424)
    at org.apache.catalina.core.StandardHostValve.status( StandardHostValve.java:343)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:144)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:104)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:261)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.process(Http11Protocol.java:581)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run( JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:662)
    Jun 21, 2012 9:02:59 AM org.apache.catalina.core.StandardHostValve custom
    SEVERE: Exception Processing ErrorPage[errorCode=404, location=/404.cfm]
    java.lang.IllegalStateException: getWriter() has already been called for this response
    at org.apache.catalina.connector.Response.getOutputSt ream(Response.java:573)
    at org.apache.catalina.connector.ResponseFacade.getOu tputStream(ResponseFacade.java:183)
    at coldfusion.tagext.io.cache.ehcache.GenericResponse Wrapper.<init>(GenericResponseWrapper.java:56)
    at coldfusion.filter.CachingFilter.invoke(CachingFilt er.java:50)
    at coldfusion.CfmServlet.service(CfmServlet.java:200)
    at coldfusion.bootstrap.BootstrapServlet.service(Boot strapServlet.java:89)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.ApplicationDispatcher.inv oke(ApplicationDispatcher.java:654)
    at org.apache.catalina.core.ApplicationDispatcher.pro cessRequest(ApplicationDispatcher.java:447)
    at org.apache.catalina.core.ApplicationDispatcher.doF orward(ApplicationDispatcher.java:379)
    at org.apache.catalina.core.ApplicationDispatcher.for ward(ApplicationDispatcher.java:292)
    at org.apache.catalina.core.StandardHostValve.custom( StandardHostValve.java:424)
    at org.apache.catalina.core.StandardHostValve.status( StandardHostValve.java:343)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:144)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:104)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:261)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.process(Http11Protocol.java:581)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run( JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:662)
    ^CJun 21, 2012 9:12:39 AM org.apache.coyote.http11.Http11Protocol destroy
    INFO: Stopping Coyote HTTP/1.1 on http-8080
    Last edited by hacktorious; Jun 21st, 2012, 08:23 AM. Reason: left out variable in jsp

  • #2
    I figured this one out. My jsp was not being deployed to the correct location.

    Comment

    Working...
    X