The following exception appears now and then, does anyone else meet it? I'm
using Castor to 0.9.7 and Tomcat 5.
Jun 22, 2005 12:42:44 AM persistence.DatabaseFactory getDatabase
INFO: loading /config/mapping/db-cfg.xml
Jun 22, 2005 12:42:44 AM persistence.DatabaseFactory getDatabase
SEVERE: Can't get a connection for test with null:
java.lang.NullPointerException
java.lang.NullPointerException
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:657)
at
org.exolab.castor.jdo.engine.JDOConfLoader.loadConfiguration(JDOConfLoader.java:94)
at
org.exolab.castor.jdo.engine.JDOConfLoader.getTransactionDemarcation(JDOConfLoader.java:145)
at
org.exolab.castor.jdo.transactionmanager.TransactionManagerFactoryRegistry.load(TransactionManagerFactoryRegistry.java:160)
at org.exolab.castor.jdo.JDOManager.getDatabase(JDOManager.java:690)
at persistence.DatabaseFactory.getDatabase(DatabaseFactory.java:104)
....
To reproduce it, open two broswers, and during tomcat start/restart process,
press Refresh button on both windows. If luck enough, this exception wouth come
out.
Here is the DatabaseFactory.getDatabase():
public static final Database getDatabase(String dbname, String path) throws
Exception {
if (DatabaseRegistry.getDatabaseRegistry(dbname) == null) {
synchronized (lock) {
// double check to avoid load the configure twice
if (DatabaseRegistry.getDatabaseRegistry(dbname) == null) {
JDOManager.loadConfiguration(path);
log.info("loading " + path);
}
}
}
JDOManager jdo = JDOManager.createInstance(dbname);
try {
return jdo.getDatabase(); // this is line 104
} catch (Exception e) {
log.error("Can't get a connection for " + dbname + " with " +
jdo.getConfiguration() + ": " + e);
e.printStackTrace();
throw e;
}
}
Please help on this, thanks!
Sean