weixin_39689622
2020-11-27 00:59 阅读 3

InvocationTargetException Exception

I tried to run the wiki example to extract header, however, I got this error:


Exception in thread "main" java.lang.reflect.InvocationTargetException
    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 com.simontuffs.onejar.Boot.run(Boot.java:340)
    at com.simontuffs.onejar.Boot.main(Boot.java:166)
Caused by: java.lang.reflect.InvocationTargetException
    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.grobid.core.utilities.Utilities.launchMethod(Utilities.java:359)
    at org.grobid.core.main.batch.GrobidMain.main(GrobidMain.java:155)
    ... 6 more
Caused by: java.lang.NullPointerException
    at org.grobid.core.engines.ProcessEngine.processHeader(ProcessEngine.java:56)
    ... 12 more

Any clue?

该提问来源于开源项目:kermitt2/grobid

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

6条回答 默认 最新

  • weixin_39811036 weixin_39811036 2020-11-27 00:59

    It seems that there is no pdf file in the directory you indicated in the batch command - actually no file at all. An error message for this case should be added.

    点赞 评论 复制链接分享
  • weixin_39689622 weixin_39689622 2020-11-27 00:59

    I seems to still get the same error. The command I did:

    
    java -Xmx1024m -jar grobid-core-0.2.10.one-jar.jar -gH /tools/grobid/grobid-home -gP /tools/grobid/grobid-home/config/grobid.properties -dIn /input -dOut /output -exe processHeader
    

    and the error I get:

    
    Exception in thread "main" java.lang.reflect.InvocationTargetException
        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 com.simontuffs.onejar.Boot.run(Boot.java:340)
        at com.simontuffs.onejar.Boot.main(Boot.java:166)
    Caused by: java.lang.reflect.InvocationTargetException
        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.grobid.core.utilities.Utilities.launchMethod(Utilities.java:359)
        at org.grobid.core.main.batch.GrobidMain.main(GrobidMain.java:155)
        ... 6 more
    Caused by: java.lang.ExceptionInInitializerError
        at org.grobid.core.document.Document.getHeaderFeatured(Document.java:791)
        at org.grobid.core.engines.HeaderParser.processingHeaderBlock(HeaderParser.java:90)
        at org.grobid.core.engines.HeaderParser.processing(HeaderParser.java:76)
        at org.grobid.core.engines.Engine.processHeader(Engine.java:460)
        at org.grobid.core.engines.Engine.processHeader(Engine.java:425)
        at org.grobid.core.engines.ProcessEngine.processHeader(ProcessEngine.java:59)
        ... 12 more
    Caused by: java.lang.NullPointerException
        at java.io.Reader.<init>(Reader.java:61)
        at java.io.InputStreamReader.<init>(InputStreamReader.java:80)
        at org.grobid.core.lexicon.Lexicon.addDictionary(Lexicon.java:118)
        at org.grobid.core.lexicon.Lexicon.<init>(Lexicon.java:81)
        at org.grobid.core.lexicon.Lexicon.getNewInstance(Lexicon.java:71)
        at org.grobid.core.lexicon.Lexicon.getInstance(Lexicon.java:59)
        at org.grobid.core.features.FeatureFactory.<init>(FeatureFactory.java:22)
        at org.grobid.core.features.FeatureFactory.<clinit>(FeatureFactory.java:18)
        ... 18 more
    </clinit></init></init></init></init>

    here's my log:

    
    17 Jul 2014 14:05.32 [INFO ] LibraryLoader             - Loading external library crfpp
    17 Jul 2014 14:05.32 [INFO ] LibraryLoader             - Library crfpp loaded
    17 Jul 2014 14:05.32 [INFO ] ModelMap                  - Loading model /tools/grobid/grobid-home/models/header/model.crf in memory
    17 Jul 2014 14:05.32 [INFO ] Lexicon                   - Initiating dictionary
    17 Jul 2014 14:05.32 [INFO ] Lexicon                   - End of Initialization of dictionary
    17 Jul 2014 14:05.32 [INFO ] Lexicon                   - Initiating names
    17 Jul 2014 14:05.32 [INFO ] Lexicon                   - End of initialization of names
    
    点赞 评论 复制链接分享
  • weixin_39811036 weixin_39811036 2020-11-27 00:59

    This is another error. Grobid now fails to read the resource file under grobid-home/lexicon/wordforms/english.wf Does this file belongs correctly to your grobid-home folder? What is your environment?

    点赞 评论 复制链接分享
  • weixin_39689622 weixin_39689622 2020-11-27 00:59

    I'm on mac, and yes grobid-home/lexicon/wordforms/english.wf is there.

    点赞 评论 复制链接分享
  • weixin_39811036 weixin_39811036 2020-11-27 00:59

    Have you tried the service https://github.com/kermitt2/grobid/wiki/Grobid-service-quick-start? There is no path to set, so it 's worth a try before the batch command.

    If it still doesn't work, you could try to modify this property in grobid-home/config/grobid.properties:

    
    grobid.resources.inHome=true
    

    to

    
    grobid.resources.inHome=false 
    

    for indicating to use the resources in the jar file rather than in grobid-home.

    点赞 评论 复制链接分享
  • weixin_39689622 weixin_39689622 2020-11-27 00:59

    Oh.. it looks I already set grobid.resources.inHome=false, new I set it back to true and it works.

    Many thanks.

    点赞 评论 复制链接分享

相关推荐