简体   繁体   中英

IllegalStateException when moving from local mySQL db to online (with java hibernate)

I believe this hasn't been asked before in a hibernate/mySQL context (at least I couldn't find it...). I am running a JSP/Servlet web app (with Hibernate) locally on Tomcat 7 and mySQL where it works fine.

HOWEVER, as soon as I change from a local mySQL DB to an online db (all I do is change the URL in hibernate.cfg.xml from localhost:8080 to an IP address) I get an

java.lang.IllegalStateException: Cannot forward after response has been committed error (see below for full trace) on certain actions.

The connection cannot be the problem: I successfully created a table in the db through the application. The above error occurs eg, if I try to lookup an existing record.

Any ideas on this high level? The code is pretty complex since running through multiple inheriting classes.

How can I help you answer this?

Thanks a million.

* full trace:

java.lang.IllegalStateException: Cannot forward after response has been committed
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:349)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
    at butleronline.login.ControllerHelper.doPost(ControllerHelper.java:290)
    at butleronline.Controller.doPost(Controller.java:30)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:695)

This errors is not related with Data layer.

java.lang.IllegalStateException: Cannot forward after response has been committed

Means that your servlet are trying to write something in an already committed flown. Paste the code and I will update my answer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM