web.xml引入 xml (tomcat 7.0.52) 以上版本报错

原文地址:https://blog.csdn.net/sdmxdzb/article/details/47728017?locationNum=11

今天在搞工作流,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;

}

由于时间问题,还未了解原因。待续.......
————————————————
版权声明:本文为CSDN博主「无怨_无悔」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/sdmxdzb/article/details/47728017

原文地址:https://www.cnblogs.com/dyh004/p/12051225.html