JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-6478

File upload as multipart/form-data fails to be parsed correctly when deployed as WAR

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.6.6
    • Fix Version/s: None
    • Component/s: Rails WAR Deployment
    • Labels:
      None
    • Environment:
    • Number of attachments :
      0

      Description

      When I upload a file via the file_field helper, the params hash in the controller is empty. If I'm creating a new record, the application behaves as if none of the form fields had been populated. If I'm editing an existing record, I get a routing error because the application doesn't see the "_method=put" hidden field.

      Note that this only happens when the application is bundled as a WAR and deployed (in our case, to Apache Tomcat 7.0.25). If I run deploy the application through WEBrick (via "rails server"), it behaves correctly.

        Activity

        Hide
        Ehren J. Brav added a comment -

        We've had exactly the same issue. We're running JRuby 1.6.6 with OpenJDK 1.6.0_18 using tomcat6 on a Debian Squeeze EC2 instance. We're using rails 3.2.0.

        This first manifested itself as a CSRF token not matching error, but further investigation revealed that none of the params hash values are populated at all. The app works fine running on WEBrick and only breaks when we package it to a WAR and deploy to tomcat. Using Firebug, it looks as if the POST request is totally normal. The app works fine on tomcat so long as we're not doing a file upload (uploading text forms is fine). We've reproduced this error both locally and on EC2.

        Show
        Ehren J. Brav added a comment - We've had exactly the same issue. We're running JRuby 1.6.6 with OpenJDK 1.6.0_18 using tomcat6 on a Debian Squeeze EC2 instance. We're using rails 3.2.0. This first manifested itself as a CSRF token not matching error, but further investigation revealed that none of the params hash values are populated at all. The app works fine running on WEBrick and only breaks when we package it to a WAR and deploy to tomcat. Using Firebug, it looks as if the POST request is totally normal. The app works fine on tomcat so long as we're not doing a file upload (uploading text forms is fine). We've reproduced this error both locally and on EC2.
        Hide
        Ehren J. Brav added a comment -

        After many, many hours of struggling with this, I solved the issue by rolling back jruby-rack from 1.1.3 to 1.0.10. I hope this can solve your issue as well until the jruby guys come up with a fix.

        Show
        Ehren J. Brav added a comment - After many, many hours of struggling with this, I solved the issue by rolling back jruby-rack from 1.1.3 to 1.0.10. I hope this can solve your issue as well until the jruby guys come up with a fix.
        Hide
        Uwe Kubosch added a comment -

        jruby-rack has a 1.1.4 release that may solve your problem.

        Show
        Uwe Kubosch added a comment - jruby-rack has a 1.1.4 release that may solve your problem.
        Hide
        Charles Oliver Nutter added a comment -

        We'll call this fixed as of the 1.1.4 jruby-rack release. If it's still broken, please file a new issue on the jruby-rack bug tracker: https://github.com/jruby/jruby-rack/issues

        Show
        Charles Oliver Nutter added a comment - We'll call this fixed as of the 1.1.4 jruby-rack release. If it's still broken, please file a new issue on the jruby-rack bug tracker: https://github.com/jruby/jruby-rack/issues
        Charles Oliver Nutter made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Charles Oliver Nutter [ headius ]
        Resolution Fixed [ 1 ]
        Charles Oliver Nutter made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Craig S. Cottingham
          • Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: