请问tomcat一段时间就死机是什么情况?

小营123 北京华博科讯信息技术有限公司 2011-06-16 11:06:31
和数据库的链接有关系吗?

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<property name="initialSize" value="200" />
<property name="maxActive" value="1608" />
<property name="maxIdle" value="200" />
<property name="minIdle" value="0" />
<property name="maxWait" value="300000" />
<property name="numTestsPerEvictionRun" value="3" />
<property name="testOnBorrow" value="true" />
<property name="testOnReturn" value="false" />
<property name="testWhileIdle" value="false" />
<property name="validationQuery" value="select 1 from DUAL" />
<property name="defaultAutoCommit" value="false" />
<property name="defaultReadOnly" value="false" />
<property name="poolPreparedStatements" value="false" />
<property name="maxOpenPreparedStatements" value="0" />
<property name="minEvictableIdleTimeMillis" value="1800000" />
<property name="timeBetweenEvictionRunsMillis" value="900000" />
</bean>
...全文
454 18 点赞 打赏 收藏 举报
写回复
18 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
wxbhlj 2011-08-17
数据库连接的配置非常不好,虽然和OutOfMemoryError没关系。
  • 打赏
  • 举报
回复
fh13760184 2011-08-16
系统常量较多 持久代 内存不足



将 -XX:MaxPermSize=n: 这参数调大 即可
  • 打赏
  • 举报
回复
muyipan 2011-08-16
内存溢出了
  • 打赏
  • 举报
回复
song6295 2011-07-12
java.lang.OutOfMemoryError: PermGen space

PermGen 是存放加载的class的空间。 这个调Xmx Xms没用, 你需要适当的调一下这个参数:
-XX:PermSize=256MB -XX:MaxPermSize=256MB
  • 打赏
  • 举报
回复
小营123 2011-06-22
你好是这样的吗?

rem Execute Java with the applicable properties
if not "%JPDA%" == "" goto doJpda
if not "%SECURITY_POLICY_FILE%" == "" goto doSecurity
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS%-Xms256m -Xmx512m -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
goto end
:doSecurity
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS%-Xms256m -Xmx512m -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Djava.security.manager -Djava.security.policy=="%SECURITY_POLICY_FILE%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
goto end
:doJpda
if not "%SECURITY_POLICY_FILE%" == "" goto doSecurityJpda
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %JPDA_OPTS% %DEBUG_OPTS%-Xms256m -Xmx512m -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
goto end
:doSecurityJpda
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %JPDA_OPTS% %DEBUG_OPTS%-Xms256m -Xmx512m -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Djava.security.manager -Djava.security.policy=="%SECURITY_POLICY_FILE%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
goto end
  • 打赏
  • 举报
回复
roemin 2011-06-22
修改 tomcat\bin\Catalina.bat 文件
在166行左右
rem Execute Java with the applicable properties ”以下每行
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%

在 %DEBUG_OPTS% 后面添加-Xms256m -Xmx512m

保存后,重新以命令行的方式运行 tomcat ,即可,然后通过最后面介绍的如何观察tomcat现有内存情况的方法进行查看是否已经变更成功。
  • 打赏
  • 举报
回复
小营123 2011-06-20
[Quote=引用 4 楼 c_4444 的回复:]
java.lang.OutOfMemoryError: PermGen space
内存溢出。。。

解决方法也一定是加大内存。
如果你的WEB APP下都用了大量的第三方jar, 其大小 超过了jvm默认的大小(4M)那么就会产生此错误信息了。
[/Quote]

兄弟,这个如何解决啊?
  • 打赏
  • 举报
回复
小营123 2011-06-20
[Quote=引用 10 楼 niit_like 的回复:]
试试看吧
[/Quote]

嗯,好的,谢谢了,大哥。
  • 打赏
  • 举报
回复
niit_like 2011-06-20
试试看吧
  • 打赏
  • 举报
回复
小营123 2011-06-20
[Quote=引用 8 楼 niit_like 的回复:]
写一个批处理,来启动tomcat

@echo off

set JAVA_HOME=D:\Program Files\Java\jdk1.6.0_20
set PATH=%JAVA_HOME%\bin
set CLASSPATH=.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar
set JAVA_O……
[/Quote]


你好,我的tomcat是解压开就可以用的,bin目录下就有个startup.bat,我只要加入:
set JAVA_OPTS=-Xms256m -Xmx512m -Duser.timezone=GMT+08 -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n -Dcom.sun.management.jmxremote

就行了,对吧?大哥
  • 打赏
  • 举报
回复
niit_like 2011-06-20
写一个批处理,来启动tomcat

@echo off

set JAVA_HOME=D:\Program Files\Java\jdk1.6.0_20
set PATH=%JAVA_HOME%\bin
set CLASSPATH=.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar
set JAVA_OPTS=-Xms256m -Xmx512m -Duser.timezone=GMT+08 -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n -Dcom.sun.management.jmxremote

C:
CD C:\Program Files\apache-tomcat-6.0.20\bin
startup.bat
  • 打赏
  • 举报
