• servlet上传文件报错(三)


    1、具体报错如下

    null
    null
    Exception in thread "http-apr-8686-exec-5" java.lang.OutOfMemoryError: Java heap space
    	at java.lang.StringCoding$StringDecoder.decode(StringCoding.java:133)
    	at java.lang.StringCoding.decode(StringCoding.java:173)
    	at java.lang.String.<init>(String.java:444)
    	at java.lang.String.<init>(String.java:516)
    	at org.apache.commons.fileupload.disk.DiskFileItem.getString(DiskFileItem.java:345)
    	at com.you.file.servlet.FileUploadServlet.doPost(FileUploadServlet.java:64)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
    	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    
    	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    	at java.lang.Thread.run(Thread.java:619)
    

    2、错误原因

          上传文件超过设置文件大小,导致内存溢出


    3、解决办法

         修改设置文件大小

    /**
      * 设置上传文件大小
      */
    factory.setSizeThreshold(1024*1024);


  • 相关阅读:
    Git Cannot rebase: You have unstaged changes.
    importError: DLL load failed when import matplotlib.pyplot as plt
    install tushare in python 3.6
    pd.qcut, pd.cut, df.groupby()等在分组和聚合方面的应用
    从池子里的beta看秋香, 个性迥异
    个股和股票池的beta系数的估算
    检验两个随机序列的beta系数
    spyder里的"查找文件里的特定字符串"非常方便
    地图上道路编号中的G S X Y
    场内的代码表, 感觉水很深
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13315173.html
Copyright © 2020-2023  润新知