Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gAnswerHttp启动后出现NullPointerException,请问如何解决,多谢。 #38

Open
gaoruiqing1983 opened this issue Apr 8, 2020 · 3 comments

Comments

@gaoruiqing1983
Copy link

gAnswer启动过程报错:
====== gAnswer2.0 over Pkubase ======
java.io.IOException: Unable to open "edu/stanford/nlp/models/lexparser/chinesePCFG.ser.gz" as class path, filename or URL
at edu.stanford.nlp.io.IOUtils.getInputStreamFromURLOrClasspathOrFileSystem(IOUtils.java:480)
at edu.stanford.nlp.io.IOUtils.readStreamFromString(IOUtils.java:400)
at edu.stanford.nlp.parser.lexparser.LexicalizedParser.getParserFromSerializedFile(LexicalizedParser.java:601)
at edu.stanford.nlp.parser.lexparser.LexicalizedParser.getParserFromFile(LexicalizedParser.java:405)
at edu.stanford.nlp.parser.lexparser.LexicalizedParser.loadModel(LexicalizedParser.java:187)
at edu.stanford.nlp.parser.lexparser.LexicalizedParser.loadModel(LexicalizedParser.java:166)
at nlp.tool.StanfordParser.(StanfordParser.java:32)
at qa.Globals.init(Globals.java:44)
at application.GanswerHttp.main(GanswerHttp.java:71)
不过实际提示启动成功:
D:\code\opensource\gAnswer-pkubase
NLPatterns.loadPredicateId() : ok!
main dict load finished, time elapsed 575 ms
model load finished, time elapsed 20 ms.
Mention2Ent size: 59581
Read Mention2Ent used 97ms
NLPatterns.addPredicateAsNLPattern(): ok!
NLPatterns.addHandwriteAsNLPattern(): ok!
NLPatterns.buildInvertedIndex(): ok!
Loading entity id ...
Load 24238 entity ids in 11ms.
Loading entity fragments ...
Load 24238 entity fragments in 10ms.
Loading relation IDs and Fragments ...
Loading type IDs and Fragments ...
Load 114 basic types.
======Initialization======
StanfordParser: 57ms.
StopWordsList: 1ms.
ParaphraseDict: 719ms.
GraphFragments: 39ms.

  • Total *: 816ms.
    ==========================
    Server ready!
    查询过程过错,日志如下:
    [Input:] Who is the wife of Barack Obama
    Result: who, ,①, ,the, ,wife, ,of, ,barack, ,obama,
    step0 [Node Recognition] : 0ms
    transQ: Who is the wife of Barack Obama
    java.lang.NullPointerException
    at nlp.tool.StanfordParser.getTypedDependencyList(StanfordParser.java:46)
    at nlp.ds.DependencyTree.(DependencyTree.java:32)
    at qa.parsing.QuestionParsing.getDependenciesAndNER(QuestionParsing.java:22)
    at qa.parsing.QuestionParsing.process(QuestionParsing.java:14)
    at qa.GAnswer.getSparqlList(GAnswer.java:66)
    at application.GanswerHandler.handle(GanswerHandler.java:66)

说明: 我是本地windows环境下载源码gAnswer-pkubase.zip和ganswer_pkubase_lib.rar编译的,对接自己搭建的gStore环境(gStore用的是lubm数据库)。

@gaoruiqing1983
Copy link
Author

问答查询过程出错,日志如下。请问如何解决,多谢。
[Input:] Who is the wife of Barack Obama
Result: who, ,①, ,the, ,wife, ,of, ,barack, ,obama,
step0 [Node Recognition] : 0ms
transQ: Who is the wife of Barack Obama
java.lang.NullPointerException
at nlp.tool.StanfordParser.getTypedDependencyList(StanfordParser.java:46)
at nlp.ds.DependencyTree.(DependencyTree.java:32)
at qa.parsing.QuestionParsing.getDependenciesAndNER(QuestionParsing.java:22)
at qa.parsing.QuestionParsing.process(QuestionParsing.java:14)
at qa.GAnswer.getSparqlList(GAnswer.java:66)
at application.GanswerHandler.handle(GanswerHandler.java:66)

@nicklin96
Copy link
Collaborator

您好!从报错信息看,您的问题是由中文语法树生成器未能正确加载导致的。建议您确认是否已经正确下载所需的jar包,并且正确地将它们放置在lib文件夹并加入Build Path中。
另外,我们更推荐使用linux系统运行ganswer,以避免兼容性问题

@haozheng61
Copy link

您好,我浏览器进行http请求,输入为:http://localhost:9999/gSolve/?data={maxAnswerNum:3,needSparql:1,question:who%20is%20the%20wife%20of%20Donald%20Trump?},输出为:{"question":"who is the wife of Donald Trump?","message":"InvalidQuestionException: the question you input is invalid, please check","status":"500"},日志为:
[Input:] who is the wife of Donald Trump?
EntityRecognizer Initial : ok!
--------- entity/type recognition start ---------
Type Check: wife
Type Check: Donald
Ent Check: Donald
java.lang.NullPointerException
at qa.mapping.DBpediaLookup.getEntityMappings(DBpediaLookup.java:53)
at qa.extract.EntityRecognition.getEntityIDsAndNamesByStr(EntityRecognition.java:734)
at qa.extract.EntityRecognition.process(EntityRecognition.java:330)
at qa.Query.getMergedQuestionList(Query.java:109)
at qa.Query.(Query.java:35)
at qa.GAnswer.getSparqlList(GAnswer.java:42)
at application.GanswerHandler.handle(GanswerHandler.java:66)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1096)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1032)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:136)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:258)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:445)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:267)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:224)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.run(AbstractConnection.java:358)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:601)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:532)
at java.lang.Thread.run(Unknown Source)

也是空指针错误,请问您知道怎么解决这个问题吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants