Self-hosted LanguageTool server and Chrome add-on

Hello everybody,

I’m sorry to bother you, but in short, I can’t use a self-hosted LanguageTool server with Google Chrome add-on.

It works if I choose the languagetool.org server.

It works perfectly under Firefox.

I don’t know what I’m doing wrong, maybe someone can light me up.

Thank you!


I tried each of the following methods, to start the server :

java -cp ./LanguageTool-6.3/languagetool-server.jar org.languagetool.server.HTTPServer --port 8081

java -cp ./LanguageTool-6.3/languagetool-server.jar org.languagetool.server.HTTPServer --port 8081 --allow-origin “*”

java -cp ./LanguageTool-6.3/languagetool-server.jar org.languagetool.server.HTTPServer --port 8081 --allow-origin

I also tried starting the GUI, and turning on the server option.

I tried under Windows, and Debian.

I also tried behind a reverse proxy, using TLS.

Every time, I get the same problem (only with the Google Chrome add-on).

Here is the error message that appears in the terminal:


INFO org.languagetool.server.DatabaseAccessOpenSource Not setting up database access, dbDriver is not configured

Setting up thread pool with 10 threads

WARN: no common words file defined for Japanese - this language might not be correctly auto-detected

WARN: no common words file defined for Khmer - this language might not be correctly auto-detected

Starting LanguageTool 6.3 (build date: 2023-10-06 20:34:38 +0000, fb238b2) server on http://localhost:8081

Server started

INFO org.languagetool.server.LanguageToolHttpHandler Handling POST /v2/check

INFO org.languagetool.server.LanguageToolHttpHandler Handling POST /v2/check

ERROR org.languagetool.server.LanguageToolHttpHandler An error has occurred: ‘null’, sending HTTP code 500. Access from 127.0.0.1, HTTP user agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36, User agent param: webextension-chrome-ng, v: 8.3.0, Referrer: null, language: auto, h: 2, r: 2, time: 202m: TEXTLEVEL_ONLY, l: PICKY, iID: 19844:1701038232798, Stacktrace follows:java.lang.NullPointerException
at org.languagetool.server.TextChecker.checkText(TextChecker.java:376)
at org.languagetool.server.ApiV2.handleCheckRequest(ApiV2.java:176)
at org.languagetool.server.ApiV2.lambda$handleRequest$4(ApiV2.java:86)
at org.languagetool.tools.TelemetryProvider.createSpan(TelemetryProvider.java:96)
at org.languagetool.server.ApiV2.handleRequest(ApiV2.java:86)
at org.languagetool.server.LanguageToolHttpHandler.lambda$handle$0(LanguageToolHttpHandler.java:202)
at org.languagetool.tools.TelemetryProvider.createSpan(TelemetryProvider.java:96)
at org.languagetool.server.LanguageToolHttpHandler.handle(LanguageToolHttpHandler.java:202)
at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
at jdk.httpserver/sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:82)
at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:80)
at jdk.httpserver/sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:848)
at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
at jdk.httpserver/sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:817)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)

ERROR org.languagetool.server.LanguageToolHttpHandler An error has occurred: ‘null’, sending HTTP code 500. Access from 127.0.0.1, HTTP user agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36, User agent param: webextension-chrome-ng, v: 8.3.0, Referrer: null, language: auto, h: 2, r: 2, time: 202m: ALL_BUT_TEXTLEVEL_ONLY, l: PICKY, iID: 19844:1701038232798, Stacktrace follows:java.lang.NullPointerException
at org.languagetool.server.TextChecker.checkText(TextChecker.java:376)
at org.languagetool.server.ApiV2.handleCheckRequest(ApiV2.java:176)
at org.languagetool.server.ApiV2.lambda$handleRequest$4(ApiV2.java:86)
at org.languagetool.tools.TelemetryProvider.createSpan(TelemetryProvider.java:96)
at org.languagetool.server.ApiV2.handleRequest(ApiV2.java:86)
at org.languagetool.server.LanguageToolHttpHandler.lambda$handle$0(LanguageToolHttpHandler.java:202)
at org.languagetool.tools.TelemetryProvider.createSpan(TelemetryProvider.java:96)
at org.languagetool.server.LanguageToolHttpHandler.handle(LanguageToolHttpHandler.java:202)
at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
at jdk.httpserver/sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:82)
at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:80)
at jdk.httpserver/sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:848)
at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
at jdk.httpserver/sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:817)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)

INFO org.languagetool.server.LanguageToolHttpHandler Handled request in 230ms; sending code 500

INFO org.languagetool.server.LanguageToolHttpHandler Handled request in 230ms; sending code 500


1 Like

Hi, that’s strange indeed. Does the NullPointerException message appear more than once if you keep trying?

I’ve also now made a change to make the code potentially more robust, the new snapshot version will be available at https://internal1.languagetool.org/snapshots/LanguageTool-20231127-snapshot.zip tomorrow.

1 Like

Hi Daniel,

First of all, congratulation for your fantastic work.

Yes, the NullPoinerException continues to appear, as I type a text.

Please understand I am a noob :sweat_smile:, so I might be very wrong, however, I have the impression there is a difference between the chrome and firefox add-on, in the way they call the server.

The chrome add-on seems to pass an empty extra parameter in the POST data.

abtest=

the firefox add-on doesn’t seem to pass this parameter.

I don’t know if this is related, or I may be misreading the logs.

As a workaround, please add the --config parameter that points to a config file (can even be empty) when starting LT. This should fix the internal initialization.

2 Likes

With the empty config file, it works!

Thank you very much!

1 Like