Spark执行过程出现outofmemory错误的解决方案

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/cityice/article/details/51610547

进入Spark的conf目录,找到spark-env.sh文件,添加如下值:

export SPARK_WORKER_MEMORY=4g
export SPARK_WORKER_INSTANCES=2
export SPARK_EXECUTOR_MEMORY=4g
export SPARK_DRIVER_MEMORY=4g
export SPARK_JAVA_OPTS="-Xms2048m -Xmx4096m -Dspark.cores.max=2 -Dspark.executor.memory=4g"

考虑只添加如下值应该也可以:

export SPARK_JAVA_OPTS="-Xms2048m -Xmx4096m -Dspark.cores.max=2 -Dspark.executor.memory=4g"

注意上面的2048等数值可以根据配置自行调整。
展开阅读全文

分布式执行过程出现错误

06-06

过程如下:rn 说明:[DSMIS].dsdb.dbo.dsqp 是另一个SQL Server服务器上的一个表,[DSMIS]是在本地SQL Server上建立的一个链接服务器。rnrnCREATE proc P_RECO_YCP_EX(@CUR_USER VARCHAR(10), @NUMS INT OUTPUT)rnASrn--接收远程票rnBEGINrn DECLARE @ls_DeptID CHAR(3), @ReturnVal INTrn rn rn DECLARE @ls_lsh CHAR(11), @ls_JHYJ VARCHAR(800), @ls_FSYJ VARCHAR(800), @ls_BHYJ VARCHAR(800)rn DECLARE @ls_LDYJ VARCHAR(800), @ls_QTSX VARCHAR(800)rn DECLARE @ldt_PZGZSJ1 DateTime, @ldt_PZGZSJ2 DateTimern DECLARE @ls_PFJG CHAR(1), @ls_JP CHAR(1)rn rn SELECT @ls_DeptID = DWBH FROM T_PUB_SYDWDMrn rn --上级调度的申请票:dsqp rn DECLARE cur_dsqp CURSOR FORrn SELECT lsh , czpzt , ldpf , pzgzsj1 , pzgzsj2 , jhyj , bhyj , fsyj , ldyj , qtsx rn FROM [DSMIS].dsdb.dbo.dsqp rn WHERE ( cs = 0 ) And ( ldpf <> '0' ) and ( ssdwbh = @ls_DeptID ) rn SET @ReturnVal = 0rnrn --1.取出远程已批复的票, 并更新本地相应的票rnrn Open cur_dsqprnrn FETCH NEXT FROM cur_dsqp INTO @ls_lsh, @ls_JP, @ls_PFJG, @ldt_PZGZSJ1, @ldt_PZGZSJ2, rn @ls_JHYJ, @ls_BHYJ, @ls_FSYJ, @ls_LDYJ, @ls_QTSXrn WHILE @@FETCH_STATUS = 0 --FETCH 语句成功。rn BEGINrn SET @ReturnVal = @ReturnVal + 1 --已批复的票的数量rn UPDATE T_TICKET_YC_SQP rn SET JHYJ = @ls_JHYJ, FSYJ = @ls_FSYJ, BHYJ = @ls_BHYJ,rn LDYJ = @ls_LDYJ, QTSX = @ls_QTSX, PZGZSJ1 = @ldt_PZGZSJ1,rn PZGZSJ2 = @ldt_PZGZSJ2, PF = 1, PFJG = @ls_PFJG, JP = @ls_JPrn WHERE zdlsh = @ls_lsh rnrn FETCH NEXT FROM cur_dsqp INTO @ls_lsh, @ls_JP, @ls_PFJG, @ldt_PZGZSJ1, @ldt_PZGZSJ2, rn @ls_JHYJ, @ls_BHYJ, @ls_FSYJ, @ls_LDYJ, @ls_QTSXrn END rnrnrn CLOSE cur_dsqprn DEALLOCATE cur_dsqprnrn SET @NUMS = @ReturnValrnrn --2.将远程已取回的票改变状态rn Update [DSMIS].dsdb.dbo.dsqp rn set cs = 1 , tzsj = Getdate(),btzr = @CUR_USER + rtrim(convert(char(50),btzr)) rn where cs = 0 and ldpf <> '0' and ssdwbh = @ls_DeptIDrnrnrnENDrnrn问题: 在执行到rn --2.将远程已取回的票改变状态rn Update [DSMIS].dsdb.dbo.dsqp rn set cs = 1 , tzsj = Getdate(),btzr = @CUR_USER + rtrim(convert(char(50),btzr)) rn where cs = 0 and ldpf <> '0' and ssdwbh = @ls_DeptIDrn时,出现错误,如果将这段话去掉,正常执行。rnrn错误内容:rnrn服务器: 消息 7306,级别 16,状态 2,过程 P_RECO_YCP_EX,行 52rn未能打开表 '"dsdb"."dbo"."dsqp"'(来自 OLE DB 提供程序 'SQLOLEDB')。 提供程序未能支持行查找位置。 提供程序指出与其它属性或要求发生了冲突。rn[OLE/DB provider returned message: 多步 OLE DB 操作产生错误。如果可能,请检查每个 OLE DB 状态值。没有工作被完成。]rn 论坛

