Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Java heap space problems

  1. #1
    Junior Member
    Join Date
    Dec 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb Java heap space problems

    hi all

    Actually i want to upload more than 500 mb file using struts file upload features.
    I have successfully upload the file less than 200 mb.

    I have increase the java heap size and tomcat heap size in catalina.bat file and in myeclipse also.
    i have also set java_opts and catalina_opts in environment variable.
    i have also set in controller class in struts-config.xml file as
    <controller maxFileSize="1G" nocache="true" bufferSize="1073741824"/>

    i changed the server.xml file and web.xml file as you suggested.


    In conf\server.xml

    <Connector port="80" protocol="HTTP/1.1"
    connectionTimeout="20000"
    redirectPort="8443"
    maxPostSize="67589953" />
    In webapps\manager\WEB-INF\web.xml

    <multipart-config>
    <!-- 52MB max -->
    <max-file-size>52428800</max-file-size>
    <max-request-size>52428800</max-request-size>
    <file-size-threshold>0</file-size-threshold>
    </multipart-config>


    but still i get this problem while uploading more than 250 mb files.

    java.lang.OutOfMemoryError
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(FileInputStream.java: 177)
    at org.apache.commons.fileupload.disk.DiskFileItem.ge t(DiskFileItem.java:308)
    at org.apache.struts.upload.CommonsMultipartRequestHa ndler$CommonsFormFile.getFileData(CommonsMultipart RequestHandler.java:600)
    at actions.FileUploadAction.execute(FileUploadAction. java:44)
    at org.apache.struts.action.RequestProcessor.processA ctionPerform(RequestProcessor.java:484)
    at org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:274)
    at org.apache.struts.action.ActionServlet.process(Act ionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doPost(Acti onServlet.java:525)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:849)
    at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.process(Http11Protocol.java:583)


    pls suggest me what i have to do to solve this problem.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Java heap space problems

    Sounds less a server config problem and more of a code problem...are you keeping the entire contents of the file in memory as you 'upload'? Post the relevant code

Similar Threads

  1. Java heap space
    By srkmca07@gmail.com in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 3rd, 2013, 03:54 AM
  2. Java Heap Space
    By aussiemcgr in forum Java Theory & Questions
    Replies: 4
    Last Post: September 8th, 2010, 05:05 PM
  3. Replies: 15
    Last Post: February 28th, 2010, 10:30 PM
  4. Java heap space error
    By Loki in forum What's Wrong With My Code?
    Replies: 3
    Last Post: January 27th, 2010, 10:47 PM
  5. Out of memory - Java heap space
    By fraxx in forum Java Theory & Questions
    Replies: 4
    Last Post: November 24th, 2009, 05:26 AM

Tags for this Thread