SEVERE: Exception starting filter struts2 java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatcher

后端 未结 13 585
一生所求
一生所求 2020-12-16 00:56

I am trying to make a small login application in struts 2. My web.xml:



        
13条回答
  •  离开以前
    2020-12-16 01:10

    Being new to the Struts2 framework, I recently came across the same (or very similar) error. In my case I was using annotations within the Action class rather than the struts.xml file.

    For example

    @Action(value="/jsp/edit-file",
       results={@Result(name="success",location="/jsp/edit-success.jsp"),
                @Result(name="failure",location="/jsp/edit-failure.jsp")})
    public String execute() { ... }
    

    However when I changed the action value to include the *.action extension (see below) Struts would throw the "SEVERE: Exception starting filter struts2" error noted above.

    @Action(value="/jsp/edit-file.action",
       results={@Result(name="success",location="/jsp/edit-success.jsp"),
                @Result(name="failure",location="/jsp/edit-failure.jsp")})
    public String execute() { ... }
    

    The cause of this error wasn't obvious as it didn't manifest itself immediately. Looking through the Tomcat localhost..log file I found the stacktrace for the error and was able to remedy the issue.

提交回复
热议问题