Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > IllegalStateException: Current state = FLUSHED, new state = CODING

Reply
Thread Tools

IllegalStateException: Current state = FLUSHED, new state = CODING

 
 
Stewart
Guest
Posts: n/a
 
      05-29-2007
This mysterious exception is being thrown at random intervals by my
Tomcat installtion. Once its thrown once, it will always rethrow with
each request until Tomcat is bounced.

I have searched all over google for any clues about this. Most
references to it are referring to outdated versions of Tomcat, Java,
log4j etc. In fact, references to this error later than 2003 seem rare
indeed; yet here it is.

I'm completely lost because:
(1) it's the only exception being thrown - there are no other errors
or behaviour of interest, except that no response gets to the client
(2) the stack trace contains no reference to any of my own code. It
involves only Tomcat, log4j and Sun's nio.

Anyone have any clues?

Tomcat version is 5.5.16.
Java version is 1.5.0_08.
Log4j version is 1.2.13.


May 29, 2007 3:50:40 PM org.apache.catalina.connector.CoyoteAdapter
service
SEVERE: An exception or error occurred in the container during the
request processing
java.lang.IllegalStateException: Current state = FLUSHED, new state =
CODING
at
java.nio.charset.CharsetEncoder.throwIllegalStateE xception(Unknown
Source)
at java.nio.charset.CharsetEncoder.encode(Unknown Source)
at sun.nio.cs.StreamEncoder$CharsetSE.implWrite(Unkno wn
Source)
at sun.nio.cs.StreamEncoder.write(Unknown Source)
at sun.nio.cs.StreamEncoder.write(Unknown Source)
at java.io.OutputStreamWriter.write(Unknown Source)
at java.io.Writer.write(Unknown Source)
at org.apache.log4j.helpers.QuietWriter.write(QuietWr iter.java:
47)
at
org.apache.log4j.WriterAppender.subAppend(WriterAp pender.java:301)
at
org.apache.log4j.DailyRollingFileAppender.subAppen d(DailyRollingFileAppender.java:
35
at org.apache.log4j.WriterAppender.append(WriterAppen der.java:
159)
at
org.apache.log4j.AppenderSkeleton.doAppend(Appende rSkeleton.java:230)
at
org.apache.log4j.helpers.AppenderAttachableImpl.ap pendLoopOnAppenders(AppenderAttachableImpl.java:
65)
at org.apache.log4j.Category.callAppenders(Category.j ava:203)
at org.apache.log4j.Category.forcedLog(Category.java: 38
at org.apache.log4j.Category.log(Category.java:853)
at
org.apache.commons.logging.impl.Log4JLogger.error( Log4JLogger.java:
193)
at
org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:
260)
at
org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:
17
at
org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:
126)
at
org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:
105)
at
org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:
541)
at
org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:
107)
at
org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:
14
at
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyo teHandler.java:199)
at
org.apache.jk.common.HandlerRequest.invoke(Handler Request.java:282)
at
org.apache.jk.common.ChannelSocket.invoke(ChannelS ocket.java:754)
at
org.apache.jk.common.ChannelSocket.processConnecti on(ChannelSocket.java:
684)
at org.apache.jk.common.ChannelSocket
$SocketConnection.runIt(ChannelSocket.java:876)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)

 
Reply With Quote
 
 
 
 
rajeshmuthu rajeshmuthu is offline
Junior Member
Join Date: Apr 2009
Posts: 3
 
      04-14-2009
Hi
Do you find a solution? I'm having the same issue.
I'm using JBoss.
JBoss Version: jboss-4.0.2
Java version: jdk1.5.0_06
velocity version: 1.6.1
log4j: 1.2.14

Thanks
RM

