lucene7.3 使用报org.apache.lucene.queryparser.classic.ParseException错误

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/huaquan520/article/details/79973793

搜索代码

运行时出现如下异常

org.apache.lucene.queryparser.classic.ParseException: Encountered "<EOF>" at line 1, column 0.
Was expecting one of:
    <NOT> ...
    "+" ...
    "-" ...
    <BAREOPER> ...
    "(" ...
    "*" ...
    <QUOTED> ...
    <TERM> ...
    <PREFIXTERM> ...
    <WILDTERM> ...
    <REGEXPTERM> ...
    "[" ...
    "{" ...
    <NUMBER> ...
    <TERM> ...
    
at org.apache.lucene.queryparser.classic.QueryParser.generateParseException(QueryParser.java:931)
at org.apache.lucene.queryparser.classic.QueryParser.jj_consume_token(QueryParser.java:813)
at org.apache.lucene.queryparser.classic.QueryParser.Query(QueryParser.java:252)
at com.qhcccy.lucene.SearchIndex.searchIndex(SearchIndex.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:513)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:115)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:170)
at org.junit.jupiter.engine.execution.ThrowableCollector.execute(ThrowableCollector.java:40)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:166)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:113)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:58)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(HierarchicalTestExecutor.java:113)
at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(HierarchicalTestExecutor.java:108)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(HierarchicalTestExecutor.java:79)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(HierarchicalTestExecutor.java:121)
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(HierarchicalTestExecutor.java:121)
at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(HierarchicalTestExecutor.java:108)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(HierarchicalTestExecutor.java:79)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(HierarchicalTestExecutor.java:121)
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(HierarchicalTestExecutor.java:121)
at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(HierarchicalTestExecutor.java:108)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(HierarchicalTestExecutor.java:79)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:55)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:43)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:170)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:154)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:90)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:65)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

解决办法:

改成

阅读更多

readUTF()使用报 java.io.EOFException异常

12-25

今天在编程的时候,用到了DataInPutStream类的readUTF()方法时报了个异常,查了好多资料也不能解决,求大神指点啊.高分悬赏.nnn```n package IO流;nnimport java.io.DataInputStream;nimport java.io.DataOutputStream;nimport java.io.FileInputStream;nimport java.io.FileNotFoundException;nimport java.io.FileOutputStream;nimport java.io.IOException;nnpublic class DataTest nn /**n * 数据输入输出流n * n */n public static void main(String[] args) throws IOException n //向指定文件中写入数据n //打开文件输出流n FileOutputStream fos=new FileOutputStream("G://word.txt");n //将此输出流链接到指定基础输出流DataOutPutStreamn DataOutputStream dos=new DataOutputStream(fos);n //写入数据:n dos.writeBytes("我是大禹!");//用此方法写入的数据用记事本打开是乱码n dos.writeChars("我治水!");//用此方法写入的数据用记事本打开是乱码n dos.writeUTF("你智障吗?");n //关闭流n fos.close();n //从文件中读取数据n //首先打开文件输入流n FileInputStream fis=new FileInputStream("G://word.txt");n //将此输入流连接到基本数据输入流DataInPutStreamn DataInputStream dis=new DataInputStream(fis);n //开始读取数据啦n// String s=dis.readUTF();n System.out.println(dis.readUTF());n dis.close();n n n n n n n n nnnn```n异常信息:nException in thread "main" java.io.EOFExceptionn at java.io.DataInputStream.readFully(DataInputStream.java:180)n at java.io.DataInputStream.readUTF(DataInputStream.java:592)n at java.io.DataInputStream.readUTF(DataInputStream.java:547)n at IO流.DataTest.main(DataTest.java:35)nn

linux环境下Jnative使用报org.xvolks.jnative.exceptions.NativeException

12-29

最近做一个项目: 使用jnative调用动态库(.dll或.a文件),在windows环境下,能够完成dll动态库的调用,但是放到linux下面,改用.a文件格式的动态,jnative在linux下使用的libJNativeCpp.so已经放入/usr/lib路径下,调用时就发生异常:rnorg.xvolks.jnative.exceptions.NativeException: Library /opt/finger/lib/libBLServerAPI.a not found : /opt/finger/lib/libBLServerAPI.a: invalid ELF headerrn at org.xvolks.jnative.JNative.nLoadLibrary(Native Method)rn at org.xvolks.jnative.JNative.(JNative.java:348)rn at org.xvolks.jnative.JNative.(JNative.java:269)rn at finger.UserCall.verifyMatch(UserCall.java:55)rn at finger.FingerAction.authFinger(FingerAction.java:230)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452)rn at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)rn at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rnrn代码如下:rn public int verifyMatch(String fingerAuth, String fingerSign, int matchResult)rn throws NativeException, IllegalAccessException rn JNative Something = null;rn if (Something == null) rn Something = new JNative("/opt/finger/lib/libBLServerAPI.a", "BLM_VerifyMatch");rn // 利用org.xvolks.jnative.JNative 来装载 libBLServerAPI.a BLModuleServerAPIrn // FNetSDK_Client.dll,并利用其BLM_OpenModule方法rn Something.setRetVal(Type.INT);rn // 指定返回参数的类型rn rn int i = 0;rn Pointer fingerAuthPointer = creatCharPointer();rn Pointer fingersignPointer = creatCharPointer();rn Pointer resultPointer = creatPointer();rn rn fingerAuthPointer.setMemory(Base64.decode(fingerAuth));rn fingersignPointer.setMemory(Base64.decode(fingerSign));rn rn Something.setParameter(i++, fingerAuthPointer);rn Something.setParameter(i++, fingersignPointer);rn Something.setParameter(i++, resultPointer);rn rn Something.invoke();// 调用方法rn rn return resultPointer.getAsInt(0);rn rnrn 请哪位高手知道这是什么问题啊?rnrnrn

急求助:jxl类使用报java.lang.NoClassDefFoundError

12-26

在使用jxl包时,某java类中引入了该包,写了些读取excel文件的方法,编译都通过了,并且在该java类中写了个测试主函数都能执行成功。rn可是在Jsp页面调用该java类中的方法的时候报以下错误:rnjava.lang.NoClassDefFoundError: jxl/Workbookrn at teleweb.util.ExcelToTxt.readExcal(ExcelToTxt.java:31)rn at jsp_servlet._webapp._lst_excel.__lstfileuploadact._jspService(__lstfirnleuploadact.java:667)rn at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)rn at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.runrn(ServletStubImpl.java:1006)rn at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImrnpl.java:419)rn at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImrnpl.java:315)rn at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActiornn.run(WebAppServletContext.java:6718)rn at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticaterndSubject.java:321)rn at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:rn121)rn at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSernrvletContext.java:3764)rn at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImrnpl.java:2644)rn at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)rn at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)rn>rnrn注释:在环境变量中都已经引入了该jxl.jar包,可是还是总报以上错误rn请问各位是何原因,急......谢谢了

没有更多推荐了,返回首页