ActionResources_zh_CN.properties Not Found.

控制檯報警告:
2009-06-30 16:08:02,765 WARN  org.apache.struts.util.PropertyMessageResources -   Resource org/apache/struts/action/ActionResources_zh_CN.properties Not Found.
 2009-06-30 16:08:02,765 WARN  org.apache.struts.util.PropertyMessageResources -   Resource org/apache/struts/action/ActionResources_zh.properties Not Found.

這個資源包是struts框架內部的消息資源包,用來想日誌文件輸出信息,警報和錯誤信息的,下載的struts包中本來就不包含_zh_CN的資源文件。 
protected void initInternal() 
        throws ServletException { 
        try { 
            internal = MessageResources.getMessageResources(internalName); 
        } catch (MissingResourceException e) { 
            log.error("Cannot load internal resources from '" + internalName 
                + "'", e); 
            throw new UnavailableException( 
                "Cannot load internal resources from '" + internalName + "'"); 
        } 
    } 
這個是actionServlet中的init方法初始化時調用的第一個方法,就是獲取那個資源文件。默認的值就是internalName= org/apache/struts/action/ActionResources。

 

是Struts1.X程序運行ActionServlet調用initInternal()方法時, 
得到你的機器是中文系統,試圖尋找中文的ActionResources_zh_CN.properties文件或者ActionResources_zh.properties文件,由於Struts 1.X 開發包本身沒有這兩個文件,所以提示出來“警告”,不是錯誤。 這個警告並不影響程序的運行。 
可以根據英文版的ActionResources.properties做一箇中文版的ActionResources_zh_CN.properties,放在相應的路徑下。注意轉碼。

控制檯運行 
native2ascii -encoding gb2312 ActionResources.properties ActionResources_zh_CN.properties 

或者建個bat文件,把這句話寫進去,運行
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章