Back to LanguageTool Homepage - Privacy - Imprint

Java.util.concurrent.ExecutionException when using Command Line (sometimes)

Hello

I am using languagetool via the command line tool. My call looks like:
java -jar ./libs/LanguageTool-3.0/languagetool-commandline.jar -c UTF-8 --api -l en-US mytext.txt

At about 5% of the calls I get a:
Exception in thread “main” java.lang.RuntimeException: java.util.concurrent.ExecutionException:

I am doing this from php via a exec call, if this matters.

The enviroment is a debian 7 box.
Output of java -version:
java version “1.8.0_25”
Java™ SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot™ 64-Bit Server VM (build 25.25-b02, mixed mode)

The text to check is short, about 5 sentences.

Does anyone have an idea what the problem could be?

The complete stacktrace:
Exception in thread “main” java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: Could not load dictionary from /en/english.dict at org.languagetool.MultiThreadedJLanguageTool.analyzeSentences(MultiThreadedJLanguageTool.java:142) at org.languagetool.JLanguageTool.check(JLanguageTool.java:496) at org.languagetool.JLanguageTool.check(JLanguageTool.java:449) at org.languagetool.JLanguageTool.check(JLanguageTool.java:445) at org.languagetool.commandline.CommandLineTools.checkText(CommandLineTools.java:103) at org.languagetool.commandline.CommandLineTools.checkText(CommandLineTools.java:80) at org.languagetool.commandline.Main.runOnFileInOneGo(Main.java:214) at org.languagetool.commandline.Main.runOnFile(Main.java:193) at org.languagetool.commandline.Main.main(Main.java:530)Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: Could not load dictionary from /en/english.dict at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:192) at org.languagetool.MultiThreadedJLanguageTool.analyzeSentences(MultiThreadedJLanguageTool.java:135) … 8 moreCaused by: java.lang.RuntimeException: Could not load dictionary from /en/english.dict at org.languagetool.tagging.BaseTagger.(BaseTagger.java:78) at org.languagetool.tagging.BaseTagger.(BaseTagger.java:65) at org.languagetool.tagging.en.EnglishTagger.(EnglishTagger.java:40) at org.languagetool.language.English.getTagger(English.java:94) at org.languagetool.JLanguageTool.getRawAnalyzedSentence(JLanguageTool.java:722) at org.languagetool.JLanguageTool.getAnalyzedSentence(JLanguageTool.java:703) at org.languagetool.MultiThreadedJLanguageTool$AnalyzeSentenceCallable.call(MultiThreadedJLanguageTool.java:209) at org.languagetool.MultiThreadedJLanguageTool$AnalyzeSentenceCallable.call(MultiThreadedJLanguageTool.java:200) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)Caused by: java.io.IOException: Invalid argument at java.io.FileInputStream.readBytes(Native Method) at java.io.FileInputStream.read(FileInputStream.java:246) at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) at java.io.BufferedInputStream.read1(BufferedInputStream.java:286) at java.io.BufferedInputStream.read(BufferedInputStream.java:345) at java.io.FilterInputStream.read(FilterInputStream.java:107) at morfologik.util.FileUtils.readFully(FileUtils.java:64) at morfologik.fsa.CFSA2.(CFSA2.java:191) at morfologik.fsa.FSA.read(FSA.java:272) at morfologik.stemming.Dictionary.readAndClose(Dictionary.java:141) at morfologik.stemming.Dictionary.read(Dictionary.java:98) at org.languagetool.tagging.BaseTagger.(BaseTagger.java:76) … 11 more

Sorry for the messed up newlines… don’t know how to fix that…

Thanks for the report. I think you’re the first to report this and I have no idea yet what could cause this. Can you reproduce this in the shell (leaving out PHP)? Could you provide the text?

It seems not to happen if I run the command from the shell without php’s exec.

Maybe PHP does something to mess up the current working directory and sets it to something else? Or maybe processes called from PHP inherit some memory or I/O limitations?