Uploaded image for project: 'Tika'
  1. Tika
  2. TIKA-2753

ChildProcess does not use the JAVA_HOME

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 1.19.1
    • 2.0.0, 1.20
    • server
    • None

    Description

      If the user starting the Tika Server does not have the path to java configured in its PATH var, the following error appears in the logs :

      java.io.IOException: Cannot run program "java": error=2, No such file or directory
          at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
          at org.apache.tika.server.TikaServerWatchDog$ChildProcess.startProcess(TikaServerWatchDog.java:224)
          at org.apache.tika.server.TikaServerWatchDog$ChildProcess.<init>(TikaServerWatchDog.java:149)
          at org.apache.tika.server.TikaServerWatchDog$ChildProcess.<init>(TikaServerWatchDog.java:139)
          at org.apache.tika.server.TikaServerWatchDog.execute(TikaServerWatchDog.java:87)
          at org.apache.tika.server.TikaServerCli.execute(TikaServerCli.java:136)
          at org.apache.tika.server.TikaServerCli.main(TikaServerCli.java:117)
      Caused by: java.io.IOException: error=2, No such file or directory
          at java.lang.UNIXProcess.forkAndExec(Native Method)
          at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
          at java.lang.ProcessImpl.start(ProcessImpl.java:134)
          at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
          ... 6 more

       

      By checking the TikaServerWatchDog class I noticed that the startProcess method of the ChildProcess private class is using the 'java' argument. As my user only have the JAVA_HOME configured in its /etc/profile and not the path to java, this explains the error.

      It would be better if the startProcess relies on the JAVA_HOME env var to use java instead of assuming that the java program is configured in the PATH env var of the user.

      Attachments

        Activity

          People

            tallison Tim Allison
            julienFL Julien Massiera
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: