You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Jean-Baptiste Onofré (JIRA)" <ji...@apache.org> on 2015/02/05 13:57:34 UTC
[jira] [Commented] (KARAF-3494) client should not fail if it can't
read etc/org.apache.karaf.shell.cfg file
[ https://issues.apache.org/jira/browse/KARAF-3494?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14307173#comment-14307173 ]
Jean-Baptiste Onofré commented on KARAF-3494:
---------------------------------------------
Actually, Karaf behaves correctly there, but the problem is that users may want to "externalize" some parameters in etc/config.properties.
For instance, in etc/org.apache.karaf.shell.cfg:
{code}
sshPort = ${isb.sshPort}
{code}
with etc/custom.properties containing:
{code}
isb.sshPort=8101
{code}
In that case, the client fails with:
{code}
D:\work\servicemix\isb-smx-5.3.0\bin>client.bat -a 8101 -u smx -p smx
Exception in thread "main" java.lang.NumberFormatException: For input string: "${isb.sshPort}"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:481)
at java.lang.Integer.parseInt(Integer.java:527)
at org.apache.karaf.client.Main.main(Main.java:58)
{code}
Client should also loads etc/config.properties (and so etc/custom.properties) or exclude ${.*} pattern.
> client should not fail if it can't read etc/org.apache.karaf.shell.cfg file
> ---------------------------------------------------------------------------
>
> Key: KARAF-3494
> URL: https://issues.apache.org/jira/browse/KARAF-3494
> Project: Karaf
> Issue Type: Bug
> Components: karaf-shell
> Affects Versions: 3.0.1, 3.0.2, 3.0.3, 2.4.1
> Reporter: Jean-Baptiste Onofré
> Assignee: Jean-Baptiste Onofré
> Fix For: 4.0.0, 2.4.2, 3.0.4
>
>
> The bin/client tries to read etc/org.apache.karaf.shell.cfg file to automatically get the SSH port number:
> {code}
> Properties shellCfg = loadProps(new File(System.getProperty("karaf.etc"), "org.apache.karaf.shell.cfg"));
> String host = shellCfg.getProperty("sshHost", "localhost");
> int port = Integer.parseInt(shellCfg.getProperty("sshPort", "8101"));
> {code}
> Unfortunately, if etc/org.apache.karaf.shell.cfg file is not present or not readable, the client fails to start. We should add a try/catch statement and fallback to the default 8101 port number.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)