2014-01-30 38 views
-2

GOT javax.servlet.ServletExceptionjava.lang.ClassCastException:com.dna.nsm.sim.action.LogoutActionjavax.servlet.ServletException在支桿應用

在支柱1級的應用程序。

錯誤消息:

javax.servlet.ServletException: java.lang.ClassCastException: com.dna.nsm.sim.action.LogoutAction 
    org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286) 
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) 
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:690) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803) 
    org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125) 


root cause 

java.lang.ClassCastException: com.dna.nsm.sim.action.LogoutAction 
    org.apache.struts.chain.commands.servlet.CreateAction.createAction(CreateAction.java:98) 
    org.apache.struts.chain.commands.servlet.CreateAction.getAction(CreateAction.java:68) 
    org.apache.struts.chain.commands.AbstractCreateAction.execute(AbstractCreateAction.java:91) 
    org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51) 
    org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191) 
    org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305) 
    org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191) 
    org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283) 
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) 
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:690) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803) 
    org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125) 

LogoutAction代碼:

public class LogoutAction extends Action{ 
    public ActionForward execute(ActionMapping mapping, ActionForm form, 
      HttpServletRequest request, HttpServletResponse response) { 
     // To redirect to the Login page 
     return mapping.findForward("success"); 
    } 
} 

struts-config.xml中部分

<action path="/logout" type="com.dna.nsm.sim.action.LogoutAction" > 
      <forward name="success" path="/tiles/login/body.jsp" /> 
</action> 

建議請。

回答

0

檢查您的導入並確保您正在擴展正確的操作類。