0

We have a project contains ejbModule, there is a log4j.xml file located in ejbModule META-INF folder as below

enter image description here

On this log4j.xml file, initial start with a referenced dtd file from Apache server, format as below

enter image description here

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.

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

enter image description here

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

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?,
^

enter image description here

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">
]
>

enter image description here

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)

I have two questions:

(1) Is this problem happen on Apache side (not because of coding or local settings) ?

(2) Is there any way to fix the problem ? Fix locally ?

Thanks for given any idea.

Lampard
  • 394
  • 7
  • 23

2 Answers2

0

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">
Anshul Sharma
  • 3,432
  • 1
  • 12
  • 17
  • thanks, but even changed to code given here, not able to fix, already update the question to notify this. – Lampard Jun 19 '17 at 16:48
0

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: enter image description here

Refer to it in log4j.xml as relative path

<?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.

Lampard
  • 394
  • 7
  • 23