• 练习struts2框架所遇到的问题2


    出现的第一个错误是:

    严重: Exception starting filter struts2
    java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:269)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4001)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4651)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
    at org.apache.catalina.core.StandardService.start(StandardService.java:519)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
    2013-7-9 11:49:17 org.apache.catalina.core.StandardContext start
    严重: Error filterStart
    2013-7-9 11:49:17 org.apache.catalina.core.StandardContext start
    严重: Context [/Prodemo1] startup failed due to previous errors

    解决方法:可以看看发布后的lib目录中,是否有struts-core包,如果有,把包打开,看里面有没有这个类,如果没有删除tomcat里的wapps文件夹里的同名项目,在myeclipse里重新配置tomcat。重新启动就可以了。

    第二个错误:

    还是书上的同一个例子,因为在web.xml里配置的是

    <filter-class>org.apache.Struts2.dispatcher.FilterDispatcher</filter-class>

    web.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <display-name>Struts2的配置</display-name>
    <filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.Struts2.dispatcher.FilterDispatcher</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>Struts2</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
    <welcome-file-list>
    <welcome-file>login.jsp</welcome-file>
    </welcome-file-list>
    </web-app>

    struts2.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
    "http://struts.apache.org/dtds/struts-2.1.dtd">
    <struts>
    <include file="struts-default.xml" />
    <package name="struts2_login" extends="struts-default" namespace="/login">
    <action name="checkLogin" class="com.chen.action.LoginAction" method="checkLogin">
    <result name="success">/index.jsp</result>
    <result name="login">/login.jsp</result>
    </action>
    </package>

    <!-- 一些常量的配置
    <constant name="struts.i18n.encoding" value="UTF-8"></constant>
    <constant name="struts.devmode" value="false"></constant>-->
    </struts>

    login.jsp:

    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%@ taglib prefix="s" uri="/struts-tags" %>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>


    <title>My JSP 'login.jsp' starting page</title>

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->

    </head>

    <body>
    This is my JSP page. <br>

    <h2>欢迎进入登录页面!</h2> <br/>
    <s:textfield name="username" label="登录名称" />
    <s:password name="password" label="登录密码" />
    <s:submit value="登录" />
    </body>
    </html>

    LoginAction.java:

    package com.chen.action;

    import com.opensymphony.xwork2.ActionSupport;

    public class LoginAction extends ActionSupport{

    private String username;
    private String password;
    public String getUsername() {
    return username;
    }
    public void setUsername(String username) {
    this.username = username;
    }
    public String getPassword() {
    return password;
    }
    public void setPassword(String password) {
    this.password = password;
    }

    public String checkLogin(){
    if(this.username.equals("admin") && this.password.equals("abc")){
    return SUCCESS;
    }else{
    return LOGIN;
    }
    }
    }

    所出现的错误是:

    2013-7-10 9:05:08 org.apache.catalina.core.AprLifecycleListener init
    信息: Loaded APR based Apache Tomcat Native library 1.1.20.
    2013-7-10 9:05:08 org.apache.catalina.core.AprLifecycleListener init
    信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
    2013-7-10 9:05:09 org.apache.coyote.http11.Http11AprProtocol init
    信息: Initializing Coyote HTTP/1.1 on http-8080
    2013-7-10 9:05:09 org.apache.coyote.ajp.AjpAprProtocol init
    信息: Initializing Coyote AJP/1.3 on ajp-8009
    2013-7-10 9:05:09 org.apache.catalina.startup.Catalina load
    信息: Initialization processed in 1110 ms
    2013-7-10 9:05:09 org.apache.catalina.core.StandardService start
    信息: Starting service Catalina
    2013-7-10 9:05:09 org.apache.catalina.core.StandardEngine start
    信息: Starting Servlet Engine: Apache Tomcat/6.0.29
    2013-7-10 9:05:09 org.apache.catalina.startup.HostConfig deployDescriptor
    信息: Deploying configuration descriptor host-manager.xml
    2013-7-10 9:05:09 org.apache.catalina.startup.HostConfig deployDescriptor
    信息: Deploying configuration descriptor manager.xml
    2013-7-10 9:05:10 org.apache.catalina.startup.HostConfig deployDirectory
    信息: Deploying web application directory bcims
    2013-7-10 9:05:12 org.apache.catalina.core.ApplicationContext log
    信息: Set web app root system property: 'webapp.root.bcims' = [D: oolsapache-tomcat-6.0.29webappscims]
    2013-7-10 9:05:12 org.apache.catalina.core.ApplicationContext log
    信息: Set web app root system property: 'webapp.root.bcims' = [D: oolsapache-tomcat-6.0.29webappscims]
    2013-7-10 9:05:12 org.apache.catalina.core.ApplicationContext log
    信息: Initializing log4j from [classpath:log4j.properties]
    2013-7-10 9:05:12 org.apache.catalina.core.ApplicationContext log
    信息: Initializing Spring root WebApplicationContext
    2013-07-10 09:05:12,261 [main] INFO org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization started
    2013-07-10 09:05:12,534 [main] INFO org.springframework.web.context.support.XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Wed Jul 10 09:05:12 CST 2013]; root of context hierarchy
    2013-07-10 09:05:12,796 [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from file [D: oolsapache-tomcat-6.0.29webappscimsWEB-INFclassesapplicationContext.xml]
    2013-07-10 09:05:13,042 [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [context-jdbc.xml]
    2013-07-10 09:05:13,212 [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [context-ehcache.xml]
    2013-07-10 09:05:13,278 [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from file [D: oolsapache-tomcat-6.0.29webappscimsWEB-INFclassesconfigspringmanagers.xml]
    2013-07-10 09:05:13,293 [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from file [D: oolsapache-tomcat-6.0.29webappscimsWEB-INFclassesconfigspring epository.xml]
    2013-07-10 09:05:13,311 [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from file [D: oolsapache-tomcat-6.0.29webappscimsWEB-INFclassesconfigspringdaos.xml]
    2013-07-10 09:05:13,335 [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from file [D: oolsapache-tomcat-6.0.29webappscimsWEB-INFclassesconfigspringactions.xml]
    2013-07-10 09:05:15,037 [main] INFO org.springframework.beans.factory.config.PropertyPlaceholderConfigurer - Loading properties file from URL [file:/D:/tools/apache-tomcat-6.0.29/webapps/bcims/WEB-INF/classes/jdbc.properties]
    2013-07-10 09:05:15,183 [main] INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1787395: defining beans [propertyConfigurer,sqlMapClient,transactionManager,dataSource,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,org.springframework.cache.annotation.AnnotationCacheDefinitionSource#0,org.springframework.cache.interceptor.CacheInterceptor#0,org.springframework.cache.config.internalCacheAdvisor,cacheManagerFactory,cacheManager,sessionContextUtil,messageUtil,pageIteratorSolver,jsonTree,treeView,bmuserDirector,accountDirector,bmgroupDirector,bmmenuDirector,bmprourlcustomDirector,bmroleDirector,accountDao,bmUserDao,bmGroupDao,bmAttachDao,bmMenuDao,bProtectUrlAttachDao,bmProurlcustomDao,bmRoleDao,bRoleAttachDao,bAccountRoleDao,treeStructDao,entryRegistrationDao,receivedSmsInfoDao,phoneNoInfoDao,simCardInfoDao,hlrMatchDao,packagesTypeDao,shopAddDao,setMealBusinessDao,bmInformDao,rechargeDao,loginAccountUpdatePwdAction,ajaxSessionUpdateAction,accountAction,bmuserAction,bmgroupAction,bmgrouptreelistAction,bmgrouptreeviewAction,bmgrouptreeviewrecurAction,bmattachAction,bmmenuAction,bmmenutreelistAction,bmmenutreeAction,roleMenuAction,bprotecturlattachAction,bmprourlcustomAction,bmroleAction,broleattachAction,baccountroleAction,receivedsmsinfoAction,packagesTypeAction,shopAddAction,SetMealBusinessAction,bminformAction,rechargeAction]; root of factory hierarchy
    2013-07-10 09:05:15,297 [main] INFO com.mchange.v2.log.MLog - MLog clients using log4j logging.
    2013-07-10 09:05:15,426 [main] INFO com.mchange.v2.c3p0.C3P0Registry - Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]
    2013-07-10 09:05:16,866 [main] INFO org.springframework.cache.ehcache.EhCacheManagerFactoryBean - Initializing EHCache CacheManager
    2013-07-10 09:05:16,988 [main] INFO org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 4721 ms
    2013-07-10 09:05:17,387 [main] INFO com.opensymphony.xwork2.config.providers.XmlConfigurationProvider - Parsing configuration file [struts-default.xml]
    2013-07-10 09:05:17,714 [main] INFO com.opensymphony.xwork2.config.providers.XmlConfigurationProvider - Parsing configuration file [struts-plugin.xml]
    2013-07-10 09:05:17,783 [main] INFO com.opensymphony.xwork2.config.providers.XmlConfigurationProvider - Parsing configuration file [struts.xml]
    2013-07-10 09:05:17,799 [main] INFO org.apache.struts2.config.BeanSelectionProvider - Loading global messages from config/i18n/globalMessages
    2013-07-10 09:05:18,028 [main] INFO org.apache.struts2.spring.StrutsSpringObjectFactory - Initializing Struts-Spring integration...
    2013-07-10 09:05:18,028 [main] INFO com.opensymphony.xwork2.spring.SpringObjectFactory - Setting autowire strategy to name
    2013-07-10 09:05:18,028 [main] INFO org.apache.struts2.spring.StrutsSpringObjectFactory - ... initialized Struts-Spring integration successfully
    2013-7-10 9:05:18 org.apache.catalina.startup.HostConfig deployDirectory
    信息: Deploying web application directory docs
    2013-7-10 9:05:19 org.apache.catalina.startup.HostConfig deployDirectory
    信息: Deploying web application directory examples
    2013-7-10 9:05:19 org.apache.catalina.core.ApplicationContext log
    信息: ContextListener: contextInitialized()
    2013-7-10 9:05:19 org.apache.catalina.core.ApplicationContext log
    信息: SessionListener: contextInitialized()
    2013-7-10 9:05:19 org.apache.catalina.startup.HostConfig deployDirectory
    信息: Deploying web application directory Prodemo2
    2013-7-10 9:05:19 org.apache.tomcat.util.digester.Digester endElement
    严重:End event threw exception

    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tomcat.util.IntrospectionUtils.callMethod1(IntrospectionUtils.java:928)
    at org.apache.tomcat.util.digester.SetNextRule.end(SetNextRule.java:193)
    at org.apache.tomcat.util.digester.Rule.end(Rule.java:229)
    at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1138)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1774)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2930)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
    at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1642)
    at org.apache.catalina.startup.ContextConfig.applicationWebConfig(ContextConfig.java:365)
    at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1076)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4540)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
    at org.apache.catalina.core.StandardService.start(StandardService.java:519)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
    Caused by: java.lang.IllegalArgumentException: Filter mapping specifies an unknown filter name Struts2
    at org.apache.catalina.core.StandardContext.addFilterMap(StandardContext.java:2438)
    ... 46 more
    2013-7-10 9:05:19 org.apache.catalina.startup.ContextConfig applicationWebConfig
    严重: Parse error in application web.xml file at jndi:/localhost/Prodemo2/WEB-INF/web.xml
    java.lang.IllegalArgumentException: Filter mapping specifies an unknown filter name Struts2
    at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2806)
    at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2832)
    at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1141)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1774)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2930)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
    at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1642)
    at org.apache.catalina.startup.ContextConfig.applicationWebConfig(ContextConfig.java:365)
    at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1076)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4540)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
    at org.apache.catalina.core.StandardService.start(StandardService.java:519)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
    2013-7-10 9:05:19 org.apache.catalina.startup.ContextConfig applicationWebConfig
    严重: Occurred at line 16 column 19
    2013-7-10 9:05:19 org.apache.catalina.startup.ContextConfig start
    严重: Marking this application unavailable due to previous error(s)
    2013-7-10 9:05:20 org.apache.catalina.core.StandardContext start
    严重: Error getConfigured
    2013-7-10 9:05:20 org.apache.catalina.core.StandardContext start
    严重: Context [/Prodemo2] startup failed due to previous errors

    解决方法:把web.xml里的<filter-name>Struts2</filter-name>Struts2改成struts2就好了

    第三个错误:

    严重: Exception starting filter struts2
    java.lang.ClassNotFoundException: org.apache.Struts2.dispatcher.FilterDispatcher
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:269)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4001)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4651)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
    at org.apache.catalina.core.StandardService.start(StandardService.java:519)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
    2013-7-10 14:46:38 org.apache.catalina.core.StandardContext start
    严重: Error filterStart
    2013-7-10 14:46:38 org.apache.catalina.core.StandardContext start
    严重: Context [/Prodemo2] startup failed due to previous errors

    解决方法:把web.xml中的

    <filter-class>org.apache.Struts2.dispatcher.FilterDispatcher</filter-class>改成

    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>

    因为在程序中找不到FilterDispatcher类,

    注:struts2.0用的filter用的是:org.apache.struts2.dispatcher.FilterDispatcher,

    而struts2.1以后版本采用的是:org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter

    第四个错误:

    2013-7-10 15:04:26 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
    警告: No configuration found for the specified action: 'checkLogin' in namespace: '/login'. Form action defaulting to 'action' attribute's literal value.
    2013-7-10 15:04:27 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
    警告: No configuration found for the specified action: 'checkLogin' in namespace: '/login'. Form action defaulting to 'action' attribute's literal value.
    2013-7-10 15:04:27 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
    警告: No configuration found for the specified action: 'checkLogin' in namespace: '/login'. Form action defaulting to 'action' attribute's literal value.
    2013-7-10 15:04:27 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
    警告: No configuration found for the specified action: 'checkLogin' in namespace: '/login'. Form action defaulting to 'action' attribute's literal value.
    2013-7-10 15:04:31 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
    警告: No configuration found for the specified action: 'checkLogin' in namespace: '/login'. Form action defaulting to 'action' attribute's literal value.
    2013-7-10 15:04:31 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
    警告: No configuration found for the specified action: 'checkLogin' in namespace: '/login'. Form action defaulting to 'action' attribute's literal value.
    2013-7-10 15:04:38 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
    警告: Could not find action or result
    There is no Action mapped for namespace / and action name checkLogin. - [unknown location]
    at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177)
    at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
    at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
    at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)
    at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458)
    at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:76)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)
    at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
    at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)
    at java.lang.Thread.run(Thread.java:619)

    解决方法:

  • 相关阅读:
    手机APP测试环境搭建---appium
    Python实现H5页面
    Git的基础学习
    python UI自动化测试
    python selenium常用基本方法---H5和键盘鼠标操作
    python基础方法
    ResultSetMetaData和DatabaseMetaData实现数据库中属性,属性值,属性所赋值的获取等
    DAO模型设计实现数据的 增,删,改,查方法
    利用反射及jdbc元数据实现通用的查询方法
    PreparedStatement接口及其方法的使用
  • 原文地址:https://www.cnblogs.com/licc09/p/3180618.html
Copyright © 2020-2023  润新知