Back to LanguageTool Homepage - Privacy - Imprint

How to enable LanguageTool Server locally

(DITA OT发布环境) #1

Purpose : Instead of pointing to, I'd love to setup a Language Server locally to run a HTML document against.
The HTML document comes with this specific line of code:

/* The URL of your LanguageTool server.
If you use your own server here and it's not running on the same domain
as the text form, make sure the server gets started with '--allow-origin ...'
and use 'https://your-server/v2/check' as URL: */
languagetool_rpc_url : "http://localhost:8081/v2/check?",


Problem statement : Fail to make LanguageTool work, because after issuing this command : java -cp languagetool-server.jar org.languagetool.server.HTTPServer --port 8081

the Prompt throw errors as follows:
Server started
2017-12-13 08:24:35 An error has occurred, sending HTTP code 500. Access from, HTTP user agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36, language: en-US, text length: 43, Stacktrace follows:
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at org.languagetool.server.TextChecker.checkText(
at org.languagetool.server.ApiV2.handleRequest(
at org.languagetool.server.LanguageToolHttpHandler.handle(
at$Chain.doFilter(Unknown Source)
at Source)
at$Chain.doFilter(Unknown Source)
at$Exchange$LinkHandler.handle(Unknown Source)
at$Chain.doFilter(Unknown Source)
at$ Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$ Source)
at Source)
Caused by: java.lang.NullPointerException
at org.languagetool.rules.CleanOverlappingFilter.getMatchPriority(
at org.languagetool.rules.CleanOverlappingFilter.filter(
at org.languagetool.JLanguageTool.check(
at org.languagetool.JLanguageTool.check(
at org.languagetool.JLanguageTool.check(
at org.languagetool.server.TextChecker.getRuleMatches(
at org.languagetool.server.TextChecker.access$000(
at org.languagetool.server.TextChecker$
at org.languagetool.server.TextChecker$
at Source)
Meanwhile, When checking the HTML document, I find out that the HTML document highlights this error message that follows:


Error: Did not get response from service. Please try again in one minute.

(Daniel Naber) #2

Thanks for the report. Does this happen without you sending any text to the server? If not, could you share the text you're sending? Are you using LT 3.9?

(DITA OT发布环境) #3

I work with LT 3.8 , Here you go :

(DITA OT发布环境) #4

(Daniel Naber) #5

Could you see if this also happens with LT 3.9? There's a place in the code that can indeed cause this issue and I have just fixed it. The fix will be part of tomorrow's snapshot at:;O=D

(DITA OT发布环境) #6

thank you for the pointer Daniel, I will give it a try later.

(DITA OT发布环境) #7

Even with the latest LT 3.9 installed ,

The same problem occurs:

(Daniel Naber) #8

But this should fix it, doesn't it?

(DITA OT发布环境) #9

The same problem occurred again as shown:

(Daniel Naber) #10

This is a different issue now, as the server doesn't print any error. Please try starting the server with --allow-origin '*' as an additional parameter. This is probably a CORS issue - the browser has loaded the file from a file: URL and thus the Javascript cannot access the server running on localhost.

(DITA OT发布环境) #11

(Daniel Naber) #12

--allow-origin takes a parameter, please see my previous reply.

(DITA OT发布环境) #13

i did exactly append --allow-origin '*' to the command line, but the problem remains.

(DITA OT发布环境) #14

(Daniel Naber) #15

Maybe it works differently under Windows and you need to use -allow-origin * (without the quotes around *), but I cannot test that now.

(DITA OT发布环境) #16

Apply "*", it works perfectly well! Thanks a million Daniel.