https://bz.apache.org/bugzilla/show_bug.cgi?id=61590

            Bug ID: 61590
           Summary: service.bat fails to recognize JDK 9
           Product: Tomcat 9
           Version: 9.0.1
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Packaging
          Assignee: dev@tomcat.apache.org
          Reporter: kpreis...@apache.org
  Target Milestone: -----

Created attachment 35399
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35399&action=edit
Patch to correctly detect JDK 9

When trying to install Tomcat 9.0.1 on Windows (x64) where the JAVA_HOME
environment variable points to the JDK 9, service.bat fails to recognize the
Java binaries:

> C:\apache-tomcat-9.0.1\bin>service install
> The JAVA_HOME environment variable is not defined correctly
> This environment variable is needed to run this program
> NB: JAVA_HOME should point to a JDK not a JRE

This is because service.bat checks for "java.exe", "javaw.exe" and
"server\jvm.dll" within a "jre\bin" directory, but the "jre" directory doesn't
exist on JDK 9.

Instead, the necessary binaries can be found directly within the JDK's "bin"
folder.


Note: Running the Tomcat Service using the SYSTEM user (root) works, but if you
want to run the Tomcat Service as a different user with Java 9, it seems that
additionally to having access to the Tomcat directory (e.g. "D:\Tomcat"), the
user also must have read access access to its parent directory (e.g. "D:\") (or
even the drive root) for some reason.
Otherwise (if the user only has access to the Tomcat directory), starting the
service will fail and the following error will be printed to stderr.log:

> 2017-10-07 14:52:24 Commons Daemon procrun stderr initialized
> java.lang.NoClassDefFoundError: org/apache/catalina/startup/Bootstrap
> Caused by: java.lang.ClassNotFoundException: > 
> org.apache.catalina.startup.Bootstrap
>    at > 
> java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
>    at > 
> java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
>    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
Exception in thread "main" 

This isn't the case with Java 8, where it is sufficient to have access to only
the Tomcat directory.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to