下面是为 XMLManager 创建实例的代码,
EnvironmentConfig config = new EnvironmentConfig();
config.setErrorStream(System.err);
config.setAllowCreate(true);
config.setRunRecovery(true);
config.setTransactional(true);
config.setInitializeLocking(true);
config.setInitializeLogging(true);
config.setInitializeCache(true);
config.setLogAutoRemove(true);
config.setCacheSize(25 * 1024 * 1024); // 25MB cache
dbEnv = new Environment(<db-env-home>, config);
XmlManagerConfig xmlMgrCfg = new XmlManagerConfig();
xmlMgrCfg.setAdoptEnvironment(true);
XmlManager _xmlMgr = new XmlManager(dbEnv , xmlMgrCfg);
运行此代码时,出现以下异常,
com.sleepycat.db.DatabaseException: Permission denied: __db.001: Permission denied: Permission denied at com.sleepycat.db.internal.db_javaJNI.DbEnv_open(Native Method) at com.sleepycat.db.internal.DbEnv.open(DbEnv .java:317) 在 com.sleepycat.db.EnvironmentConfig.openEnvironment(EnvironmentConfig.java:3886) 在 com.sleepycat.db.Environment.(Environment.java:93)