Crusher-ScT-
Guest
Hi,
ich habe eine Datei die heisst:
db.properties
Inhalt:
Das hab ich in den CLASSPATH eingetragen: (dort liegt halt das File)
D:\Programmierung\db.properties;
und der Code im Servlet sieht so aus:
Fehlermeldung:
Can't read the properties file. Make sure db.properties is in the CLASSPATH
java.lang.NullPointerException
Frage:
Was stimmt nicht ?
Vielleicht kennt sich ja jemand aus und kann mir helfen.
Besten Dank schonmal.
Gruss Crusher
ich habe eine Datei die heisst:
db.properties
Inhalt:
Code:
# Comma-separated list of relational data sources
sources=mysql
mysql.url=jdbc:mysql://localhost:3306/englisch_lernen
mysql.driver=com.mysql.jdbc.Driver
mysql.user=root
mysql.password=test
Das hab ich in den CLASSPATH eingetragen: (dort liegt halt das File)
D:\Programmierung\db.properties;
und der Code im Servlet sieht so aus:
Code:
private void init() {
InputStream is = getClass().getResourceAsStream("/db.properties");
Properties dbProps = new Properties();
try {
dbProps.load(is);
}
catch (Exception e) {
System.err.println("Can't read the properties file. " +
"Make sure db.properties is in the CLASSPATH");
System.err.println(e);
return;
}
Fehlermeldung:
Can't read the properties file. Make sure db.properties is in the CLASSPATH
java.lang.NullPointerException
Frage:
Was stimmt nicht ?
Vielleicht kennt sich ja jemand aus und kann mir helfen.
Besten Dank schonmal.
Gruss Crusher