You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Robert Bray (Jira)" <ji...@apache.org> on 2022/04/19 20:40:00 UTC

[jira] [Commented] (TOMEE-2712) TomEE Windows service cannot be correctly installed if only JRE present (errors in service.bat, maybe it fails even with JDK used)

    [ https://issues.apache.org/jira/browse/TOMEE-2712?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17524581#comment-17524581 ] 

Robert Bray commented on TOMEE-2712:
------------------------------------

I still see the issue when JRE_HOME is used.  I do not see the suggested line at #91:
for /f tokens^=2^ delims^=.-_^" %%j in ('"%JRE_HOME%\bin\java.exe" -fullversion 2^>^&1') do set "JAVA_MAJOR_VERSION=%%j"

> TomEE Windows service cannot be correctly installed if only JRE present (errors in service.bat, maybe it fails even with JDK used)
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TOMEE-2712
>                 URL: https://issues.apache.org/jira/browse/TOMEE-2712
>             Project: TomEE
>          Issue Type: Bug
>    Affects Versions: 8.0.0-Final
>         Environment: JAva 11.0.4-10, Tomee 8.0.0-final package "Plus", Windows Server 2012 R2 Datacenter, 64 bit
>            Reporter: Artur Linhart
>            Priority: Major
>              Labels: pull-request-available
>
> In the batch service.bat can be defined explicitly the user JDK/JRE. But if you specify JRE, then the batch crashes installing the service. It happens at least for Java 11.
>  
> Steps to reproduce:
> 1. Put below the comments:
> rem The following line can be used to define a specific jre or jdk path
>  rem set "JAVA_HOME=C:/JDK"
> the line specifying JRE, something like:
>  set "JRE_HOME=D:/Tomee/server-jre"
> 2. call the service installation by calling something like
>  service.bat install my_service_name
> 3. The service.bat batch starts with the installation, but the installation happens only partially, ends with the messages
>  " ...
>  Using Service User: ""
>  Installed, will now configure TomEE
>  11 was unexpected at this time."
> 4. There is still the service installed, but incompletely - there is no "Options" key in the registry folder
>  HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation\Procrun 2.0\my_service_name\Parameters\Java
> created and the service cannot be started through "Services" snap-in of MMC.
> 5. The starting of TomEE (tomcat) service fails with "Error 5: Access is denied." error in the case of the used default "Local Service" account. If you switch to the built-in "Local System" account, then the start crashes with the error "Error 1067: The process terminated unexpectedly."
> The error is in the service.bat behind in the labels ":okHome" and ":gotJreHome" where is missing the resolution of the variable JAVA_MAJOR_VERSION, like it is done behind the label :gotJdkHome where is the setting of the variable done by statement
> {code:java}
> for /f tokens^=2^ delims^=.-_^" %%j in ('"%JAVA_HOME%\bin\java.exe" -fullversion 2^>^&1') do set "JAVA_MAJOR_VERSION=%%j"{code}
> So, workaround for now is, to put following statement also behind the label mentioned above (gotJreHome) immediatelly before the jump 
>  goto okJavaHome on line 91 or similary it suits to the current configuration:
> {code:java}
> for /f tokens^=2^ delims^=.-_^" %%j in ('"%JRE_HOME%\bin\java.exe" -fullversion 2^>^&1') do set "JAVA_MAJOR_VERSION=%%j"
> {code}
> ... but in the case of the guessed JRE this will very probably fail too.
> There is also the another error on the lines 94-97 which might prevent the installation of the service even in the case of the JDK usage, it is:
> {code:java}
> if JAVA_MAJOR_VERSION lss 11 (
>    if not exist "%JAVA_HOME%\jre\bin\java.exe" goto noJavaHome
>    if not exist "%JAVA_HOME%\jre\bin\javaw.exe" goto noJavaHome
> )
> {code}
> should be written like
> {code:java}
> if %JAVA_MAJOR_VERSION*%* lss 11 (
>    if not exist "%JAVA_HOME%\jre\bin\java.exe" goto noJavaHome
>    if not exist "%JAVA_HOME%\jre\bin\javaw.exe" goto noJavaHome
> )
> {code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)