回复
小营123 2011-06-20
[Quote=引用 6 楼 niit_like 的回复:]
把你的jar包放在tomcat的lib里面,或者改jvm的内存
[/Quote]

你好,我放过去启动时报错:

[ERROR] <2011-06-20 11:40:45:093> XFireServlet::51:init: Error initializing XFireServlet.
java.lang.IllegalStateException: Could not find valid implementation for: 2.0
at org.apache.xbean.spring.context.impl.XBeanHelper.createBeanDefinitionReader(XBeanHelper.java:48)
at org.codehaus.xfire.spring.XFireConfigLoader.getXFireApplicationContext(XFireConfigLoader.java:74)
at org.codehaus.xfire.spring.XFireConfigLoader.loadContext(XFireConfigLoader.java:41)
at org.codehaus.xfire.transport.http.XFireConfigurableServlet.loadConfig(XFireConfigurableServlet.java:86)
at org.codehaus.xfire.transport.http.XFireConfigurableServlet.createXFire(XFireConfigurableServlet.java:54)
at org.codehaus.xfire.transport.http.XFireServlet.init(XFireServlet.java:45)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4350)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4659)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
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:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.apache.xbean.spring.context.impl.XBeanHelper.createBeanDefinitionReader(XBeanHelper.java:46)
... 32 more
Caused by: java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.XmlBeanDefinitionReader.setValidationMode(I)V
at org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader.<init>(XBeanXmlBeanDefinitionReader.java:58)
... 37 more


如何改jvm的内存?大哥。

谢谢了。
  • 打赏
  • 举报
回复
niit_like 2011-06-20
把你的jar包放在tomcat的lib里面,或者改jvm的内存
  • 打赏
  • 举报
回复
小营123 2011-06-17
你好 错误日志:


[INFO] <2011-06-01 08:07:44:904> SessionListener::50:sessionCreated: session created!
Jun 1, 2011 8:08:14 AM org.apache.catalina.connector.CoyoteAdapter service
SEVERE: An exception or error occurred in the container during the request processing
java.lang.OutOfMemoryError: PermGen space
Jun 1, 2011 8:08:16 AM org.apache.coyote.http11.Http11Processor process
SEVERE: Error finishing response
java.lang.OutOfMemoryError: PermGen space
Jun 1, 2011 8:08:20 AM org.apache.catalina.connector.CoyoteAdapter service
SEVERE: An exception or error occurred in the container during the request processing
java.lang.OutOfMemoryError: PermGen space
Jun 1, 2011 8:08:22 AM org.apache.coyote.http11.Http11Processor process
SEVERE: Error finishing response
java.lang.OutOfMemoryError: PermGen space
Jun 1, 2011 8:08:26 AM org.apache.catalina.connector.CoyoteAdapter service
SEVERE: An exception or error occurred in the container during the request processing
java.lang.OutOfMemoryError: PermGen space
Jun 1, 2011 8:08:28 AM org.apache.coyote.http11.Http11Processor process
SEVERE: Error finishing response
java.lang.OutOfMemoryError: PermGen space
Jun 1, 2011 8:08:35 AM org.apache.catalina.connector.CoyoteAdapter service
SEVERE: An exception or error occurred in the container during the request processing
java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-80-12" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-80-4" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-80-8" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-80-2" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-80-21" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-80-1" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-80-16" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-80-7" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-80-5" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-80-22" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-80-14" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-80-17" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-80-11" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-80-24" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-80-23" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-80-25" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-80-27" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-80-29" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-80-30" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-80-28" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-80-26" java.lang.OutOfMemoryError: PermGen space
java.lang.reflect.InvocationTargetException
Exception in thread "main" java.lang.OutOfMemoryError: PermGen space
Jun 1, 2011 9:03:47 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/jdk1.6.0_20/jre/lib/amd64/server:/usr/java/jdk1.6.0_20/jre/lib/amd64:/usr/java/jdk1.6.0_20/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
Jun 1, 2011 9:03:47 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property.
Jun 1, 2011 9:03:47 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-80
Jun 1, 2011 9:03:47 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 403 ms
Jun 1, 2011 9:03:47 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jun 1, 2011 9:03:47 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.29
  • 打赏
  • 举报
回复
编程小妞儿 2011-06-17
java.lang.OutOfMemoryError: PermGen space
内存溢出。。。

解决方法也一定是加大内存。
如果你的WEB APP下都用了大量的第三方jar, 其大小 超过了jvm默认的大小(4M)那么就会产生此错误信息了。
  • 打赏
  • 举报
回复
hebeiliuzhao0909 2011-06-17
内存泄露了
  • 打赏
  • 举报
回复
皮皮 2011-06-16
有错误日志没有?
  • 打赏
  • 举报
回复
相关推荐
发帖
高性能WEB开发
创建于2008-07-01

2.5w+

社区成员

高性能WEB开发
申请成为版主
帖子事件
创建了帖子
2011-06-16 11:06
社区公告
暂无公告