0 0

lucene IndexReader.open(dir) 报错5

请问大师,下面的错误是怎么导致的?
java.security.AccessControlException: Access denied (java.lang.reflect.ReflectPermission suppressAccessChecks)
at java.security.AccessController.checkPermission(AccessController.java:108)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:544)
at java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:118)
at org.apache.lucene.store.MMapDirectory$1.run(MMapDirectory.java:166)
at java.security.AccessController.doPrivileged(AccessController.java:251)
at org.apache.lucene.store.MMapDirectory.cleanMapping(MMapDirectory.java:162)
at org.apache.lucene.store.MMapDirectory$MMapIndexInput.close(MMapDirectory.java:440)
at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:647)
at org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:72)
at org.apache.lucene.index.IndexReader.open(IndexReader.java:256)
at JavaAgent.getResult(Unknown Source)
at JavaAgent.NotesMain(Unknown Source)
at lotus.domino.AgentBase.runNotes(Unknown Source)
at lotus.domino.NotesThread.run(Unknown Source)
java.lang.NullPointerException
at JavaAgent.NotesMain(Unknown Source)
at lotus.domino.AgentBase.runNotes(Unknown Source)
at lotus.domino.NotesThread.run(Unknown Source)

报错修改代码为:
FSDirectory dir = SimpleFSDirectory.open(folder);

IndexReader reader = IndexReader.open(dir);

其中folder确定是存在的,路径无误。
目前还没有答案

相关推荐

    lucene练习代码

    IndexReader reader = DirectoryReader.open(directory); IndexSearcher searcher = new IndexSearcher(reader); QueryParser parser = new QueryParser("content", new StandardAnalyzer()); Query query = ...

    lucene学习笔记

    IndexReader reader = DirectoryReader.Open(dir); IndexSearcher searcher = new IndexSearcher(reader); QueryParser parser = new QueryParser(Lucene.Net.Util.Version.LUCENE_29, "content", new ...

    C#调用Lucene方法-实现快速搜索

    var directory = FSDirectory.Open(new DirectoryInfo("index_dir")); var indexWriterConfig = new IndexWriterConfig(LuceneVersion.LUCENE_48, analyzer); using (var indexWriter = new IndexWriter...

    lucene使用教程

    dir.close(); ``` #### 四、Lucene依赖包配置 为了在项目中使用Lucene,需要在项目的构建文件(如Maven的`pom.xml`文件)中添加以下依赖项: ```xml <lucene-version>5.3.1</lucene-version> <groupId>...

    Lucene.Net实现全文搜索

    IndexReader reader = DirectoryReader.Open(FSDirectory.Open(new DirectoryInfo("path/to/index"))); IndexSearcher searcher = new IndexSearcher(reader); Query q = new QueryParser(Version.LUCENE_29, ...

    lucene最新版本3.3的基本功能用法(IK分词是3.2.8)

    Directory directory = FSDirectory.open(new File("index_dir")); IndexWriterConfig config = new IndexWriterConfig(LuceneVersion.LUCENE_33, new IKAnalyzer()); IndexWriter indexWriter = new IndexWriter...

    lucene专题教程代码

    Directory directory = FSDirectory.open(Paths.get("index_dir")); IndexWriterConfig config = new IndexWriterConfig(analyzer); IndexWriter writer = new IndexWriter(directory, config); Document doc = new...

    Lucene入门示例

    Directory dir = FSDirectory.open(Paths.get("path_to_index_dir")); IndexWriterConfig config = new IndexWriterConfig(analyzer); IndexWriter indexWriter = new IndexWriter(dir, config); ``` 5. **添加文档...

    Lucene 3.5&API,最新版

    Directory dir = FSDirectory.open(new File("index_dir")); IndexWriter writer = new IndexWriter(dir, config); Document doc = new Document(); doc.add(new TextField("title", "示例文档标题", Store.YES)); ...

    搜索引擎中的分词以及查找的编程心得

    IndexReader reader = IndexReader.open(dir); IndexSearcher searcher = new IndexSearcher(reader); TopDocs docs = searcher.search(new TermQuery(new Term("desc", "car")), 10); System.out.println(docs....

    TF-IDF.rar_TFIDF 排序_java tfidf_tf-idf_tfidf_tfidf排序

    Directory directory = FSDirectory.open(Paths.get("index_dir")); IndexWriter indexWriter = new IndexWriter(directory, config); // 添加文档到索引 Document doc = new Document(); doc.add(new TextField(...

    lucene1.4.3 API

    - **IndexReader**:`open(IndexDirectory dir)`打开索引目录,`doc(int docId)`获取指定ID的文档。 - **Searcher**:`search(Query query, Collector results)`执行查询,`explain(int doc, Query query)`解释...

Global site tag (gtag.js) - Google Analytics