2011-11-18 65 views
2

HelloWorld是我的ActionSupport类,pop方法将值加载到Country类型的countryList对象。Stuts2中带有显示标记的java.lang.SecurityException

package example;  
import com.opensymphony.xwork2.ActionSupport; 
import java.util.ArrayList; 

public class HelloWorld extends ActionSupport { 

    ArrayList<Country> countryList = new ArrayList<Country>(); 

    public ArrayList<Country> getCountryList() { 
     return countryList; 
    } 

    public void setCountryList(ArrayList<Country> countryList) { 
     this.countryList = countryList; 
    } 

    public String pop() { 
     // countryList = this.countrySecurityProcessor.findByAll(0, null, null, null, null, false, false, null, null, null, null, 0); 

     countryList.add(new Country("IND", "INDIA")); 
     countryList.add(new Country("PAK", "PAKISTAN")); 

     System.out.println("countryList" + countryList); 

     return SUCCESS; 
    } 

    @Override 
    public String execute() throws Exception { 

     return SUCCESS; 
    } 
} 

的struts.xml

<struts> 
    <package name="example" namespace="/example" extends="struts-default"> 
     <action name="HelloWorld" method="pop" class="example.HelloWorld"> 
      <result name="success">/example/HelloWorld.jsp</result> 
     </action> 
    </package> 
</struts> 

jsp页面是:

<%@taglib uri="http://displaytag.sf.net" prefix="display" %> 
<%@ taglib prefix="s" uri="/struts-tags" %> 
<html> 
    <head> 
     <title></title> 
    </head> 

    <body> 
     HAI 

     <display:table name="${countryList}" class="Country" uid="row" pagesize="20" sort="list" requestURI="/example/HelloWorld" > 
      <%-- <display:table list="countryList" requestURI="" pagesize="3"> 
      --%> 
      <display:column property="id" title="ID" /> 
      <display:column property="name" /> 
     </display:table> 
    </body> 
</html> 

当我运行该应用程序,它显示了以下错误:

说明 服务器遇到一个内部错误(),它阻止了 它履行此请求。

例外 javax.servlet.ServletException:java.lang.SecurityException异常:类“org.apache.commons.collections.FastHashMap”的签名者信息不 不在同一个包

匹配其他类的签名者信息

根源 java.lang.SecurityException异常:类“org.apache.commons.collections.FastHashMap”的签名者信息不 不在同一帕茨卡匹配其他类的签名者信息

请解决这个问题。

+1

你可以试试简单的struts2迭代器标签来检查这是否是由显示标签引起的? –

回答

2

根据几个论坛,这里可能会出现jar冲突。请验证所有包含的jar文件,以查看其中是否存在重复类org.apache.commons.collections.FastHashMap。删除重复的jar和那应该解决这个问题。