• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

weired pursing error :log4j

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
I am at a loss when I read the following message in my system.out log.
log4j:WARN Parsing error on line 1 and column -1
log4j:WARN Valid documents must have a <!DOCTYPE declaration.
log4j:ERROR Parsing error on line 1 and column -1
log4j:ERROR Document root element is missing.
log4j:ERROR Could not parse input source [org.xml.sax.InputSource@6d45d02d].
org.xml.sax.SAXParseException: Document root element is missing.
at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3035)
at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3023)
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:500)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:304)
at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:433)
at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:179)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:665)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:616)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:584)

in WEB-INF/lib I have:
crimson.jar jaxp.jar jconfig.jar log4j-1.2.8.jar xerces.jar
in WEB-INF/classes I have:
log4j.dtd
The container is WEBSPHERE 4.06 AE.
I copied the needed xml, dtd & the jar files from an application where log4j is working fine.
Is log4j suppoesed to use the crimson purser or the SAX ?
Any suggestion is appreciated.
Thanks.
_ml
Here is the simple config file :
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>

<appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
<param name="File" value="/opt/WebSphere/AppServer/installedApps/GTS_WebSphere_Development_Cell/GnoTelecom.ear/GNOTelecomWEB.war/logs/stdOut.log"/>
<param name="Threshold" value="warn"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ddMMMyy HH:mm:ss} %-5p %c %x - %m%n"/>
</layout>
</appender>



<appender name="WEBAPP_ACTIVITY_LOGFILE" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="/opt/WebSphere/AppServer/installedApps/GTS_WebSphere_Development_Cell/GnoTelecom.ear/GNOTelecomWEB.war/logs/activity.log"/>
<param name="Threshold" value="ALL"/>
<param name="maxFileSize" value="1000KB"/>
<param name="maxBackupIndex" value="3"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ddMMMyy HH:mm:ss} %-5p %c %x - %m%n"/>
</layout>
</appender>

<appender name="WEBAPP_ERROR_LOGFILE" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="/opt/WebSphere/AppServer/installedApps/GTS_WebSphere_Development_Cell/GnoTelecom.ear/GNOTelecomWEB.war/logs/errorWarning.log"/>
<param name="Threshold" value="ALL"/>
<param name="maxFileSize" value="1000KB"/>
<param name="maxBackupIndex" value="3"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ddMMMyy HH:mm:ss} %-5p %c %x - %m%n"/>
</layout>
</appender>


<logger name="WEBAPP">
<appender-ref ref="WEBAPP_ACTIVITY_LOGFILE"/>
</logger>

<logger name="WEBAPP.ERROR">
<appender-ref ref="WEBAPP_ERROR_LOGFILE"/>
</logger>



<root>
<appender-ref ref="STDOUT"/>
</root>


</log4j:configuration>
[ March 29, 2004: Message edited by: EM. Lashkar ]
 
EM. Lashkar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Took away crimson.jar from the classpath so that it uses xerces.jar, restarted the server & it works fine now.
Summery:
If one sees this message
"Valid documents must have a <!DOCTYPE declaration.", 2 possibilities :
1. malformed XML file
2. XML file not found ( silly, one should expect a FileNotFound exception)
For the malformed XML make sure:
1. Encoding is correct (if none mentioned , then guesses UTF-8)
2. There is no non Unicode character in the XML doc
Details here:
http://forum.java.sun.com/thread.jsp?forum=34&thread=499493&start=15&range=15&hilite=false&q=
 
Get me the mayor's office! I need to tell her about this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!