2012-02-23 95 views
1

我試圖在JBOSS AS 7.1上使用JRuby 1.6.6部署Rails 3.2應用程序。我認爲這幾乎肯定是一個JBoss問題。在JBOSS AS 7.1上部署多部分表單參數時

該應用程序在Tomcat和WebBrick下完美工作,但不是JBoss。在JBoss上部署時,在請求到達控制器之前,使用多部分表單發佈的參數將被剝離。我懷疑有一些JBOSS配置需要允許上傳大型HTTP數據包,但是無法確定JBOSS AS 7.1中要設置的位置或內容。

我不認爲問題出現在Rails控制器代碼中,但查看問題的最簡單方法是查看此代碼塊中的註釋。

def create 
    f = params[:uploaded_file] 
    # ** Under JBOSS, there is no :uploaded_file in the params hash! 
    # ** Without JBOSS, :uploaded_file is passed in, all is good 
    data = f.read 
    # ... 
end 

的ERB模板看起來是這樣的:

<%= form_tag xxx_path, :multipart => true do %> 
<%= file_field_tag :uploaded_file, :required => true %> 
<% end %> 

一個原因,我懷疑它涉及到一些大小限制是,如果我嘗試上傳非常非常小的文件,它的工作原理。在這種情況下,文件被成功傳遞給控制器​​的參數散列。

任何幫助將不勝感激。

+0

我有與JBoss 5.1部署恰好相同的問題。 – arkadiy 2012-02-23 12:45:07

回答

0

我不知道這是否是解決方案,還是隻是一個巧合,但我通過設置JAVAOPTS事後這個問題增加了堆的大小和PermGen的內存離開了。

的起作用的開關分別爲:

JAVA_OPTS = -Xms512m -Xmx1024m -XX:PermSize =128米-XX:MaxPermSize參數=256米

1

下面是我如何解決JBoss 5.1的這個問題。

  • components.xml文件添加到您的rails項目的根目錄中。下面是這個文件的內容:
 
    <?xml version="1.0" encoding="UTF-8"?> 
    <components xmlns="http://jboss.com/products/seam/components" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xmlns:security="http://jboss.com/products/seam/security" 
       xsi:schemaLocation= "http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd 
        http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd"> 

     <component class="org.jboss.seam.web.MultipartFilter"> 
     <property name="createTempFiles">true</property> 
     <property name="max-request-size">0</property> 
     </component> 
    </components> 
  • 添加"components.xml"到您的warble.rb配置的config.webinf_files部分。

例如:

config.webinf_files += FileList["jboss-web.xml", "components.xml"]