Eclipse出现outofmemory error

03-02

在Eclipse上添加了android和J2ME插件,在启动后运行一段时间总是会出现这样的错误,当设置Eclipse是也会出现,不明白这是什么回事以及怎么解决,先谢谢了。rn情况如下:rnEclipse Galileo.logrnrn!SESSION 2010-03-02 21:33:20.015 -----------------------------------------------rneclipse.buildId=unknownrnjava.version=1.6.0_16rnjava.vendor=Sun Microsystems Inc.rnBootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=zh_CNrnCommand-line arguments: -os win32 -ws win32 -arch x86rnrn!ENTRY com.android.ide.eclipse.adt 4 0 2010-03-02 21:45:58.390rn!MESSAGE Unknown exception in parseSdkContent.rn!STACK 0rnjava.lang.OutOfMemoryError: Java heap spacern at java.util.Arrays.copyOfRange(Unknown Source)rn at java.lang.String.(Unknown Source)rn at org.apache.xerces.xni.XMLString.toString(Unknown Source)rn at org.apache.xerces.parsers.AbstractDOMParser.comment(Unknown Source)rn at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanComment(Unknown Source)rn at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)rn at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)rn at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)rn at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)rn at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)rn at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)rn at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)rn at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)rn at com.android.ide.eclipse.adt.internal.resources.AttrsXmlParser.getDocument(Unknown Source)rn at com.android.ide.eclipse.adt.internal.resources.AttrsXmlParser.preload(Unknown Source)rn at com.android.ide.eclipse.adt.internal.sdk.AndroidTargetParser.run(Unknown Source)rn at com.android.ide.eclipse.adt.AdtPlugin$13.run(Unknown Source)rn at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)rnrn!ENTRY com.android.ide.eclipse.adt 4 0 2010-03-02 21:46:07.625rn!MESSAGE parseSdkContent failedrn!STACK 0rnjava.lang.OutOfMemoryError: Java heap spacern at java.util.Arrays.copyOfRange(Unknown Source)rn at java.lang.String.(Unknown Source)rn at org.apache.xerces.xni.XMLString.toString(Unknown Source)rn at org.apache.xerces.parsers.AbstractDOMParser.comment(Unknown Source)rn at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanComment(Unknown Source)rn at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)rn at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)rn at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)rn at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)rn at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)rn at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)rn at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)rn at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)rn at com.android.ide.eclipse.adt.internal.resources.AttrsXmlParser.getDocument(Unknown Source)rn at com.android.ide.eclipse.adt.internal.resources.AttrsXmlParser.preload(Unknown Source)rn at com.android.ide.eclipse.adt.internal.sdk.AndroidTargetParser.run(Unknown Source)rn at com.android.ide.eclipse.adt.AdtPlugin$13.run(Unknown Source)rn at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)rn!SESSION 2010-03-02 21:46:16.640 -----------------------------------------------rneclipse.buildId=unknownrnjava.version=1.6.0_16rnjava.vendor=Sun Microsystems Inc.rnBootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=zh_CNrnCommand-line arguments: -os win32 -ws win32 -arch x86rnrn!ENTRY com.android.ide.eclipse.adt 4 0 2010-03-02 21:49:54.281rn!MESSAGE Unknown exception in parseSdkContent.rn!STACK 0rnjava.lang.OutOfMemoryError: Java heap spacern at java.lang.String.toCharArray(Unknown Source)rn at com.android.layoutlib.utils.ValueResourceParser.trimXmlWhitespaces(ValueResourceParser.java:194)rn at com.android.layoutlib.utils.ValueResourceParser.endElement(ValueResourceParser.java:61)rn at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)rn at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)rn at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)rn at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)rn at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)rn at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)rn at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)rn at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)rn at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)rn at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)rn at javax.xml.parsers.SAXParser.parse(Unknown Source)rn at com.android.ide.eclipse.adt.internal.resources.manager.MultiResourceFile.parseFile(Unknown Source)rn at com.android.ide.eclipse.adt.internal.resources.manager.MultiResourceFile.update(Unknown Source)rn at com.android.ide.eclipse.adt.internal.resources.manager.MultiResourceFile.getResourceTypes(Unknown Source)rn at com.android.ide.eclipse.adt.internal.resources.manager.ResourceFolder.getResourceTypes(Unknown Source)rn at com.android.ide.eclipse.adt.internal.resources.manager.ProjectResources.getAvailableResourceTypes(Unknown Source)rn at com.android.ide.eclipse.adt.internal.resources.manager.ProjectResources.loadAll(Unknown Source)rn at com.android.ide.eclipse.adt.internal.resources.manager.ResourceManager.loadResources(Unknown Source)rn at com.android.ide.eclipse.adt.internal.resources.manager.ResourceManager.loadFrameworkResources(Unknown Source)rn at com.android.ide.eclipse.adt.internal.sdk.AndroidTargetParser.run(Unknown Source)rn at com.android.ide.eclipse.adt.AdtPlugin$13.run(Unknown Source)rn at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)rnrn!ENTRY com.android.ide.eclipse.adt 4 0 2010-03-02 21:50:08.203rn!MESSAGE parseSdkContent failedrn!STACK 0rnjava.lang.OutOfMemoryError: Java heap spacern at java.lang.String.toCharArray(Unknown Source)rn at com.android.layoutlib.utils.ValueResourceParser.trimXmlWhitespaces(ValueResourceParser.java:194)rn at com.android.layoutlib.utils.ValueResourceParser.endElement(ValueResourceParser.java:61)rn at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)rn at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)rn at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)rn at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)rn at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)rn at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)rn at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)rn at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)rn at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)rn at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)rn at javax.xml.parsers.SAXParser.parse(Unknown Source)rn at com.android.ide.eclipse.adt.internal.resources.manager.MultiResourceFile.parseFile(Unknown Source)rn at com.android.ide.eclipse.adt.internal.resources.manager.MultiResourceFile.update(Unknown Source)rn at com.android.ide.eclipse.adt.internal.resources.manager.MultiResourceFile.getResourceTypes(Unknown Source)rn at com.android.ide.eclipse.adt.internal.resources.manager.ResourceFolder.getResourceTypes(Unknown Source)rn at com.android.ide.eclipse.adt.internal.resources.manager.ProjectResources.getAvailableResourceTypes(Unknown Source)rn at com.android.ide.eclipse.adt.internal.resources.manager.ProjectResources.loadAll(Unknown Source)rn at com.android.ide.eclipse.adt.internal.resources.manager.ResourceManager.loadResources(Unknown Source)rn at com.android.ide.eclipse.adt.internal.resources.manager.ResourceManager.loadFrameworkResources(Unknown Source)rn at com.android.ide.eclipse.adt.internal.sdk.AndroidTargetParser.run(Unknown Source)rn at com.android.ide.eclipse.adt.AdtPlugin$13.run(Unknown Source)rn at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)rn 论坛

