本文共 1906 字,大约阅读时间需要 6 分钟。
今天在搞工作流,tomcat7.0.57 总是报错,解析不了web.xml引用的joa.xml .
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app [<!ENTITY joa SYSTEM "joa.xml">]> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">后经查找资料发现:
tomcat 7.0.52开始的版本才会出这个问题,
是因为安全的考虑tomcat 7.0.52开始的版本把xmlBlockExterna属性默认为false,要解决这个问题,
两种方法:
1、把tomcat版本换成7.0.52之前的版本。
2、把xmlBlockExterna设成false。
下面是原版解释: As per discussion with Tomcat developers, xmlBlockExternal="false" attribute of Tomcat's Context (context.xml) was set true by default starting from 7.0.52. With xmlBlockExternal="false"generated/djn-settings.conf can be included。<Context xmlBlockExternal="false" >
<!-- Default set of monitored resources --> <WatchedResource>WEB-INF/web.xml</WatchedResource> <!-- Uncomment this to disable session persistence across Tomcat restarts --> <!-- <Manager pathname="" /> --> <!-- Uncomment this to enable Comet connection tacking (provides events on session expiration as well as webapp lifecycle) --> <!-- <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" /> --> </Context>解决完这个问题后,又出现了一个新问题:
之后查找资料解决方法:在项目下创建org.apache:
package org.apache;
import java.lang.reflect.InvocationTargetException; import javax.naming.NamingException; /** * @author 董志博 * @date 2015-8-17 * @description * @Version 1.0 */ public interface AnnotationProcessor { public void postConstruct(Object instance) throws IllegalAccessException, InvocationTargetException; public void preDestroy(Object instance) throws IllegalAccessException, InvocationTargetException; public void processAnnotations(Object instance) throws IllegalAccessException, InvocationTargetException, NamingException; }由于时间问题,还未了解原因。待续.......
转载地址:http://ddjdi.baihongyu.com/