错误信息如下:
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.OutOfMemoryError: Java heap space
错误原因:
1.JVM内存过小
2.Http Session资源未释放
3.循环创建Object
4.其他程序不严密,造成gc无法释放资源
解决办法:
错误原因第一种情况:
修改应用服务器参数,增加jvm大小。
1)在执行某个class文件时候,可以使用java -Xmx256M aa.class来设置运行aa.class时jvm所允许占用的最大内存为256M。
2)对tomcat容器,可以在启动时对jvm设置内存限度。对tomcat,可以在catalina.bat中添加:
"set CATALINA_OPTS=-Xms128M -Xmx256M
set JAVA_OPTS=-Xms128M -Xmx256M",或者把%CATALINA_OPTS%和%JAVA_OPTS%代替为-Xms128M -Xmx256M
错误原因第二种情况:
通过session的invalidate()方法将session的资源释放
错误原因第三种情况:
可以在类的初始化方法中声明对象;
public void xx(){
for (int i = 0; i < 10000; i++) {
A a = new A();
a...........
System.out.println(a);
}
}
转换为
private void init(){
A a = new A();
}
public void xx(){
for (int i = 0; i < 10000; i++) {
a...........
System.out.println(a);
}
}
错误原因第四种情况:
修改程序结构,优化架构设计。
分享到:
相关推荐
javax.servlet.ServletException: Servlet execution threw an exception root cause java.lang.Error: Unresolved compilation problem: The method setAttribute(String, Object) in the type ServletRequest ...
解决Java_heap_space问题
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException 解决这个问题
java连接mysql数据库的驱动,里边包含两个版本:5.1.47、8.0.28 也可从以下两个地址免费下载: 1. https://repo1.maven.org/maven2/mysql/mysql-connector-java/ 2. ...
云函数 调用失败 Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID , cloud function service error code -504001, error message Unkown function;...
该存储库用于研究 。其他参考服务游戏容器:使用Maven 3.6,此古老版本... An API incompatibility was encountered while executing org.wildfly.swarm:wildfly-swarm-plugin:2017.11.0:package: java.lang.AbstractM
Error:Execution failed for task ':app:processDebugResources'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\Java\as-sdk\build-...
SOA Using Java Web Services 英文版原文
With an emphasis on improvements and new features in Spark 2.0, authors Bill Chambers and Matei Zaharia break down Spark topics into distinct sections, each with unique goals. You'll explore the ...
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. ...
/> <aop:config> <aop:aspect id="aspect" ref="myAspect"> <aop:pointcut expression="execution(* com.itheima.jdk.*.*(..))“ id="myPointCut" /> <aop:before method="myBefore" pointcut-ref="myPointCut" /> ...
伯克利:A Java Reference Paul N. Hilfinger University of California, Berkeley 1 Java Overview 9 1.1 Basic Program Structure . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.2 Compilation and ...
Error:Execution failed for task ‘:gviews:transformClassesAndResourcesWithProguardForRelease’. Java.io.IOException: The same input jar [E:\Android\myProgram\angel\libs\alipaySdk-20160825.jar] is ...
执行(Execution) ..... 37 概览..... 37 运行状态(Running state) ...................... 37 链接(Links) ........... 37 定时器(Timer) ..... 37 异步动作(AsyncAction) ......................... 38 ...
FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ‘:app:mergeDebugResources’. > Error: java.lang.RuntimeException: Crunching Cruncher ic_default_home_new....
FAILURE: Build failed with an exception. wrong: Execution failed for task ‘ :app : kaptDebugKotlin’. > A failure occurred while executing org. jetbrains . kotlin. gradle . internal . KaptExecution >...
DesugarFirestoreTestIssue 运行:app:connectedDebugAndroidTest ,此示例应触发以下问题: Execution failed for task ':app:connectedDebugAndroidTest'.> There were failing tests. See the report at: file:///...
npm i node-execution-context 入门 让我们从创建应用程序的上下文初始化点开始,然后以简单快递应用程序为例 // main.js const express = require ( 'express' ) ; const Context = require ( 'node-execution-...
执行时间处理时间 node.js实用工具,用于测量代码中的执行时间安装npm install execution-time --save用法const perf = require ( 'execution-time' ) ( ) ;// At beginning of your codeperf . start ( ) ;// At ...
<aop:after-throwing method="exception" pointcut-ref="pointCut"/> aop异常通知 以上结合起来意思就是在调用com.spring.service包或子包下的所有方法之前或之后或抛出异常时依次调用id为logIntercepter的类中的...