[
https://issues.apache.org/jira/browse/KARAF-2270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13751877#comment-13751877
]
Opher Shachar commented on KARAF-2270:
--------------------------------------
Hello Jean,
It seems to me that the change to
[karaf-service|http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/shell/wrapper/src/main/resources/org/apache/karaf/shell/wrapper/unix/karaf-service?r1=1517771&r2=1517770&pathrev=1517771]
is functionally equivalent to the previous version:
- If {{JAVA_HOME}} environment variable is set (eg. to the system default JDK
since the script is invoked by {{init}}) then the check {{[ -z $JAVA_HOME ]}}
fails and the script wont change {{JAVA_HOME}} environment variable.
- If {{JAVA_HOME}} environment variable is unset the script will set it to the
system default JDK (or JRE).
- If no system default {{java}} is installed the script leaves {{JAVA_HOME}}
environment variable unset, causing *only in this scenario* {{wrapper.conf}}'s
default {{JAVA_HOME}} to kick in.
...and so it doesn't fix the issue in your comment:
bq. I reopen this issue because the karaf-service script ignores the JAVA_HOME
define in the wrapper.conf file and always override it using readlink.
Consider the case where there is a system default JDK installed that is not
compatible with Karaf (eg. JDK 1.5 installed as a system default).
Since the script is invoked by {{init}} there is no outside way to set
JAVA_HOME to a compatible JDK 1.6 installed somewhere in the system (that was
set in {{wrapper.conf}} by the install process). The result will always be that
the wrapper tries to invoke Karaf with a JDK 1.5 and fails.
Perhaps you could consider changing {{wrapper.conf}}'s behavior to *set* the
JDK home *ignoring* JAVA_HOME environment variable --- by
changing:{code}set.default.JAVA_HOME=${java.home}{code} to
{code}set.JAVA_HOME=${java.home}{code}
or loosing the code in the service-script that mangles JAVA_HOME,
or documenting that hand editing the service-script is necessary in such a
scenario.
> Service wrapper assumes java is on system path
> ----------------------------------------------
>
> Key: KARAF-2270
> URL: https://issues.apache.org/jira/browse/KARAF-2270
> Project: Karaf
> Issue Type: Bug
> Components: karaf-os-integration
> Affects Versions: 2.3.1
> Environment: windows, linux
> Reporter: Brian Emond
> Assignee: Jean-Baptiste Onofré
> Fix For: 2.3.3, 2.4.0, 3.0.0
>
>
> In the service wrapper conf file, the wrapper.java.command property points
> directly to java, and not to a fully qualified path to java. This assumes
> that java is on the system path, which it may not. The value should be:
> wrapper.java.command=%JAVA_HOME%/bin/java
> This ensures the wrapper is using the java executable established from
> setting the JAVA_HOME variable under the Wrapper Properties a few lines up in
> the conf file.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira