There is no problem to load the log4j.xml or log4j.properties through classload, see 
my code, the problem is the dtd - not sure what the meaning of dummy://log4j.dtd. And 
that particular doConfigure is "protected" so I cannot change. A quick solution is to 
use log4j properties but I still want to know and learn something. 

"Chennamaraja, Srinivas" <[EMAIL PROTECTED]> wrote:The way I have done is..(at least 
in WebSphere). The WebSphere provides
a StartUp class that is guaranteed to be called by the EJB Container
before it loads the application ear file.

so in my start up class, I tried to load the configuration file (by
providing Url) and I package the log4j.jar file as part of my ear file.
it worked quite well for me

thanks
Srini

-----Original Message-----
From: Zhong Lun [mailto:[EMAIL PROTECTED]
Sent: Friday, October 08, 2004 9:28 AM
To: [EMAIL PROTECTED]
Subject: dummy://log4j.dtd (log4j problem in Oracle 10gAS)


Hi, 

Wonder who has log4j.xml experience in EJB environment?

I tried on Oracle 10gAS on Windows (the iAS version actually is still
9.0.4.2), my log4j initilization code looks like:

InputStream inStream =
Thread.currentThread().getContextClassLoader().getResourceAsStream(sLogF
ileName); 
new DOMConfigurator().doConfigure(inStream,
LogManager.getLoggerRepository());

There is no problem to load the log4j.xml however the application server
complains the log4j.dtd:

--------
04/10/08 18:48:18 Start process
--------
04/10/08 18:48:33 Oracle Application Server Containers for J2EE 10g
(9.0.4.0.0) initialized
04/10/08 18:49:09 log4j:ERROR Parsing error on line 0 and column 0
04/10/08 18:49:09 log4j:ERROR File "dummy://log4j.dtd" not found.
04/10/08 18:49:09 log4j:ERROR Could not parse input source
[EMAIL PROTECTED]
04/10/08 18:49:09 org.xml.sax.SAXException: Stopping after fatal error:
File "dummy://log4j.dtd" not found.
04/10/08 18:49:09 at
org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1245)
04/10/08 18:49:09 at
org.apache.xerces.readers.DefaultEntityHandler.startReadingFromDocument(
DefaultEntityHandler.java:501)
04/10/08 18:49:09 at
org.apache.xerces.framework.XMLParser.parseSomeSetup(XMLParser.java:314)
04/10/08 18:49:09 at
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1097)
04/10/08 18:49:09 at
org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.jav
a:195)
04/10/08 18:49:09 at
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:66
5)
04/10/08 18:49:09 at
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:61
6)

I check DOMConfiguration.java, it contains: 

docBuilder.setErrorHandler(new SAXErrorHandler()); 
docBuilder.setEntityResolver(new Log4jEntityResolver()); 
// we change the system ID to a valid URI so that Crimson won't
// complain. Indeed, "log4j.dtd" alone is not a valid URI which
// causes Crimson to barf. The Log4jEntityResolver only cares
// about the "log4j.dtd" ending.
inputSource.setSystemId("dummy://log4j.dtd");
Document doc = docBuilder.parse(inputSource); 
parse(doc.getDocumentElement());

Anybody has an idea and help me, thanks in advance. 

Regards






---------------------------------
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to