Это мой пример кода:
MysqlDataSource dataSource = new MysqlDataSource();
dataSource.setUser("root");
dataSource.setPassword("ncl");
dataSource.setDatabaseName("userdb");
dataSource.setEmulateLocators(true); //This is important because we are dealing with a blob type data field
try{
JdbcDirectory jdbcDir = new JdbcDirectory(dataSource, new MySQLDialect(), "tttable");
StandardAnalyzer analyzer = new StandardAnalyzer();
IndexWriter writer = new IndexWriter(jdbcDir, analyzer,false);
writer.optimize();
writer.close();
}catch(Exception e){
System.out.print(e);
}
Я застрял в этой строке: IndexWriter writer = new IndexWriter(jdbcDir, analyzer,false);
Каждый раз, когда я пытаюсь запустить этот код, я получаю следующее исключение:
------ "org.apache.lucene.store.LockObtainFailedException:
Тайм-аут получения блокировки:
PhantomReadLock [write.lock / tttable] "------------
Я не могу найти, что не так с кодом. Это может быть проблема совместимости с jar.
Я не могу получить объект IndexWriter.