silvio / docker-languagetool

Dockerfile for LanguageTool
Other
176 stars 46 forks source link

exception while running under user nobody #7

Closed mvasilenko closed 6 years ago

mvasilenko commented 6 years ago

Hello,

I'm trying to use languagetool in docker-compose, with following configuration

languagetool:
    image: silviof/docker-languagetool
    user: nobody
    restart: always
    networks:
      - localdev
    ports:
      - 33350:8010

got this error

2018-04-18 15:40:46 An error has occurred: 'java.lang.IllegalArgumentException: Cannot open file .languagetool.cfg in directory /nonexistent', sending HTTP code 500. Access from 172.25.0.1, HTTP user agent: Python/3.6 aiohttp/3.1.3, User agent param: null, Referrer: null, language: auto, h: 1, r: 16, text length: 0, Stacktrace follows:
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Cannot open file .languagetool.cfg in directory /nonexistent
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    at org.languagetool.server.TextChecker.checkText(TextChecker.java:151)
    at org.languagetool.server.ApiV2.handleCheckRequest(ApiV2.java:84)
    at org.languagetool.server.ApiV2.handleRequest(ApiV2.java:58)
    at org.languagetool.server.LanguageToolHttpHandler.handle(LanguageToolHttpHandler.java:121)
    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:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: Cannot open file .languagetool.cfg in directory /nonexistent
    at org.languagetool.gui.Configuration.<init>(Configuration.java:115)
    at org.languagetool.gui.Configuration.<init>(Configuration.java:106)
    at org.languagetool.server.TextChecker.configureFromGUI(TextChecker.java:340)
    at org.languagetool.server.TextChecker.getLanguageToolInstance(TextChecker.java:319)
    at org.languagetool.server.TextChecker.getRuleMatches(TextChecker.java:251)
    at org.languagetool.server.TextChecker.access$000(TextChecker.java:46)
    at org.languagetool.server.TextChecker$1.call(TextChecker.java:145)
    at org.languagetool.server.TextChecker$1.call(TextChecker.java:138)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    ... 3 more

it can be fixed by changing user to root, which is not good practice, how can it be fixed?

****************************************************************************************************
*** WARNING: this process is running as root - please do not run it as root for security reasons ***
****************************************************************************************************
WARNING: running in HTTP mode, consider using org.languagetool.server.HTTPSServer for encrypted connections
WARNING: running in public mode, LanguageTool API can be accessed without restrictions!
Setting up thread pool with 10 threads
Starting LanguageTool 4.1 (build date: 2018-03-27 11:22) server on http://localhost:8010...
Server started
silvio commented 6 years ago

Hi @mvasilenko , thanks for your report.

it can be fixed by changing user to root, which is not good practice, how can it be fixed?

Write a patch... I use language tools on a only internal reachable server. For me a root running languagetools is enough. You want to write a patch?

mvasilenko commented 6 years ago

@silvio I've added PR #8 , not sure what this file means to languagetool, but it works