log4j:ERROR Could not parse file
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Siva_Swamy
Posted On:   Wednesday, February 8, 2012 05:36 PM

Hi, I am trying to use log4j in my application and i am getting following error. Thanks a lot for the help in advance. log4j:ERROR Could not parse file [nullWEB-INF/logging/log4j.xml]. java.io.FileNotFoundException: /app/ENP/user_projects/domains/Domain2/nullWEB-INF/logging/log4j.xml (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream. (FileInputStream.java:106) at java.io.FileInputStream. (FileInputStream.java:66) at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70) at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161) at java.net.URL.openStream(URL.java:10   More>>

Hi,
I am trying to use log4j in my application and i am getting following error. Thanks a lot for the help in advance.


log4j:ERROR Could not parse file [nullWEB-INF/logging/log4j.xml].
java.io.FileNotFoundException: /app/ENP/user_projects/domains/Domain2/nullWEB-INF/logging/log4j.xml (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream. (FileInputStream.java:106)
at java.io.FileInputStream. (FileInputStream.java:66)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
at java.net.URL.openStream(URL.java:1010)
at oracle.xml.parser.v2.XMLReader.openURL(XMLReader.java:2650)
at oracle.xml.parser.v2.XMLReader.pushXMLReader(XMLReader.java:253)
at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:222)
at oracle.xml.jaxp.JXDocumentBuilder.parse(JXDocumentBuilder.java:155)
at weblogic.xml.jaxp.RegistryDocumentBuilder.parse(RegistryDocumentBuilder.java:163)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:208)
at org.apache.log4j.xml.DOMConfigurator$1.parse(DOMConfigurator.java:749)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:866)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:755)
at org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:891)
at gov.cms.esrd.qip.utilities.Log4jInit.init(Log4jInit.java:16)
at javax.servlet.GenericServlet.init(GenericServlet.java:241)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
at weblogic.servlet.internal.StubLifecycleHelper. (StubLifecycleHelper.java:48)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:539)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1985)
at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1959)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1878)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3153)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1508)



Here is my web.xml code



log4j-init

gov.cms.esrd.qip.utilities.Log4jInit


log4j-init-file

WEB-INF/logging/log4j.xml


1





configuration file (Log4jInit)code


package gov.cms.esrd.qip.utilities;



import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.xml.DOMConfigurator;



public class Log4jInit extends HttpServlet {


public void init() {

String prefix = getServletContext().getRealPath("/");

String file = getInitParameter("log4j-init-file");

// if the log4j-init-file is not set, then no point in trying

if (file != null) {

DOMConfigurator.configure(prefix + file);
}

}


public void doGet(HttpServletRequest req,
HttpServletResponse res) {

}

}



Log4j.xml file


<?xml version="1.0" encoding="UTF-8" ?>








































Thanks.    <<Less
About | Sitemap | Contact