Opened 16 years ago
Closed 16 years ago
#1040 closed defect (fixed)
Exceptions when stopping Tomcat
Reported by: | Nicklas Nordborg | Owned by: | Nicklas Nordborg |
---|---|---|---|
Priority: | major | Milestone: | BASE 2.8 |
Component: | web | Version: | |
Keywords: | Cc: |
Description
This has been around for a long time... When stopping Tomcat using the script provided by Tomcat () there are several errors logged in catalina.out. Here is a few examples:
log4j:ERROR Error occured while converting date. java.lang.NullPointerException at java.lang.System.arraycopy(Native Method) at java.lang.AbstractStringBuilder.getChars(AbstractStringBuilder.java:328) at java.lang.StringBuffer.getChars(StringBuffer.java:201) at org.apache.log4j.helpers.AbsoluteTimeDateFormat.format(AbsoluteTimeDateFormat.java:117) at java.text.DateFormat.format(DateFormat.java:316) at org.apache.log4j.helpers.PatternParser$DatePatternConverter.convert(PatternParser.java:444) at org.apache.log4j.helpers.PatternConverter.format(PatternConverter.java:64) at org.apache.log4j.PatternLayout.format(PatternLayout.java:503) at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:301) at org.apache.log4j.WriterAppender.append(WriterAppender.java:159) at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230) at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65) at org.apache.log4j.Category.callAppenders(Category.java:203) at org.apache.log4j.Category.forcedLog(Category.java:388) at org.apache.log4j.Category.info(Category.java:663) at net.sf.basedb.core.Application.stop(Application.java:573) at net.sf.basedb.core.Application$1.run(Application.java:543) at java.lang.Thread.run(Thread.java:619) Exception in thread "Thread-18" java.lang.NullPointerException at org.apache.log4j.helpers.PatternConverter.spacePad(PatternConverter.java:106) at org.apache.log4j.helpers.PatternConverter.format(PatternConverter.java:82) at org.apache.log4j.PatternLayout.format(PatternLayout.java:503) at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:301) at org.apache.log4j.WriterAppender.append(WriterAppender.java:159) at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230) at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65) at org.apache.log4j.Category.callAppenders(Category.java:203) at org.apache.log4j.Category.forcedLog(Category.java:388) at org.apache.log4j.Category.info(Category.java:663) at net.sf.basedb.core.Application.stop(Application.java:573) at net.sf.basedb.core.Application$1.run(Application.java:543) at java.lang.Thread.run(Thread.java:619)
The problem seems to be that as the Java virtual machine is shutting down things the logging system is one of the first things to go. Later on, when Application.stop()
is called, it will try to use a non-working logging system, which results in the exceptions.
This problem could be solved by a servlet that is configured to load on startup, and calls Application.start()
in it's init()
method and Application.stop()
in it's destroy()
method.
This was not really a big issue before, since everything was going down anyway. The only side effect was leaving a few session in the logged-in state instead of properly logging out all users.
When the 'services' extension point is in place (see #1036), it becomes more important that everything is actually stopped properly. For example, the upcoming FTP server () must be able to close existing connections properly.
Change History (2)
comment:1 by , 16 years ago
Status: | new → assigned |
---|
comment:2 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
(In [4319]) Fixes #1040: Exceptions when stopping Tomcat