简体   繁体   English

IllegalAccessError:org / apache / lucene / index / DirectoryReader

[英]IllegalAccessError: org/apache/lucene/index/DirectoryReader

I am trying to use Lucene search for my utility . 我正在尝试使用Lucene搜索实用程序。 The application is running on jboss and the search code is written in an ejb bean. 该应用程序在jboss上运行,并且搜索代码编写在ejb bean中。

public List<String> textSearch(String text,String folder,String subfolder) throws IOException, RemoteException{

    final String indexloc="/index/"+folder+"/"+subfolder;
    IndexReader reader = DirectoryReader.open(FSDirectory.open(new File(indexloc))); 
            List<String> data = new ArrayList<String>();
            String fileList; 
            try {
                   IndexSearcher searcher = new IndexSearcher(reader);
                   TopScoreDocCollector collector = TopScoreDocCollector.create(500, true);

                   Query q = new QueryParser(Version.LUCENE_CURRENT, "contents", analyzer).parse(text);
                   searcher.search(q, collector);
                   ScoreDoc[] hits = collector.topDocs().scoreDocs;
                   for(int i=0;i<hits.length;++i) {
                        int docId = hits[i].doc;
                        Document d = searcher.doc(docId);

                        data.add(d.get("FileName"));

                    }
            }catch(ParseException pe)
            {}
             catch(Exception e) {
                    logger.log(Level.SEVERE,"Error:" + e);
            }


            return data;
}

When application is calling the remote function present inside bean , I am getting following error : 当应用程序调用bean中存在的远程函数时,出现以下错误:

java.lang.IllegalAccessError: org/apache/lucene/index/DirectoryReader
at offlineMApackage.TextSearchSessionBean.textSearch(TextSearchSessionBean.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.invocation.Invocation.performCall(Invocation.java:386)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:228)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:156)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:173)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:267)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:211)
at org.jboss.ejb.plugins.security.PreSecurityInterceptor.process(PreSecurityInterceptor.java:134)
at org.jboss.ejb.plugins.security.PreSecurityInterceptor.invoke(PreSecurityInterceptor.java:81)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:650)
at org.jboss.ejb.Container.invoke(Container.java:1029)
at sun.reflect.GeneratedMethodAccessor309.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at org.jboss.invocation.unified.server.UnifiedInvoker.invoke(UnifiedInvoker.java:232)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:891)
at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:744)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:697)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:551)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:232)

Please suggest something if anyone encountered similar problem..? 如果有人遇到类似问题,请提出建议。

好了,我的问题通过在jboss lib文件夹中包含lucene jars并设置适当的类路径而得以解决。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 org.apache.lucene.index.IndexNotFoundException:org.apache.lucene.store.RAMDirectory中找不到segments *文件 - org.apache.lucene.index.IndexNotFoundException: no segments* file found in org.apache.lucene.store.RAMDirectory 线程“主”中的异常org.apache.lucene.index.IndexNotFoundException:在org.apache.lucene.store.SimpleFSDirectory中找不到segment *文件 - Exception in thread “main” org.apache.lucene.index.IndexNotFoundException: no segments* file found in org.apache.lucene.store.SimpleFSDirectory 从DirectoryReader访问自定义Lucene属性 - Accessing custom Lucene attribute from DirectoryReader java.lang.IllegalAccessError:org / apache / xml / serializer / ExtendedContentHandler - java.lang.IllegalAccessError: org/apache/xml/serializer/ExtendedContentHandler Elasticsearch遇到致命错误,并在“问题框架:#J org.apache.lucene.index.SegmentTermEnum.next()Z重新启动 - Elasticsearch experiencing fatal errors and restarting on "Problematic frame: # J org.apache.lucene.index.SegmentTermEnum.next()Z Apache Lucene - 创建和存储索引? - Apache Lucene - Creating and Storing an Index? 无法导入org.apache.lucene - Cannot import org.apache.lucene PyLucene org.apache.lucene.benchmark丢失 - PyLucene org.apache.lucene.benchmark is missing NoSuchMethodError: org.apache.lucene.document.Field - NoSuchMethodError: org.apache.lucene.document.Field Lucene的org.apache.lucene.document.Field类的方法使用 - Methods usage of org.apache.lucene.document.Field class of Lucene
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM