微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

我的应用程序使tomcat崩溃了

如何解决我的应用程序使tomcat崩溃了

| 一段时间并请求多个页面后,出现以下错误。 我怎样才能解决这个问题?
May 26,2011 1:02:16 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet Api threw exception
java.lang.OutOfMemoryError: GC overhead limit exceeded
    at com.sun.net.ssl.internal.ssl.InputRecord.<init>(UnkNown Source)
    at com.sun.net.ssl.internal.ssl.AppInputStream.<init>(UnkNown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.init(UnkNown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>(UnkNown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(UnkNown Source)
    at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1472)
    at com.microsoft.sqlserver.jdbc.sqlServerConnection.connectHelper(sqlServerConnection.java:1042)
    at com.microsoft.sqlserver.jdbc.sqlServerConnection.login(sqlServerConnection.java:817)
    at com.microsoft.sqlserver.jdbc.sqlServerConnection.connect(sqlServerConnection.java:700)
    at com.microsoft.sqlserver.jdbc.sqlServerDriver.connect(sqlServerDriver.java:842)
    at java.sql.DriverManager.getConnection(UnkNown Source)
    at java.sql.DriverManager.getConnection(UnkNown Source)
    at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:114)
    at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2836)
    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2832)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1843)
    at de.giz.ff.domain.Subject.findSubject(Subject.java:139)
    at de.giz.ff.domain.Question.getSubjectName(Question.java:354)
    at de.giz.ff.server.Api.doFetch(Api.java:66)
    at de.giz.ff.server.Api.doGet(Api.java:199)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    at org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:427)
May 26,2011 1:02:27 PM org.apache.catalina.core.ApplicationContext log
SEVERE: Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method \'public abstract java.util.ArrayList de.giz.ff.client.FrageFunktionService.getTextsAndRights(int,java.lang.String)\' threw an unexpected exception: java.lang.OutOfMemoryError: GC overhead limit exceeded
    at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:385)
    at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:588)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processpost(RemoteServiceServlet.java:248)
    at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at waffle.servlet.NegotiateSecurityFilter.doFilterPrincipal(UnkNown Source)
    at waffle.servlet.NegotiateSecurityFilter.doFilter(UnkNown Source)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)
    at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
    at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)
    at java.lang.Thread.run(UnkNown Source)
Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
    at java.util.HashMap.<init>(UnkNown Source)
    at org.hibernate.dialect.function.sqlFunctionRegistry.<init>(sqlFunctionRegistry.java:37)
    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:212)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1845)
    at de.giz.ff.domain.Client.findClient(Client.java:49)
    at de.giz.ff.server.FrageFunktionServiceImpl.getTextsAndRights(FrageFunktionServiceImpl.java:123)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(UnkNown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(UnkNown Source)
    at java.lang.reflect.Method.invoke(UnkNown Source)
    at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
    ... 21 more
    

解决方法

我建议下载VisualVM 1.3.2,安装其所有插件,然后将其指向您的Tomcat应用程序以查看发生了什么。它可以让您看到不同的内存世代,正在分配的对象,正在运行的线程等。这是大量的信息。 我在堆栈跟踪中看到了Hibernate和SQL Server。我敢打赌,休眠反射会迅速填满您的烫发空间。     ,看起来您的应用程序使用了太多的内存。您可以尝试增加Tomcat分配的内存量。如果您将Tomcat作为服务安装在Windows上,则可以使用Tomcat监视器轻松进行此操作,否则我认为您需要编辑配置文件。 我应该指出,如果您的应用程序发生内存泄漏,但是分配给Tomcat的内存过多,最终将导致崩溃。您还应该检查应用程序,以确保不会在内存中创建很多无法销毁的对象。     ,看来您的垃圾收集器无法允许更多的内存,请尝试在setenv.sh中允许更多的内存,否则您可能会发生内存泄漏     

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。