IllegalArgumentException: Missing 'text' parameter

Hello.

I have started the latest server version of LT on my remote Linux like that:
java -cp languagetool-server.jar org.languagetool.server.HTTPServer --port 8081

It starts very, very slowly. (~40 seconds) After the server is active, I have tried to interact with it like that:
curl http://myserver:8081/v2/check?language=en&text=my+text

However, I tried to start on the Linux server as localhost - with success, but unfortunately this Exception will be thrown:

java.lang.IllegalArgumentException: Missing ‘text’ parameter
at org.languagetool.server.LanguageToolHttpHandler.handle(LanguageToolHttpHandler.java:202)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)
at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:82)
at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:675)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)
at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:647)
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)

I have tried to swap the parameters of the url like that:
curl http://localhost:8081/v2/check?text=my+text&language=en

This is the result:

java.lang.IllegalArgumentException: Missing ‘language’ parameter. Specify language or use autodetect=1 for auto-detecting the language of the input text.
at org.languagetool.server.LanguageToolHttpHandler.getLanguageAutoDetect(LanguageToolHttpHandler.java:420)
at org.languagetool.server.LanguageToolHttpHandler.checkText(LanguageToolHttpHandler.java:348)
at org.languagetool.server.LanguageToolHttpHandler.handle(LanguageToolHttpHandler.java:205)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)
at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:82)
at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:675)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)
at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:647)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

It seems like the 2. parameter does get ignored.

I have tried the same version on my local windows, and there everything works fine.

I hope you can help me fix this weird problem.

Many thanks for your work.

You need to use the --public option if you want the server to be accessible from somewhere else than just localhost.

& is a special character in the shell, you need to use quotes around the URL:

curl "http://localhost:8081/v2/check?text=my+text&language=en"
1 Like

Many many thanks Daniel for the fast answer! It’s working fine now.

By the way: Is is possible to dedect only the language of the text without all the grammer checks?

Not really… but you could turn off all rules (one by one, or at least category by category).

1 Like

Okey thank you!