2
我在Struts2的代碼中使用註釋時,正在此問題相關。沒有映射爲命名空間操作[/]和動作名稱[ABC]與上下文路徑[APP_NAME]
我帶註釋的Action類,似乎這樣的事情這是使用攔截器,和我的架構是基於Spring 3,Struts 2中,並使用Struts2的Convention插件
@InterceptorRefs({
@InterceptorRef("mylogging")
})
public class LoginAction implements ModelDriven{
User user = new User();
List<User> users = new ArrayList<User>();
UserBo userBo;
@Action(value="/login",results={@Result(name="success",type="chain",location="/jsp/successPage.jsp"),
@Result(name="login",type="chain",location="/jsp/userLogin.jsp")})
public String execute() {
if(user.getUserScreenName()==null)
return "login";
System.out.println(userBo.verifyUser(user));
return "success";
}
我也試圖包圍的細節我的部署描述符
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
<init-param> <param-name>config</param-name> <param-value>struts-default.xml,struts-plugin.xml,struts.xml
</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/resources/config/SpringBeans.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
我已經定義我的攔截在struts.xml
,我只是用定義攔截器和結果類型
<struts>
<constant name="struts.devMode" value="false" />
<constant name="struts.objectFactory" value="spring" />
<constant name="struts.convention.package.locators.basePackage" value="com.abc.lab"/>
<constant name="struts.convention.action.checkImplementsAction" value="false"/>
<constant name="struts.convention.package.locators" value="action,actions,struts,struts2"/> <package name="default" extends="struts-default" namespace="/">
<interceptors>
<interceptor name="mylogging"
class="com.abc.lab.interceptor.LoggingInterceptor">
</interceptor>
<interceptor-stack name="loggingStack">
<interceptor-ref name="mylogging" />
<interceptor-ref name="defaultStack" />
</interceptor-stack>
</interceptors> </package> </struts>
我也試圖與devMode
真的還是假的,但它是沒有幫助的。
我的目錄結構是
+--LmsWar/
| +--pom.xml
| +--src/
| | +--com/
| | | +--abc/
| | | | +--lab/
| | | | | +--actions/
| | | | | | +--HomeAction.java
| | | | | | +--LoginAction.java
| | | | | +--bo/
| | | | | | +--impl/
| | | | | | | +--UserBoImpl.java
| | | | | | +--UserBo.java
| | | | | +--dao/
| | | | | | +--impl/
| | | | | | | +--UserDAOImpl.java
| | | | | | +--UserDAO.java
| | | | | +--filter/
| | | | | +--interceptor/
| | | | | | +--LoggingInterceptor.java
| | | | | +--listener/
| | | | | +--model/
| | +--resources/
| | | +--com/
| | | | +--abc/
| | | | | +--lab/
| | | | | | +--spring/
| | | | | | | +--UserBean.xml
| | | +--config/
| | | | +--database/
| | | | | +--properties/
| | | | | | +--database.properties
| | | | +--spring/
| | | | | +--DataSource.xml
| | | | | +--HibernateSessionFactory.xml
| | | | +--SpringBeans.xml
| | +--struts.properties
| | +--struts.xml
| +--WebRoot/
| | +--jsp/
| | | +--common/
| | | +--layout/
| | +--WEB-INF/
| | | +--classes/
| | | +--lib/
| | | +--tiles.xml
| | | +--web.xml
編輯:
進入更多的細節,並添加詳細的測井公司我在日誌中有一件事後。
2013-07-23 16:40:01,578 ERROR com.opensymphony.xwork2.util.finder.ClassFinder.error:38 - Unable to read class [com.abc.lab.actions.LoginAction] java.lang.NoSuchMethodError: org.objectweb.asm.ClassReader.accept(Lorg/objectweb/asm/ClassVisitor;I)V
而且它是唯一一個我在這裏提到的,而它給在我的應用程序可用的每個動作類相同的異常例外。