一个经常出现却又困扰n天的问题

     404,web开发中最常见,也是最能想到原因的错误,但是这次在做一个注册模块的时候却出了一个万万没想到的错误报了如下异常信息

There is no Action mapped for namespace [/] and action name [regist] associated with context path [/swty]. - [unknown location]
    com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
    org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
    org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
    com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
    org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:501)
    org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
    org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
    org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    java.lang.Thread.run(Unknown Source)

        先说常规解决思路,在/命名空间内找不到action,

           首先检查web.xml写的是否正确,而我的配置如下,各种拦截器都有


  swty
  
    index.html
  
  
  
    struts2
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
  
  
    struts2
    /*
  

        org.springframework.web.context.ContextLoaderListener
    
  
    contextConfigLocation
    classpath:applicationContext.xml
  
        其次,检查strus.xml是否正确,这也是经常出错的地方,一个单词写错,甚至大小写有错都不行,我的配置如下也是没有错的



	
	
	
	
	 
    
        
        
        	/index.jsp
        
        
    
    
   
 
  
 
  

然后就是看jsp页面formaction属性值是不是跟strus.xml一样了,我的也完全一样
如果经过这个过程还是不能解决,那就不是常规错误了,而此次我的就属于非常规错误了
经过两天调试在启动tomcat的时候我发现了这样一条信息


 
  

 
  

三月 28, 2014 11:16:30 上午 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Setting autowire strategy to name
三月 28, 2014 11:16:30 上午 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: ... initialized Struts-Spring integration successfully
三月 28, 2014 11:16:31 上午 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
SEVERE: Unable to find parent packages json-default
缺少jar包?明显我已经加到lib里边了,但是基本可以肯定绝对是没有这个包,在buildpath里一看,还真是,没有加载,其它包都没问题,唯独它没加载,手动加载一下果然通过了进入result下的index.jsp
This is my JSP page. 
 
  
 
  

 
  

 
  
 
  
 
 

你可能感兴趣的:(web,java)