I’ve configured the HTTP server to run automatically on my server using systemd, on port 8042. As far as I know, there is no need to open port 8042 but I have done anyway just to see if it was causing issues.
Here is the systemd script:
[Unit]
Description=Manage LanguageTool Service
[Service]
WorkingDirectory=/opt/languagetool
ExecStart=/usr/bin/java -cp /usr/local/LangAnalysisApp/LangTool/LanguageTool-4.9/languagetool-server.jar org.languagetool.server.HTTPServer --port 8042 --allow-origin="*"
User=jvmapps
Type=simple
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
The server runs fine in the background when I start the system. I get results when I run the following in the command line, without any need to start anything manually:
curl --data "language=en-US&text=a simple test" http://localhost:8042/v2/check
The server responds with the expected result:
{"software":{"name":"LanguageTool","version":"4.9","buildDate":"2020-03-24 14:19","apiVersion":1,"premium":false,"premiumHint":"You might be missing errors only the Premium version can find. Contact us at support<at>languagetoolplus.com.","status":""},"warnings":{"incompleteResults":false},"language":{"name":"English (US)","code":"en-US","detectedLanguage":{"name":"French","code":"fr","confidence":0.815771}},"matches":[{"message":"This sentence does not start with an uppercase letter","shortMessage":"","replacements":[{"value":"A"}],"offset":0,"length":1,"context":{"text":"a simple test","offset":0,"length":1},"sentence":"a simple test","type":{"typeName":"Other"},"rule":{"id":"UPPERCASE_SENTENCE_START","description":"Checks that a sentence starts with an uppercase letter","issueType":"typographical","category":{"id":"CASING","name":"Capitalization"}},"ignoreForIncompleteSentence":true,"contextForSureMatch":-1}]}
Now I have followed the ‘integration on websites’ instructions. I had tested this using languagetool’s own API and the search is executed properly. When I change the value of languagetool_rpc_url
to http://localhost:8042/v2/check
, there is a long wait after clicking the ‘Check Text’ button and then the following error message is displayed:
Error: Did not get response from service. Please try again in one minute.
Does anybody know what causes this error or how to fix it?
Perhaps the docs are missing details when it comes to self-hosting.
Thanks in advance!