java.lang.IllegalStateException: Current state = FLUSHED, new state = CODING
java.lang.IllegalStateException: Current state = FLUSHED, new state = CODING
at java.nio.charset.CharsetEncoder.throwIllegalStateE xception(CharsetEncoder.java:941)
at java.nio.charset.CharsetEncoder.encode(CharsetEnco der.java:537)
at sun.nio.cs.StreamEncoder$CharsetSE.implWrite(Strea mEncoder.java:384)
at sun.nio.cs.StreamEncoder.write(StreamEncoder.java: 136)
at sun.nio.cs.StreamEncoder.write(StreamEncoder.java: 146)
at java.io.OutputStreamWriter.write(OutputStreamWrite r.java:204)
at java.io.Writer.write(Writer.java:126)
at org.apache.log4j.helpers.CountingQuietWriter.write (CountingQuietWriter.java:44)
at org.apache.log4j.WriterAppender.subAppend(WriterAp pender.java:301)
at org.apache.log4j.RollingFileAppender.subAppend(Rol lingFileAppender.java:236)
at org.apache.log4j.WriterAppender.append(WriterAppen der.java:159)
at org.apache.log4j.AppenderSkeleton.doAppend(Appende rSkeleton.java:230)
at org.apache.log4j.helpers.AppenderAttachableImpl.ap pendLoopOnAppenders(AppenderAttachableImpl.java:65 )
at org.apache.log4j.Category.callAppenders(Category.j ava:203)
at org.apache.log4j.Category.forcedLog(Category.java: 38
at org.apache.log4j.Category.error(Category.java:302)
at org.apache.velocity.runtime.log.SimpleLog4JLogSyst em.logVelocityMessage(SimpleLog4JLogSystem.java:15 1)
at org.apache.velocity.runtime.log.LogChuteSystem.log (LogChuteSystem.java:74)
at org.apache.velocity.runtime.log.Log.log(Log.java:8 6)
at org.apache.velocity.runtime.log.Log.error(Log.java :226)
at org.apache.velocity.runtime.resource.ResourceManag erImpl.getResource(ResourceManagerImpl.java:374)
at org.apache.velocity.runtime.RuntimeInstance.getTem plate(RuntimeInstance.java:1400)
at org.apache.velocity.runtime.RuntimeInstance.getTem plate(RuntimeInstance.java:1380)
at org.apache.velocity.app.VelocityEngine.getTemplate (VelocityEngine.java:401)
 
Reply With Quote
 
 
 
 
rajeshmuthu rajeshmuthu is offline
Junior Member
Join Date: Apr 2009
Posts: 3
 
      04-16-2009
I found a solution. I don't know its a permanent one or not. Since this solution is implemented yesterday without any problems.
When Initializing velocity servlet this line was missing previously in our code.
"velocity.setProperty("runtime.log.logsystem.log4j .category", "velocity");" Which I think caused the problem. Once added, its running without any issues.
Sample code:

public void init(ServletConfig config) throws ServletException {
super.init();
String dir = System.getProperty("com.abc", "C:/abc");
abcPropertiesFile = dir + "/properties/abc.properties";
abcProperties = PropertiesHandler.getProperties(abcPropertiesFile) ;
templateDir = abcProperties.getProperty("rssDir");
velocity = new VelocityEngine();
velocity.setProperty(RuntimeConstants.RUNTIME_LOG_ LOGSYSTEM_CLASS,"org.apache.velocity.runtime.log.S impleLog4JLogSystem");
velocity.setProperty("runtime.log.logsystem.log4j. category", "velocity");
velocity.setProperty("file.resource.loader.path", templateDir);
velocity.setProperty("velocimacro.permissions.allo w.inline.to.replace.global","true");
velocity.setProperty("velocimacro.library", "macros." + "rss" + ",sys/macros." + "rss");
try {
velocity.init();
}
catch (Exception e1) {
logger.info(e1, e1);
}

}
 
Reply With Quote
 
alexg alexg is offline
Junior Member
Join Date: May 2009
Posts: 1
 
      05-13-2009
Hi rajeshmuthu,
I am having the same issue.
Can you confirm that this solution worked?
 
Reply With Quote
 
rajeshmuthu rajeshmuthu is offline
Junior Member
Join Date: Apr 2009
Posts: 3
 
      05-13-2009
Its working without any problem.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
using the current method name within current method Matthew Heidemann Ruby 14 03-22-2011 03:56 AM
Thread.current.parent and Thread.current.ancestors ara.t.howard@noaa.gov Ruby 3 02-16-2007 03:34 PM
general coding issues - coding style... calmar Python 11 02-21-2006 10:36 AM
New book on Information Theory and State-of-the-art Coding Theory David MacKay VOIP 0 11-05-2003 10:42 PM
How to change the current thread current culture at run time. Manu ASP .Net 1 07-20-2003 03:27 PM



Advertisments