首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

tomcat有关问题.

2013-09-11 
tomcat问题.....当机时日志为:java.lang.OutOfMemoryError:Javaheapspaceorg.apache.catalina.core.Standa

tomcat问题.....
当机时日志为:
java.lang.OutOfMemoryError:   Java   heap   space
org.apache.catalina.core.StandardWrapperValve   invoke
严重:   Servlet.service()   for   servlet   default   threw   exception
java.lang.OutOfMemoryError:   Java   heap   space
org.apache.catalina.connector.CoyoteAdapter   service
严重:   An   exception   or   error   occurred   in   the   container   during   the   request   processing
java.lang.OutOfMemoryError:   Java   heap   space
org.apache.catalina.core.StandardWrapperValve   invoke
严重:   Servlet.service()   for   servlet   action   threw   exception
java.lang.OutOfMemoryError
at   com.microsoft.util.UtilPagedTempBuffer.compressBlockList(Unknown   Source)
at   com.microsoft.util.UtilPagedTempBuffer.getBlock(Unknown   Source)
at   com.microsoft.util.UtilPagedTempBuffer.write(Unknown   Source)
at   com.microsoft.util.UtilPagedTempBuffer.write(Unknown   Source)
at   com.microsoft.util.UtilByteArrayDataProvider.receive(Unknown   Source)
at   com.microsoft.util.UtilByteOrderedDataReader.receive(Unknown   Source)
at   com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.submitRequest(Unknown   Source)
at   com.microsoft.jdbc.sqlserver.tds.TDSCursorRequest.openCursor(Unknown   Source)
at   com.microsoft.jdbc.sqlserver.SQLServerImplStatement.execute(Unknown   Source)
at   com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown   Source)
at   com.microsoft.jdbc.base.BaseStatement.executeQueryInternal(Unknown   Source)
at   com.microsoft.jdbc.base.BaseStatement.executeQuery(Unknown   Source)
at   org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:188)
at   DBManager.DBManager.getDB_returnArrayListSelect(DBManager.java:74)
at   tools.IPConversion.getClientAddress(IPConversion.java:17)
at   com.yourcompany.struts.action.IsWhichWebAction.execute(IsWhichWebAction.java:57)
at   org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at   org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at   org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at   org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at   javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at   javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at   org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at   org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at   org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at   org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at   org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at   org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at   org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:425)
at   org.apache.coyote.ajp.AjpAprProtocol$AjpConnectionHandler.process(AjpAprProtocol.java:452)
at   org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1285)
at   java.lang.Thread.run(Unknown   Source)
我用了dbcp连接池,数据库(SQL   Server2000)驱动为微软的,现成周期性连不上数据库,当机.



问题:
      1.   dbcp   连接池咋样啊?
      2.   看日志信息好像是内存溢出,可以设置JVM   虚拟内存,但是治标不治本,这样只能加长当机周期,怎么解决啊?
      3.   为什么过一段时间(大约为1个礼拜),数据库就连接不上了啊?
      4.   连接池配置:
            <data-sources   >
    <data-source   key= "data_key "   type= "org.apache.commons.dbcp.BasicDataSource ">
            <set-property   property= "password "   value= "sa "   />
            <set-property   property= "minCount "   value= "30 "   />
            <set-property   property= "maxCount "   value= "1000 "   />
            <set-property   property= "username "   value= "sa "   />
            <set-property   property= "driverClassName "   value= "com.microsoft.jdbc.sqlserver.SQLServerDriver "   />
            <set-property   property= "description "   value= "data_key "   />
            <set-property   property= "url "   value= "jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=databasename; "   />
            <set-property   property= "readOnly "   value= "true "   />
            <set-property   property= "autoCommit "   value= "true "   />
            <set-property   property= "maxWait "   value= "10000 "   />
</data-source>
网站访问量比较大,连接池这样设置,合理吗?

目前只能等挂了重启服务器来解决..郁闷...小弟菜鸟,请各位大哥指点迷津啊!谢谢.....急!

[解决办法]
<set-property property= "minCount " value= "30 " />
<set-property property= "maxCount " value= "1000 " />


应该不用1000的。

[解决办法]
连接有释放掉么?
[解决办法]
同意楼上的方法 要在每次用到 数据库之后及时释放连接
[解决办法]
4个问题综合起来就是一个问题

就是看你的数据库连接以及释放是否正确地编写了。。。
[解决办法]
赶紧把驱动程序换了吧,微软的JDBC驱动程序很垃圾,问题多多,换jtds,性能要好很多
我的异常网推荐解决方案:Servlet.service() for servlet default threw exception,http://www.myexception.cn/eclipse/181756.html

热点排行