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

--- Comment #2 from Jakub Moravec <jakub.mora...@getmanta.com> ---
Thanks for the response Christopher. I dug a bit deeper...

(In reply to Christopher Schultz from comment #1)
> (In reply to Jakub Moravec from comment #0)
> >   We found out, that if JAVA_HOME is wrongly configured (for example if it
> > points to JRE instead of JDK), the service.bat script won't fail, will skip
> > to and return exit code 0. 
> 
> JAVA_HOME should be able to point to either a JRE or JDK. Tomcat hasn't
> required a JDK for a very long time.

I noticed, that there is some logic in service.bat (for Java versions in which
JDK and JRE were still distributed separately), that for example appends the
'/jre' absolute path segment to the JAVA_HOME. Also, the structure of the
target folder seems to be somehow validated. I'm not what is the exact reason,
but I expect that due to one of those facts the script prints the following
messages and skips to an end. 

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 misleading, as the service was not installed because of wrongly
> > set-up JAVA_HOME. 
> 
> If true, I agree.

Yes, as I mentioned, the log messages are printed, but that is the only
indication that services were not installed. Script return code is 0 which
makes it hard to handle this issue in automated solution. 

> > Is it possible to provide better validation and make sure, that the exit
> > code is not 0 in case the installation of the service fails?
> 
> Probably the best way to check for JAVA_HOME validity is to actually launch
> the JVM with some trivial task (even just "java.exe --help") to make sure it
> executes successfully, would you agree?

It sounds reasonable, but since I am not sure what is the exact cause of this
issue, I cannot say that this will suffice. 

> > I believe that swallowing of exceptions is not a good approach ;)
> 
> Do you believe there is an error being swallowed? Which one?

I'm referring to the fact that the response code is 0 - the script is acting
like nothing bad happened even though the service was not installed.

-- 
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