启动tomcat出现OutOfMemory

01-30

先交待一下,我的运行环境是linux,我在一个tomcat下部署了四个程序,其中一个程序的class比较多,通过在tomcat下进行link的方式连接war包进行部署;rn在启动该tomcat时,我的后台抛出以下异常,但是归档tomcat的logs消息后,重启成功无该异常:rnDec 31, 2011 4:25:35 PM org.apache.catalina.startup.HostConfig checkResourcesrnINFO: Undeploying context [/udb_ws]rnDec 31, 2011 4:25:48 PM org.apache.catalina.startup.HostConfig checkResourcesrnINFO: Undeploying context [/portal]rnDec 31, 2011 4:25:49 PM org.apache.catalina.startup.HostConfig deployWARrnINFO: Deploying web application archive udb_ws.warrnDec 31, 2011 4:25:53 PM org.apache.catalina.loader.WebappClassLoader validateJarFilernINFO: validateJarFile(/opt/udbs/tomcat01/webapps/udb_ws/WEB-INF/lib/servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.classrnDec 31, 2011 4:29:57 PM org.apache.catalina.startup.HostConfig deployWARrnINFO: Deploying web application archive portal.warrnDec 31, 2011 4:29:59 PM org.apache.catalina.loader.WebappClassLoader validateJarFilernINFO: validateJarFile(/opt/udbs/tomcat01/webapps/portal/WEB-INF/lib/servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.classrnDec 31, 2011 4:38:32 PM org.apache.catalina.startup.HostConfig checkResourcesrnINFO: Undeploying context [/udb_ws]rnDec 31, 2011 4:38:33 PM org.apache.catalina.startup.HostConfig deployWARrnINFO: Deploying web application archive udb_ws.warrnDec 31, 2011 4:38:33 PM org.apache.catalina.startup.ContextConfig initrnSEVERE: Exception fixing docBase: 0 rnjava.util.zip.ZipException: invalid LOC header (bad signature)rn at java.util.zip.ZipFile.read(Native Method)rn at java.util.zip.ZipFile.access$1200(ZipFile.java:29)rn at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:447)rn at java.util.zip.ZipFile$1.fill(ZipFile.java:230)rn at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:141)rn at java.io.FilterInputStream.read(FilterInputStream.java:90)rn at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:316)rn at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:158)rn at org.apache.catalina.startup.ContextConfig.fixDocBase(ContextConfig.java:883)rn at org.apache.catalina.startup.ContextConfig.init(ContextConfig.java:1012)rn at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:279)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)rn at org.apache.catalina.core.StandardContext.init(StandardContext.java:5398)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4177)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)rn at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:850)rn at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:724)rn at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:493)rn at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1274)rn at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:296)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)rn at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)rn at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)rn at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)rn at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)rn at java.lang.Thread.run(Thread.java:619)rnDec 31, 2011 4:38:34 PM org.apache.catalina.core.StandardContext startrnSEVERE: Error in dependencyCheckrnjava.util.zip.ZipException: invalid LOC header (bad signature)rn at java.util.zip.ZipFile.read(Native Method)rn at java.util.zip.ZipFile.access$1200(ZipFile.java:29)rn at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:447)rn at java.util.zip.ZipFile$1.fill(ZipFile.java:230)rn at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:141)rn at java.io.FilterInputStream.read(FilterInputStream.java:116)rn at java.io.PushbackInputStream.read(PushbackInputStream.java:169)rn at java.util.zip.ZipInputStream.readFully(ZipInputStream.java:392)rn at java.util.zip.ZipInputStream.readLOC(ZipInputStream.java:225)rn at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:74)rn at java.util.jar.JarInputStream.(JarInputStream.java:58)rn at java.util.jar.JarInputStream.(JarInputStream.java:43)rn at org.apache.catalina.util.ExtensionValidator.getManifest(ExtensionValidator.java:378)rn at org.apache.catalina.util.ExtensionValidator.validateApplication(ExtensionValidator.java:189)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4258)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)rn at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:850)rn at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:724)rn at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:493)rn at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1274)rn at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:296)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)rn at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)rn at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)rn at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)rn at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)rn at java.lang.Thread.run(Thread.java:619)rnDec 31, 2011 4:38:34 PM org.apache.catalina.core.StandardContext startrnSEVERE: Error getConfiguredrnDec 31, 2011 4:38:34 PM org.apache.catalina.core.StandardContext startrnSEVERE: Context [/udb_ws] startup failed due to previous errorsrnDec 31, 2011 4:38:34 PM org.apache.catalina.core.StandardContext stoprnINFO: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/udb_ws] has not been startedrnDec 31, 2011 4:38:44 PM org.apache.catalina.startup.HostConfig checkResourcesrnINFO: Undeploying context [/udb_ws]rnDec 31, 2011 4:38:44 PM org.apache.catalina.startup.HostConfig deployWARrnINFO: Deploying web application archive udb_ws.warrnDec 31, 2011 4:38:46 PM org.apache.catalina.loader.WebappClassLoader validateJarFilernINFO: validateJarFile(/opt/udbs/tomcat01/webapps/udb_ws/WEB-INF/lib/servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.classrnDec 31, 2011 4:39:05 PM org.apache.catalina.startup.HostConfig deployWARrnSEVERE: Error deploying web application archive udb_ws.warrnjava.lang.OutOfMemoryError: PermGen spacernDec 31, 2011 4:40:22 PM org.apache.coyote.http11.Http11Processor processrnSEVERE: Error processing requestrnjava.lang.OutOfMemoryError: PermGen spacernDec 31, 2011 4:40:24 PM org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler processrnSEVERE: Error reading request, ignoredrnjava.lang.OutOfMemoryError: PermGen spacernDec 31, 2011 4:40:37 PM org.apache.coyote.http11.Http11Processor processrnSEVERE: Error processing requestrnjava.lang.OutOfMemoryError: PermGen spacernDec 31, 2011 4:40:39 PM org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler processrnSEVERE: Error reading request, ignoredrnjava.lang.OutOfMemoryError: PermGen spacernDec 31, 2011 4:40:52 PM org.apache.coyote.http11.Http11Processor processrnSEVERE: Error processing requestrnjava.lang.OutOfMemoryError: PermGen spacernDec 31, 2011 4:40:53 PM org.apache.coyote.http11.Http11Processor processrnSEVERE: Error processing requestrnjava.lang.OutOfMemoryError: PermGen spacernrn在网上找了一些资料,暂时只能知道可能是我tomcat的peimsize不够造成,所以我去检查了tomcat的catalina.sh;rn但是我在“echo "Using CATALINA_BASE: $CATALINA_BASE"”上面有以下行: JAVA_OPTS="-server -XX:PermSize=600M -XX:MaxPermSize=1600m"的配置,但是从tomcat的启动消息来看,这个配置似乎没生效,能帮忙解释下这是为什么吗?rnrn另外有不有人知道什么命令,可以去查询到tomcat的内存使用情况?rn或者对我贴出的异常有其他见解的,也可以提出;还望能尽快有答复,谢谢各位了!!! 论坛

谁遇到过OutOfMemory错误

09-20

我编写用http协议上传文件的客户端时,发现小文件可以,但上传大文件时出现OutOfMemory异常错误,下面是代码,theCGI为上传jsp的URL,thePath为文件名,当运行到循环发送数据中途引发OutOfMemory异常错误,谁知道怎么解决?rnrn private boolean PostSingleFile(String theCGI, String thePath) rn try rn // 定义分界符rn final String boundary = "---------------------------7d12ed2e2001cc";rnrn // 合成上传前缀rn String headed = "--" + boundary + "\r\n";rn headed = headed + "Content-Disposition: form-data; name=\"FILE1\"; filename=\"" + thePath + "\"\r\n";rn headed = headed + "Content-Type: application/octet-stream\r\n\r\n";rnrn // 合成上传后缀rn String tailed = "\r\n--" + boundary + "--\r\n";rnrn // 建立URL对象rn URL CGIurl = null;rn try rn CGIurl = new URL(theCGI);rn catch(MalformedURLException e)rn rn return false;rn rnrn try rn // 建立到URL的连接rn URLConnection c = CGIurl.openConnection();rn // 允许输出rn c.setDoOutput(true);rn // 不使用缓存rn c.setUseCaches(false);rn // 设置content-typern c.setRequestProperty("content-type","multipart/form-data; boundary=" + boundary);rnrn // 建立输出流rn DataOutputStream out = new DataOutputStream(c.getOutputStream());rn // 发送上传前缀rn out.writeBytes(headed);rnrn // 打开文件rn FileInputStream fin = null;rn try rn fin = new FileInputStream(thePath);rn catch(FileNotFoundException e) rn return false;rn rnrn // 发送全部文件内容rn int len;rn byte[] data = new byte[2048];rn while ((len=fin.read(data)) != -1) rn out.write(data, 0, len);rn // 清空发送缓冲区rn out.flush();rn rnrn // 关闭文件流rn fin.close();rnrn // 发送上传后缀rn out.writeBytes(tailed);rnrn // 关闭输出流rn out.close();rnrn // 建立输入流rn BufferedReader in = new BufferedReader(new InputStreamReader(c.getInputStream()));rnrn String aLine;rn // 已经上传标志,默认值为falsern boolean uploaded = false;rn // 逐行接收全部输入rn while ((aLine = in.readLine()) != null) rn // 如果上传成功,置已经上传标志为truern if (aLine.indexOf("1 file uploaded.") != -1) uploaded = true;rn rn // 上传失败,返回falsern if (uploaded == false) return false;rn catch(IOException e) rn return false;rn rn return true;rn catch(Exception e) rn return false;rn rn rn 论坛

没有更多推荐了,返回首页