tomcat5 莫名死机

tomcat5 莫名死机

如题,一天死好几回,部分日志:
java.lang.IllegalStateException: getOutputStream() has already been called for this response
        at org.apache.catalina.connector.Response.getWriter(Response.java:607)
        at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:196)
        at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:125)
        at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:11
        at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:179)
        at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:116)
        at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:76)
        at org.apache.jsp.include.image_jsp._jspService(image_jsp.java:7
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:9
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:18
        at com.et.filter.EncodeFilter.doFilter(EncodeFilter.java:53)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:18
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:10
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
        at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:52
        at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
        at java.lang.Thread.run(Thread.java:595)
2008-08-18 11:03:03>>:success logout
忽然觉得这里的人怎么这么少啊
没人 自己up
自己up
是不是输出图形验证码的?
恩 好像是这个错误,但是不知道为啥老死机
你用的网上的一个jsp图形校验码把?

[Copy to clipboard] [ - ]
CODE:
<%@ page contentType="image/jpeg" import="java.awt.*,java.awt.image.*,java.util.*,javax.imageio.*" %>
<%!
Color getRandColor(int fc,int bc){//给定范围获得随机颜色
        Random random = new Random();
        if(fc>255) fc=255;
        if(bc>255) bc=255;
        int r=fc+random.nextInt(bc-fc);
        int g=fc+random.nextInt(bc-fc);
        int b=fc+random.nextInt(bc-fc);
        return new Color(r,g,b);
        }
%>
<%
//设置页面不缓存
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);

// 在内存中创建图象
int width=40, height=16;
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);

// 获取图形上下文
Graphics g = image.getGraphics();

//生成随机类
Random random = new Random();

// 设定背景色
g.setColor(getRandColor(200,250));
g.fillRect(0, 0, width, height);

//设定字体
g.setFont(new Font("Times New Roman",Font.BOLD,15));

//画边框
//g.setColor(new Color());
//g.drawRect(0,0,width-1,height-1);

// 随机产生155条干扰线,使图象中的认证码不易被其它程序探测到
g.setColor(getRandColor(160,200));
for (int i=0;i<155;i++)
{
int x = random.nextInt(width);
int y = random.nextInt(height);
        int xl = random.nextInt(12);
        int yl = random.nextInt(12);
g.drawLine(x,y,x+xl,y+yl);
}

// 取随机产生的认证码(4位数字)
String sRand="";
for (int i=0;i<4;i++){
    String rand=String.valueOf(random.nextInt(10));
    sRand+=rand;
    // 将认证码显示到图象中
    g.setColor(new Color(20+random.nextInt(110),20+random.nextInt(110),20+random.nextInt(110)));
//调用函数出来的颜色相同,可能是因为种子太接近,所以只能直接生成
    g.drawString(rand,9*i+2,12);
}

// 将认证码存入SESSION
session.setAttribute("codestr",sRand);

// 图象生效
g.dispose();

// 输出图象到页面
ImageIO.write(image, "JPEG", response.getOutputStream());
%>

