Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
private static void initLogger() {
DOMConfigurator.configure("./conf/logger.xml");
}

I'm having the logger.xml file in conf folder also I configured the logger.xml file but while running the jar in terminal i'm getting FileNotFoundException. Anyone plz help me. . .

log4j:ERROR Could not parse file [./conf/logger.xml].
java.io.FileNotFoundException: /home/rega/NetBeansProjects/Packet/dist/./conf/logger.xml (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:146)
at java.io.FileInputStream.<init>(FileInputStream.java:101)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:619)
at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:189)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:812)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:347)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:205)
at org.apache.log4j.xml.DOMConfigurator$1.parse(DOMConfigurator.java:749)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:871)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:755)
at org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:896)
at packet.Main.initLogger(Main.java:33)
at packet.Main.main(Main.java:356)
Posted
Comments
Fredrik Bornander 23-Jan-15 5:40am    
In what directory are you running this? The path is relative to the directory you run it in, not the directory where the .jar is located.
Angel Roy 23-Jan-15 7:55am    
/home/rega/NetBeansProjects/Packet/dist/
Fredrik Bornander 23-Jan-15 8:02am    
And you've verified that there is indeed a file here;
/home/rega/NetBeansProjects/Packet/dist/./conf/logger.xml ?
Angel Roy 26-Jan-15 23:29pm    
The file is in /home/rega/NetBeansProjects/Packet/conf/logger.xml
But the jar is in 'dist' folder
Richard MacCutchan 23-Jan-15 7:12am    
The first two lines of output tell you exactly what is wrong.

1 solution

Either run the command from the Packet folder
/home/rega/NetBeansProjects/Packet$ java -jar dist/your_jar_file.jar

Or, make sure that the conf folder is copied, recursively, into the dist folder, so that there is a file called logger.xml in
/home/rega/NetBeansProjects/Packet/dist/conf/logger.xml


Hope this helps,
Fredrik
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900