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

languagetool 6.3 always reaturns status 500 - Cannot invoke contains because getAbTest() is null #9757

Closed
Orgoth opened this issue Nov 27, 2023 · 9 comments

Comments

@Orgoth
Copy link

Orgoth commented Nov 27, 2023

System: Ryzen 7700, 64GB Ram, 1tb nvme, 1gbit/s
OS: Debian 12
Languagetool: 6.3
cmd: screen -d -m /usr/bin/java -Xmx1500M -cp languagetool-server.jar org.languagetool.server.HTTPServer --port 8081 --public --allow-origin "*"

Even the text of this ticket is resulting in a 500 error, which you can see below.
Is there a way to enable debug or logging, to see what the underlying problem is?

2023-11-27 08:22:44.976 GMT+01:00 INFO org.languagetool.server.LanguageToolHttpHandler Handling POST /v2/check
2023-11-27 08:22:45.049 GMT+01:00 ERROR org.languagetool.server.LanguageToolHttpHandler An error has occurred: 'Cannot invoke "java.util.List.contains(Object)" because the return value of "org.languagetool.server.HTTPServerConfig.getAbTest()" is null', sending HTTP code 500. Access from 192.168.6.1, HTTP user agent: Mozilla/5.0 (X11; Linux x86_64) 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: 87m: TEXTLEVEL_ONLY, l: PICKY, iID: 12410:1701069470883, Stacktrace follows:java.lang.NullPointerException: Cannot invoke "java.util.List.contains(Object)" because the return value of "org.languagetool.server.HTTPServerConfig.getAbTest()" is null
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:95)
at jdk.httpserver/sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:82)
at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:98)
at jdk.httpserver/sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:851)
at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:95)
at jdk.httpserver/sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:818)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:840)

@danielnaber
Copy link
Member

Should be fixed with tomorrow's build, please see https://forum.languagetool.org/t/self-hosted-languagetool-server-and-chrome-add-on/9519/2

@Orgoth
Copy link
Author

Orgoth commented Nov 27, 2023

Thank you. I tried the search "contains getAbTest" but this topic did not pop up, therefore, thank you again for the reference to the forum post.
Have a nice day. 👍

@noraj
Copy link

noraj commented Nov 29, 2023

I have the same issue (cf. #9681 (comment)).

Ok I read the temporary workaround about adding --config /dev/null mentioned in https://forum.languagetool.org/t/self-hosted-languagetool-server-and-chrome-add-on/9519/3. But does a long term server or browser extension fix is planned?

@danielnaber
Copy link
Member

But does a long term server or browser extension fix is planned?

This will be fixed with the next release in March 2024. As the workaround is so simple, we don't plan an extra fix release just for this.

@Orgoth
Copy link
Author

Orgoth commented Nov 29, 2023

The workaround does not work for me.

/usr/bin/java -Xmx1500M -cp languagetool-server.jar org.languagetool.server.HTTPServer --port 8081 --public --allow-origin "*" --config
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 6 out of bounds for length 6
        at org.languagetool.server.HTTPServerConfig.<init>(HTTPServerConfig.java:243)
        at org.languagetool.server.HTTPServer.main(HTTPServer.java:170)

I have also tried it with "--config maxTextLength=10" and "--config maxTextLength 10"

Exception in thread "main" java.lang.RuntimeException: Could not load properties from 'maxTextLength=10'
        at org.languagetool.server.HTTPServerConfig.parseConfigFile(HTTPServerConfig.java:502)
        at org.languagetool.server.HTTPServerConfig.<init>(HTTPServerConfig.java:243)
        at org.languagetool.server.HTTPServer.main(HTTPServer.java:170)
Caused by: java.io.FileNotFoundException: maxTextLength=10 (Datei oder Verzeichnis nicht gefunden)
        at java.base/java.io.FileInputStream.open0(Native Method)
        at java.base/java.io.FileInputStream.open(FileInputStream.java:216)
        at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
        at org.languagetool.server.HTTPServerConfig.parseConfigFile(HTTPServerConfig.java:307)
Exception in thread "main" java.lang.RuntimeException: Could not load properties from 'maxTextLength'
        at org.languagetool.server.HTTPServerConfig.parseConfigFile(HTTPServerConfig.java:502)
        at org.languagetool.server.HTTPServerConfig.<init>(HTTPServerConfig.java:243)
        at org.languagetool.server.HTTPServer.main(HTTPServer.java:170)
Caused by: java.io.FileNotFoundException: maxTextLength (Datei oder Verzeichnis nicht gefunden)
        at java.base/java.io.FileInputStream.open0(Native Method)
        at java.base/java.io.FileInputStream.open(FileInputStream.java:216)
        at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
        at org.languagetool.server.HTTPServerConfig.parseConfigFile(HTTPServerConfig.java:307)
        ... 2 more

@Orgoth Orgoth reopened this Nov 29, 2023
@danielnaber
Copy link
Member

danielnaber commented Nov 29, 2023

Please specify an empty config file, not /dev/null or nothing

@Orgoth
Copy link
Author

Orgoth commented Nov 29, 2023

What is a empty config file for you?
Do you mean /home/lang/empty.cfg?

@Orgoth
Copy link
Author

Orgoth commented Nov 29, 2023

Since it is too much for @danielnaber to simply provide a sniped.
Here is a simple bash variant and how the server call must or should look.
This makes it much easier to understand, as --config is not really well documented.
https://github.com/search?q=repo%3Alanguagetool-org%2Flanguagetool%20--config&type=code

touch /home/lang/empty.cfg
/usr/bin/java -Xmx1500M -cp languagetool-server.jar org.languagetool.server.HTTPServer --port 8081 --public --allow-origin "*" --config /home/language/empty.cfg

@noraj
Copy link

noraj commented Nov 29, 2023

Please specify an empty config file, not /dev/null or nothing

--config with no file doesn't work but --config /dev/null works.

For those having a systemd unit / service file:

sudo systemctl edit languagetool.service (will produce an override file, e.g. /etc/systemd/system/languagetool.service.d/override.conf)

[Service]
# reset list to avoid append
ExecStart=
# Workaround https://github.com/languagetool-org/languagetool/issues/9757
ExecStart=/usr/bin/languagetool --http --allow-origin "*" --config /dev/null

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