1 2 Previous Next 15 Replies Latest reply on Oct 14, 2003 4:40 AM by Ulf Tidstrand

    File Upload error

    netlive Newbie

      Hi

      First thanks for great work

      I'm playing on some code for upload and Thumb Jpeg's.
      If the Jpeg (or any File ) is > 800K the upload and view dosn't work.

      Is 800K the max Uplodable size ??

      In jboss-service.xml
      <!-- Maxium file upload allowed size 8388608 bytes or 8 Megs -->
      8388608


      Snapshot from 23-Sept.

      I try to upload jpeg and if the size > 800K i get :
      2003-09-24 12:04:21,687 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCHsqldbCreateCommand.FileEJB] Executing SQL: INSERT INTO NUKE_FILE (pn_fid, pn_uid, pn_content, pn_content_type, pn_timest, pn_public) VALUES (?, ?, ?, ?, ?, ?)
      2003-09-24 12:04:27,781 ERROR [STDERR] java.lang.OutOfMemoryError

      or
      14:54:18,828 ERROR [STDERR] java.lang.OutOfMemoryError
      14:54:18,828 ERROR [FileEJB] Could not create entity
      java.sql.SQLException: out of memory
      at org.hsqldb.Trace.getError(Unknown Source)
      at org.hsqldb.Result.(Unknown Source)
      at org.hsqldb.jdbcConnection.executeHSQL(Unknown Source)
      at org.hsqldb.jdbcConnection.execute(Unknown Source)
      at org.hsqldb.jdbcStatement.fetchResult(Unknown Source)
      at org.hsqldb.jdbcStatement.executeUpdate(Unknown Source)

      if i try to view a jpeg( < 800 K) i get a :
      2003-09-24 12:02:37,062 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.FileEJB] Executing SQL: SELECT pn_content FROM NUKE_FILE WHERE (pn_id=?)
      2003-09-24 12:02:38,890 ERROR [org.jboss.web.localhost.Engine] StandardWrapperValve[ResourceServlet]: Servlet.service() for servlet ResourceServlet threw exception
      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 org.jboss.nukes.servlet.CompressFilter.doFilter(CompressFilter.java:113)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.jboss.nukes.servlet.DatabasePollerFilter.doFilter(DatabasePollerFilter.java:88)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      ...........

        • 1. Re: File Upload error
          Viet Master

          try tyo increase the heap size of your VM when you launch jboss use the command :

          java -Xms 128M -Xmx 128M etc....

          it can be done in the run.bat but I dunno remember how exactly

          julien

          • 2. Re: File Upload error
            Fred Choi Newbie

            You can also do that by modifying the $JBOSS_HOME/bin/run.conf file. There is a #JAVA_OPTS="-server -Xms128m -Xmx512m" entry that you can uncomment or adjust to allocate more memory.

            • 3. Re: File Upload error
              netlive Newbie

              Thanks
              JAVA_OPTS="-server -Xms128m -Xmx512m" solve the upload problem.

              View is still broken or very slow.

              Maybe this helps:
              View works excellent on snapshot from 12.Sept (testet with 2Mb).
              I noticed that you have done some changes in the code ( new Class .... Resource is now abstract ....).

              2003-09-25 14:22:02,515 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.FileEJB] Executing SQL: SELECT pn_content FROM NUKE_FILE WHERE (pn_id=?)
              2003-09-25 14:22:08,890 ERROR [org.jboss.web.localhost.Engine] StandardWrapperValve[ResourceServlet]: Servlet.service() for servlet ResourceServlet threw exception
              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 org.jboss.nukes.servlet.CompressFilter.doFilter(CompressFilter.java:113)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
              ...........
              ......
              2003-09-25 14:22:08,906 ERROR [org.jboss.web.localhost.Engine] ----- Root Cause -----
              java.lang.OutOfMemoryError

              • 4. Re: File Upload error
                Viet Master

                yes I had to change because the code was not handling properly some case : for instance you have streamed resource, when you undeploy the module, the resource continue to be streamed whereas it should be stopped. The changes make that possible.

                If you find that going to database is slow, you should update JBoss configuration and set option commit A. So JBoss will cache EJBs but it requires that you don't modify the database by hand.

                To do that, you have to edit the file server/default/conf/standardjboss.xml, then find the CMP 2.x EJB Container configuration and modify the commit option tag from "b" to "a".

                julien

                • 5. Re: File Upload error
                  netlive Newbie

                  changing from B to A does not solve the view problem.
                  i don't think is due slow database access.

                  on Snapshot 12.Sept it take's 5 sec. for 1Mb
                  on Snapshot 23.Sept < 300K works
                  with <400k i wait 30 sec
                  and with >400k i wait 1min. and get the error.
                  testet on on Windows and Linux jdk 1.4.2
                  with the -Xms 512M -Xmx 1024M its nearly the same just 100- 200 K more.

                  i think you are very busy and this problem is not so important for Nukes now.
                  i will try to find the problem out myself but i'm new to java and it will take a while.

                  Thank's for all your help

                  • 6. Re: File Upload error
                    Viet Master

                    yes I am busy ;-)

                    the best way to figure out where the time is spend is to use a tool such as Borland OptimizeIt, you can have an evaluation license for 30 days.

                    They have a section about how to launch JBoss. It will help you to figure out where the time is spent. The tool is great and easy to use.

                    julien

                    • 7. Re: File Upload error
                      Ulf Tidstrand Newbie

                      I also have problem with streamed resources. It worked in a previous CVS snapshot of Nukes that is about one or two months old.

                      Here's my problem:
                      I override the getResource method, create a byte array (byte[]) in it and return the content as a ByteArrayResource. Previously, this worked very well but now I only get trashed output. After X bytes it seems that the output is distorted in some way. With very large byte arrays I only get a 500 error (java.lang.OutOfMemoryError) with the following stack trace:

                      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 org.jboss.nukes.servlet.CompressFilter.doFilter(CompressFilter.java:113)
                      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
                      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
                      at org.jboss.nukes.servlet.DatabasePollerFilter.doFilter(DatabasePollerFilter.java:88)
                      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:256)
                      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
                      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
                      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
                      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
                      at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:228)
                      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
                      at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
                      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
                      at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
                      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
                      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
                      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
                      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
                      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
                      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
                      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
                      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
                      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
                      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
                      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
                      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
                      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
                      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
                      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
                      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
                      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
                      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
                      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
                      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
                      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
                      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:601)
                      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
                      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
                      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
                      at java.lang.Thread.run(Thread.java:536)



                      Any ideas of what's going wrong?

                      /Ulf

                      • 8. Re: File Upload error
                        Viet Master

                        do you have a testcase to submit ? it will help us to find out what's wrong.

                        julien

                        • 9. Re: File Upload error
                          Ulf Tidstrand Newbie

                          Thanks, I'll try to set up a clean test case during the weekend and then submit it here.

                          /Ulf

                          • 10. Re: File Upload error
                            Viet Master

                            ok, could you submit it on sourceforge then please ? (and tell in this forum it has been done, because I am not pinging sf.net all the time)

                            thanks

                            julien

                            • 11. Re: File Upload error
                              Ulf Tidstrand Newbie

                              I'll do that... :)

                              /Ulf

                              • 12. Re: File Upload error
                                netlive Newbie

                                i played with OptimizeIt with the result that I am a noob :)

                                i beliefe the time is spend in swapping.

                                maybe the problem is the same as described in "DB access very slow ". the images size grow up in the browser.
                                i downlod an image ( right klick - save image ) .
                                size in DB and orginal is 149.54 KB
                                downloded size is 43.75 MB
                                IrfanView tells the used ram size (downloaded and orginal) is 3.14 MB
                                hope this helps and isn't spamm.

                                • 13. Re: File Upload error
                                  Viet Master

                                  you reliveve me now :-)

                                  if you setup a VM eating too much memory it will start swaping on the disc and this is very bad. It will create time outs in transaction and put the mess.

                                  julien

                                  • 14. Re: File Upload error
                                    netlive Newbie

                                    yes
                                    snapshot from 12.Oct. solve the problems :-)
                                    thank's

                                    1 2 Previous Next