Error reading XML properties file on Linux
807605Sep 27 2007 — edited Sep 28 2007Hi guys
I'm getting a bit desperate here, i'm developing an application to run on tomcat, that uses Properties files in XML to save some configuration.
Here's my file:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<entry key="company.name">My Company</entry>
<entry key="application.name">My Application</entry>
<entry key="application.version">1.0</entry>
<entry key="application.classes.file">classes.cfg.xml</entry>
<entry key="datatable.rowsPerPage">15</entry>
</properties>
Now the wierd part... On my developing machine (Windows) everything works fine, and i deploy it on a server (Fedora + tomcat 6) the application can't read the file correctly, it reads the keys but not the values.
Here's the code:
public void loadFromFile(String filename)
throws IOException {
Properties properties = new Properties();
InputStream stream = new FileInputStream(((ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext()).getRealPath(filename));
try {
properties.loadFromXML(stream);
} catch (IOException ex) {
throw ex;
}
this.props = properties;
this.filename = filename;
stream.close();
}
Thanks in advance..