简体   繁体   English

log4j.xml引用的文件log4j.dtd包含错误

[英]log4j.xml referenced file log4j.dtd contains errors

We have a project contains ejbModule, there is a log4j.xml file located in ejbModule META-INF folder as below 我们有一个包含ejbModule的项目,在ejbModule META-INF文件夹中有一个log4j.xml文件,如下所示

在此处输入图片说明

On this log4j.xml file, initial start with a referenced dtd file from Apache server, format as below 在此log4j.xml文件中,首先从Apache服务器中引用的dtd文件开始,格式如下

在此处输入图片说明

Usually, this reference section works fine, but since yesterday it suddenly could not compile with and not able to deploy the ejbModule ear file onto weblogic middleware. 通常,此参考部分可以正常工作,但是从昨天开始,它突然无法编译,也无法将ejbModule ear文件部署到weblogic中间件上。

Showing error as below 显示错误如下

Description Resource Path Location Type
Referenced file contains errors (http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd).  For more information, right click on the message in the Problems View and select "Show Details..." log4j.xml   /TEST_EJB/ejbModule line 1  XML Problem

在此处输入图片说明

And then I visit the referenced file location from given url as http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd will observe issue as 然后我从给定的URL访问引用的文件位置,如http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd将观察到问题,因为

XML Parsing Error: syntax error
Location: http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd
Line Number 27, Column 1:<!ELEMENT log4j:configuration (renderer*, appender*,plugin*, (category|logger)*,root?,
^

在此处输入图片说明

Updates: 更新:

Even changed format to following not able to fix the issue 甚至将格式更改为以下格式也无法解决问题

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN"
"http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd"
[
    <!-- Directory to write the log files to -->
    <!ENTITY logDir "C:/.../logs">
]
>

在此处输入图片说明

I have checked the links as Eclipse: Referencing log4j.dtd in log4j.xml , actually we are using the same way to refer log4j.dtd file in his question(which declared as successful part, before failed maven part) 我已经检查了作为Eclipse的链接:在log4j.xml中引用log4j.dtd ,实际上我们在他的问题中使用了相同的方式来引用log4j.dtd文件(声明为成功的部分,在失败的maven部分之前)

I have two questions: 我有两个问题:

(1) Is this problem happen on Apache side (not because of coding or local settings) ? (1)这个问题是否发生在Apache端(不是因为编码或本地设置)?

(2) Is there any way to fix the problem ? (2)有什么办法可以解决问题? Fix locally ? 本地修复?

Thanks for given any idea. 感谢您的任何想法。

use following code :- 使用以下代码:-

<!DOCTYPE log4j:configuration PUBLIC
 "-//APACHE//DTD LOG4J 1.2//EN" "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">

Fine, looks like this issue caused by broken of log4j.dtd file on Apache service, I download source file of log4j.dtd from this link , and put it to the same folder of META-INF as below: 很好,看起来像是由Apache服务上的log4j.dtd文件损坏引起的此问题,我从此链接下载log4j.dtd源文件,并将其放在如下的META-INF相同的文件夹中: 在此处输入图片说明

Refer to it in log4j.xml as relative path log4j.xml中将其称为相对路径

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM 
"log4j.dtd"
[
    <!-- Directory to write the log files to -->
    <!ENTITY logDir "C:/.../logs">
]
>

Then clean and compile the ejbModule , the issue is gone and able to deploy to weblogic middleware. 然后清理并编译ejbModule ,问题消失了,并且可以部署到weblogic中间件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM