У меня есть база данных /home/panayk/Desktop/panag_3/panag_3.tld:
$ db_verify /home/panayk/Desktop/panag_3/panag_3.tld
Verification of /home/panayk/Desktop/panag_3/panag_3.tld succeeded.
BerkeleyDB отказывается открывать ее.
Вот мой импорт:
import com.sleepycat.bind.EntryBinding;
import com.sleepycat.bind.serial.SerialBinding;
import com.sleepycat.bind.serial.StoredClassCatalog;
import com.sleepycat.collections.StoredMap;
import com.sleepycat.collections.TransactionRunner;
import com.sleepycat.collections.TransactionWorker;
import com.sleepycat.je.Database;
import com.sleepycat.je.DatabaseConfig;
import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Environment;
import com.sleepycat.je.EnvironmentConfig;
А вот и мой код:
final File file = new File(filename);
final String homeDirectoryName = file.getParent();
final File homeDirectory = new File(homeDirectoryName);
LOGGER.info("Opening environment in {}.", homeDirectoryName);
final EnvironmentConfig environmentConfig = new EnvironmentConfig();
environmentConfig.setTransactional(true);
environmentConfig.setAllowCreate(true);
final DatabaseConfig dbConfig = new DatabaseConfig();
dbConfig.setTransactional(true);
dbConfig.setAllowCreate(false);
environment = new Environment(homeDirectory, environmentConfig);
LOGGER.info("Opening database in {}.", filename);
database = environment.openDatabase(null, filename, dbConfig);
catalog = new StoredClassCatalog(database);
final EntryBinding keyBinding = new SerialBinding(catalog, Object.class);
final EntryBinding valueBinding = new SerialBinding(catalog, Object.class);
map = new StoredMap(database, keyBinding, valueBinding, true);
Это журнал:
15:55:54,498 INFO TLDImporter:38 - Opening environment in /home/panayk/Desktop/panag_3.
15:55:54,779 INFO TLDImporter:50 - Opening database in /home/panayk/Desktop/panag_3/panag_3.tld.
А вот и исключение:
com.sleepycat.je.DatabaseNotFoundException: (JE 4.1.10) Database /home/panayk/Desktop/panag_3/panag_3.tld not found.
at com.sleepycat.je.Environment.setupDatabase(Environment.java:790)
at com.sleepycat.je.Environment.openDatabase(Environment.java:536)
at gr.panayk.vinyls.importer.TLDImporter.<init>(TLDImporter.java:51)
at gr.panayk.vinyls.persistence.HibernateEntityRegistry.initialize(HibernateEntityRegistry.java:36)
... 60 more
Что такоенеправильно?Файл явно существует.