jxmorris12 / language_tool_python

a free python grammar checker 📝✅
GNU General Public License v3.0
429 stars 61 forks source link

java.lang.NoClassDefFoundError #55

Closed koolok closed 2 years ago

koolok commented 2 years ago

Hi,

I just install the package using pip. I can use the public server using language_tool_python.LanguageToolPublicAPI('fr')

But when I try to use check with a local server, it fails:

matches = tool.check(text)
Traceback (most recent call last):

  Input In [3] in <module>
    matches = tool.check(text)

  File ~/.local/lib/python3.8/site-packages/language_tool_python/server.py:129 in check
    response = self._query_server(url, self._create_params(text))

  File ~/.local/lib/python3.8/site-packages/language_tool_python/server.py:220 in _query_server
    return response.json()

  File ~/.local/lib/python3.8/site-packages/requests/models.py:899 in json
    return complexjson.loads(

  File ~/.local/lib/python3.8/site-packages/simplejson/__init__.py:525 in loads
    return _default_decoder.decode(s)

  File ~/.local/lib/python3.8/site-packages/simplejson/decoder.py:370 in decode
    obj, end = self.raw_decode(s)

  File ~/.local/lib/python3.8/site-packages/simplejson/decoder.py:400 in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())

JSONDecodeError: Expecting value

And if I try from bash, I get:

$ curl -d "text=This is an test." -d "language=en-US" http://127.0.0.1:8082/v2/check
Error: Internal Error: java.lang.NoClassDefFoundError: Could not initialize class org.languagetool.gui.Configuration, detected: en-U

Code I'm using to start the server and check the text:

import language_tool_python

tool = language_tool_python.LanguageTool('en-US')
text = 'A sentence with a error in the Hitchhiker’s Guide tot he Galaxy'
matches = tool.check(text)
jxmorris12 commented 2 years ago

Hi, please make sure you're using the proper version of Java @koolok - if you update Java and still have problems, feel free to reopen the issue.