6 Replies Latest reply on Jan 9, 2004 4:24 PM by 843836

    JBuilder 7 Upload  Archive.

    843836
      Hello All, I'm using Jbuilder 7 with Tomcat, and i'm trying to upload an archive with:

      HashMap parametros = null;
      parametros = parser.parseContent(request.getInputStream());

      I manage to upload archives lower 10Mb, bigger than that, i get a servlet exception.

      I first tested my application on our net, later i tested it localhost and i got the same problem.
      I have Windows 2000.
      Could anybody help me. I thank you in advance. C�ssio Homero.
        • 1. Re: JBuilder 7 Upload  Archive.
          843836
          What is the Servlet exception exactly?

          By default, Java Virtual Machines are only allowed to use so much memory. I don't remember what the limit is, but it is somewhere in the 16 MB to 32 MB range. If this was the case, you would get an Out of Memory exception.

          If that is what is happening, then you have two choices. You can either instruct the JVM to use more memory or you can rewrite your code such that it deals with chunks of the archive at a time. The second option is the prefered option, and usually involves creating a buffer.

          Incidently, if you can, you may want to upgrade to JBuilder 9. Borland does offer a JBuilder X (version 10) but I don't think they offer a free version for personal use yet.
          • 2. Re: JBuilder 7 Upload  Archive.
            843836
            David, first thanks for your help.

            The server doesn�t specify the error, it only write a server exception. I'm thinking about one option you told of instructing the JVM to use more memory, how could i do it. Thanks. C�ssio.
            • 3. Re: JBuilder 7 Upload  Archive.
              843836
              At the very begining of either Catalina.bat or Catalina.sh, after the comments, add the line (or otherwise modify it)...
              JAVA_OPT=-mx128m
              ...where 128 is the size in megabytes of memory to reserve. You can of course substitute 64, 245, 512, whatever number you wish provided you have that much memory on your computer.

              Don't forget to leave some room for the operating system and your other programs. Remember, this is also for one instance of the JVM. I believe each concurrent user gets their own copy of the JVM. So you probably don't want to use some rediculously large number like 2048 unless you're the only person uploading the archives.

              • 4. Re: JBuilder 7 Upload  Archive.
                843836
                I partially goofed.

                The -mx option is the maximum amount of memory (I think) and the -ms option is the amount to grab upon start up. So the ideal setting is actually...
                JAVA_OPT=-ms128m -mx128m
                ...so the JVM can sort of "pre-allocate" all of the memory it expects to use, if that makes sense.
                • 5. Re: JBuilder 7 Upload  Archive.
                  843836
                  David, i put the parameter you wrote in both catalina.sh and catalina.bat and it didn't work. I tried either with that maximum value of 2048 and nothing. I'm puting the error of the console, so that if it can tell you something. Thanks again. C�ssio.

                  cadastra arquivo anexo..2.1 tamanho (size of the archive)

                  10408468

                  javax.servlet.ServletException: Servlet execution threw an exception

                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)

                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)

                       at br.com.formatool.infraero.sede.licitacao.seguranca.FilterControleAcesso.doFilter(FilterControleAcesso.java:58)Aqui erro antes StackTrace !



                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)

                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)

                       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)

                       at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

                       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

                       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

                       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)

                       at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

                       at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)

                       at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

                       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

                       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

                       at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)

                       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)

                       at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

                       at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)

                       at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

                       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)

                       at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

                       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

                       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

                       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)

                       at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

                       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

                       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

                       at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)

                       at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)

                       at java.lang.Thread.run(Thread.java:534)

                  Erro! :javax.servlet.ServletException: Servlet execution threw an exception

                  • 6. Re: JBuilder 7 Upload  Archive.
                    843836
                    David, i have good news. I think so. I managed to catch the error, and really is the OutOfMemoryError. The problem is that the parameter to increase memory of the JVM seems not to be working. Do you know how can i test the memory i�m using in the JVM? Thanks Again. C�ssio.