死机肯定是另外的问题了,这个只是会经常抛一些异常而已。
恩 我也觉得是另有问题 只是不知道问题是啥。并且shutdown.sh不管用,只能kill掉,启动时输出:
Sep 1, 2008 4:30:19 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/jdk1.5.0_11/jre/lib/i386/server:/usr/java/jdk1.5.0_11/jre/lib/i386:/usr/java/jdk1.5.0_11/jre/../lib/i386
Sep 1, 2008 4:30:20 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Sep 1, 2008 4:30:20 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1378 ms
Sep 1, 2008 4:30:20 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Sep 1, 2008 4:30:20 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.26
Sep 1, 2008 4:30:20 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Sep 1, 2008 4:30:20 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/usr/local/tomcat5.5.26/webapps/wap/WEB-INF/lib/servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
=============================================================
================GlobalListener created===================
=============================================================
====>>绯荤诲濞猞猞
2008-09-01 16:30:21,464 [net.sf.hibernate.cfg.Environment]-[INFO] Hibernate 2.1.7
2008-09-01 16:30:21,468 [net.sf.hibernate.cfg.Environment]-[INFO] hibernate.properties not found
2008-09-01 16:30:21,474 [net.sf.hibernate.cfg.Environment]-[INFO] using CGLIB reflection optimizer
2008-09-01 16:30:21,478 [net.sf.hibernate.cfg.Environment]-[INFO] using JDK 1.4 java.sql.Timestamp handling
2008-09-01 16:30:21,489 [net.sf.hibernate.cfg.Configuration]-[INFO] configuring from resource: /hibernate.cfg.xml
2008-09-01 16:30:21,490 [net.sf.hibernate.cfg.Configuration]-[INFO] Configuration resource: /hibernate.cfg.xml
2008-09-01 16:30:21,597 [net.sf.hibernate.util.XMLHelper]-[WARN] Warning parsing XML: /hibernate.cfg.xml(1) URI was not reported to parser for entity [document]
2008-09-01 16:30:21,635 [net.sf.hibernate.util.XMLHelper]-[WARN] Warning parsing XML: /hibernate.cfg.xml(4) No base URI; hope URI is absolute: http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd
2008-09-01 16:30:21,643 [net.sf.hibernate.util.XMLHelper]-[WARN] Warning parsing XML: /hibernate.cfg.xml(4) No base URI; hope this SYSTEM id is absolute: http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd
2008-09-01 16:30:21,745 [net.sf.hibernate.cfg.Configuration]-[INFO] Mapping resource: com/et/buss/Code.hbm.xml
2008-09-01 16:30:21,749 [net.sf.hibernate.util.XMLHelper]-[WARN] Warning parsing XML: XML InputStream(1) URI was not reported to parser for entity [document]
2008-09-01 16:30:21,751 [net.sf.hibernate.util.XMLHelper]-[WARN] Warning parsing XML: XML InputStream(4) No base URI; hope URI is absolute: http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd
2008-09-01 16:30:21,752 [net.sf.hibernate.util.XMLHelper]-[WARN] Warning parsing XML: XML InputStream(4) No base URI; hope this SYSTEM id is absolute: http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd
2008-09-01 16:30:22,000 [net.sf.hibernate.cfg.Binder]-[INFO] Mapping class: com.et.buss.Code -> code
2008-09-01 16:30:22,231 [net.sf.hibernate.cfg.Configuration]-[INFO] Configured SessionFactory: null
2008-09-01 16:30:22,235 [net.sf.hibernate.cfg.Configuration]-[INFO] processing one-to-many association mappings
2008-09-01 16:30:22,235 [net.sf.hibernate.cfg.Configuration]-[INFO] processing one-to-one association property references
2008-09-01 16:30:22,236 [net.sf.hibernate.cfg.Configuration]-[INFO] processing foreign key constraints
2008-09-01 16:30:22,311 [net.sf.hibernate.dialect.Dialect]-[INFO] Using dialect: net.sf.hibernate.dialect.MySQLDialect
2008-09-01 16:30:22,345 [net.sf.hibernate.cfg.SettingsFactory]-[INFO] Maximim outer join fetch depth: 2
2008-09-01 16:30:22,346 [net.sf.hibernate.cfg.SettingsFactory]-[INFO] Use outer join fetching: true
2008-09-01 16:30:22,359 [net.sf.hibernate.connection.C3P0ConnectionProvider]-[INFO] C3P0 using driver: org.gjt.mm.mysql.Driver at URL: jdbc:mysql://192.168.0.202:3306/map
2008-09-01 16:30:22,360 [net.sf.hibernate.connection.C3P0ConnectionProvider]-[INFO] Connection properties: {user=map, password=bjdyMAP}
2008-09-01 16:30:22,480 [net.sf.hibernate.transaction.TransactionManagerLookupFactory]-[INFO] No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@1202d69 [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@f1f051 [ acquireIncrement -> 1, autoCommitOnClose -> false, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, idleConnectionTestPeriod -> 0, initialPoolSize -> 5, maxIdleTime -> 1800, maxPoolSize -> 100, maxStatements -> 50, minPoolSize -> 5, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@1855562 [ description -> null, driverClass -> null, factoryClassLocation -> null, jdbcUrl -> jdbc:mysql://192.168.0.202:3306/map, properties -> {user=map, password=bjdyMAP} ] , propertyCycle -> 300, testConnectionOnCheckout -> false ] , factoryClassLocation -> null, numHelperThreads -> 3 ]
2008-09-01 16:30:23,937 [net.sf.hibernate.cfg.SettingsFactory]-[INFO] Use scrollable result sets: true
2008-09-01 16:30:23,939 [net.sf.hibernate.cfg.SettingsFactory]-[INFO] Use JDBC3 getGeneratedKeys(): true
2008-09-01 16:30:23,940 [net.sf.hibernate.cfg.SettingsFactory]-[INFO] Optimize cache for minimal puts: false
2008-09-01 16:30:23,940 [net.sf.hibernate.cfg.SettingsFactory]-[INFO] echoing all SQL to stdout
2008-09-01 16:30:23,941 [net.sf.hibernate.cfg.SettingsFactory]-[INFO] Query language substitutions: {}
2008-09-01 16:30:23,941 [net.sf.hibernate.cfg.SettingsFactory]-[INFO] cache provider: net.sf.hibernate.cache.EhCacheProvider
2008-09-01 16:30:23,948 [net.sf.hibernate.cfg.Configuration]-[INFO] instantiating and configuring caches
2008-09-01 16:30:24,190 [net.sf.hibernate.impl.SessionFactoryImpl]-[INFO] building session factory
2008-09-01 16:30:25,580 [net.sf.hibernate.impl.SessionFactoryObjectFactory]-[INFO] Not binding factory to JNDI, no JNDI name configured2008-09-01 16:30:25>>:>>>?鸿挎ユ锛--------33from tb_public_code limit 0,2147483647
2008-09-01 16:30:25>>:db closed!
====>>绯荤诲у骘?
2008-09-01 16:30:25,765 [org.apache.struts.util.PropertyMessageResources]-[INFO] Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
2008-09-01 16:30:25,766 [org.apache.struts.util.PropertyMessageResources]-[INFO] Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
2008-09-01 16:30:25,944 [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/wap]]-[ERROR] StandardWrapper.Throwable
java.lang.NullPointerException
        at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:1003)
        at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:955)
        at org.apache.struts.action.ActionServlet.init(ActionServlet.java:470)
        at javax.servlet.GenericServlet.init(GenericServlet.java:212)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3956)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4230)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
        at org.apache.catalina.core.StandardService.start(StandardService.java:44
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
2008-09-01 16:30:25,951 [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/wap]]-[ERROR] Servlet /wap threw load() exception
java.lang.NullPointerException
        at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:1003)
        at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:955)
        at org.apache.struts.action.ActionServlet.init(ActionServlet.java:470)
        at javax.servlet.GenericServlet.init(GenericServlet.java:212)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3956)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4230)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
        at org.apache.catalina.core.StandardService.start(StandardService.java:44
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)

---- SimpleUploaderServlet initialization started ----

php|php3|php5|phtml|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|dll|reg|cgi
0 - php
1 - php3
2 - php5
3 - phtml
4 - asp
5 - aspx
6 - ascx
7 - jsp
8 - cfm
9 - cfc
10 - pl
11 - bat
12 - exe
13 - dll
14 - reg
15 - cgi
jpg|gif|jpeg|png|bmp
0 - jpg
1 - gif
2 - jpeg
3 - png
4 - bmp

swf|fla
0 - swf
1 - fla

---- SimpleUploaderServlet initialization completed ----

Sep 1, 2008 4:30:27 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Sep 1, 2008 4:30:27 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Sep 1, 2008 4:30:27 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/57  config=null
Sep 1, 2008 4:30:28 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Sep 1, 2008 4:30:28 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 8198 ms

看看连接池等资源发生泄漏了吗