1、出现错误之后,使用各种方法解决,但还是报同样的错误。然后下次打开或者是之后莫名其妙的编译通过了。(错误描述:The server encountered an unexpected condition that prevented it from fulfilling the request.)
错误原因:运行多次之后,myeclipse缓存了你之前的运行结果,虽然你已经对之前的错误进行了修改,但是运行结果还是之前的。
解决方法:关闭所有正在运行的项目,关闭Tomcat服务器。点击project->clean->选择Clean all projects或者选中你正在写的项目后,选中Clean projects selected below->ok。
具体步骤如下所示:
2、错误提示:cvc-complex-type.2.3: Element ‘beans’ cannot have character [children], because the type’s content type is element-only.即:cvc-complex-type.2.3: 元素 ‘beans’ 必须不含字符 [子级], 因为该类型的内容类型为“仅元素”。
错误原因:spring初始化的时候无法识别xml文件中的元素,即xml文件 编写不符合规范。
解决方法:
- 检查xml文件是否符合规范,即是否使用了不合法的注释符(//),xml文件中的注释符为(< !-- -->)。另外检查是否缺少结束标记等等。
- 如果是从网上复制过来的代码,记得删除多余空格,因为中文空格可能导致spring识别错误。或者将代码复制到Notepad++等编辑工具,转为UTF-8编码格式。实在不行,建议将复制的代码手动抄写一遍。
3、错误提示:web.xml is missing and < failOnMissingWebXml> is set to true
错误原因:原因是在项目中缺少web.xml,且被设置成了true
解决方法:
- .如果项目需要web.xml,去复制一个web.xml到项目中即可。也可以使用Eclipse生成,右击项目–>Java EE Tools–>Generate Deployment Descriptor Stub.然后系统会在src/main/webapp/WEB_INF文件加下创建web.xml文件。错误解决!
- 如果项目不需要web.xml文件,则需要在pom.xml中将配置成false,有如下两种配置方式。
a、使用插件方式配置
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</