[
https://issues.apache.org/jira/browse/KARAF-3090?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Benjamin Reed updated KARAF-3090:
---------------------------------
Attachment: karaf-2.3.5-startInstance.patch
Turns out the problem is in AdminServiceImpl.java. If the karaf.opts properties
is null *and* $KARAF_OPTS environment variable isn't set, karafOpts ends up
being null, and there is no null-check.
Attached is a one-liner that fixes it. I was gonna update the unit test to
handle this failure, but there's no unit test for startInstance(). ;)
> admin:start fails to start in fresh install
> -------------------------------------------
>
> Key: KARAF-3090
> URL: https://issues.apache.org/jira/browse/KARAF-3090
> Project: Karaf
> Issue Type: Bug
> Components: karaf-instance
> Affects Versions: 2.3.5
> Environment: Ubuntu Linux 14.04 x86_64
> Oracle JDK 1.7.0_60
> Karaf 2.3.5
> Reporter: Benjamin Reed
> Labels: admin:start, instance, karaf
> Attachments: karaf-2.3.5-startInstance.patch
>
>
> When I start with a completely clean Karaf 2.3.5, I am unable to start a
> sub-instance.
> Steps to reproduce:
> {code}ranger@the-slip:/tmp$ tar -xzf apache-karaf-2.3.5.tar.gz
> ranger@the-slip:/tmp$ cd apache-karaf-2.3.5
> ranger@the-slip:/tmp/apache-karaf-2.3.5$ bin/karaf
> __ __ ____
> / //_/____ __________ _/ __/
> / ,< / __ `/ ___/ __ `/ /_
> / /| |/ /_/ / / / /_/ / __/
> /_/ |_|\__,_/_/ \__,_/_/
> Apache Karaf (2.3.5)
> Hit '<tab>' for a list of available commands
> and '[cmd] --help' for help on a specific command.
> Hit '<ctrl-d>' or type 'osgi:shutdown' or 'logout' to shutdown Karaf.
> karaf@root> admin:create minion-test
> Creating new instance on SSH port 8102 and RMI ports 1100/44445 at:
> /tmp/apache-karaf-2.3.5/instances/minion-test
> Creating dir: /tmp/apache-karaf-2.3.5/instances/minion-test/bin
> Creating dir: /tmp/apache-karaf-2.3.5/instances/minion-test/etc
> Creating dir: /tmp/apache-karaf-2.3.5/instances/minion-test/system
> Creating dir: /tmp/apache-karaf-2.3.5/instances/minion-test/deploy
> Creating dir: /tmp/apache-karaf-2.3.5/instances/minion-test/data
> Creating file:
> /tmp/apache-karaf-2.3.5/instances/minion-test/etc/config.properties
> Creating file:
> /tmp/apache-karaf-2.3.5/instances/minion-test/etc/jre.properties
> Creating file:
> /tmp/apache-karaf-2.3.5/instances/minion-test/etc/custom.properties
> Creating file:
> /tmp/apache-karaf-2.3.5/instances/minion-test/etc/java.util.logging.properties
> Creating file:
> /tmp/apache-karaf-2.3.5/instances/minion-test/etc/org.apache.felix.fileinstall-deploy.cfg
> Creating file:
> /tmp/apache-karaf-2.3.5/instances/minion-test/etc/org.apache.karaf.log.cfg
> Creating file:
> /tmp/apache-karaf-2.3.5/instances/minion-test/etc/org.apache.karaf.features.cfg
> Creating file:
> /tmp/apache-karaf-2.3.5/instances/minion-test/etc/org.ops4j.pax.logging.cfg
> Creating file:
> /tmp/apache-karaf-2.3.5/instances/minion-test/etc/org.ops4j.pax.url.mvn.cfg
> Creating file:
> /tmp/apache-karaf-2.3.5/instances/minion-test/etc/startup.properties
> Creating file:
> /tmp/apache-karaf-2.3.5/instances/minion-test/etc/users.properties
> Creating file:
> /tmp/apache-karaf-2.3.5/instances/minion-test/etc/keys.properties
> Creating file:
> /tmp/apache-karaf-2.3.5/instances/minion-test/etc/system.properties
> Creating file:
> /tmp/apache-karaf-2.3.5/instances/minion-test/etc/org.apache.karaf.shell.cfg
> Creating file:
> /tmp/apache-karaf-2.3.5/instances/minion-test/etc/org.apache.karaf.management.cfg
> Creating file: /tmp/apache-karaf-2.3.5/instances/minion-test/bin/karaf
> Creating file: /tmp/apache-karaf-2.3.5/instances/minion-test/bin/start
> Creating file: /tmp/apache-karaf-2.3.5/instances/minion-test/bin/stop
> karaf@root> admin:status minion-test
> Stopped
> karaf@root> log:set DEBUG
> karaf@root> admin:start minion-test
> karaf@root> admin:status minion-test
> Stopped{code}
> The log contains this message:
> {code}2014-07-01 10:34:43,620 | DEBUG | l Console Thread | AdminServiceImpl
> | dmin.internal.AdminServiceImpl$6 410 | 27 -
> org.apache.karaf.admin.core - 2.3.5 | Starting instance minion-test with
> command: "/usr/lib/jvm/java-7-oracle/jre/bin/java" -server -Xmx512M
> -Dcom.sun.management.jmxremote null
> -Djava.util.logging.config.file="/tmp/apache-karaf-2.3.5/instances/minion-test/etc/java.util.logging.properties"
>
> -Djava.endorsed.dirs="/usr/lib/jvm/java-7-oracle/jre/jre/lib/endorsed:/usr/lib/jvm/java-7-oracle/jre/lib/endorsed:/tmp/apache-karaf-2.3.5/lib/endorsed"
>
> -Djava.ext.dirs="/usr/lib/jvm/java-7-oracle/jre/jre/lib/ext:/usr/lib/jvm/java-7-oracle/jre/lib/ext:/tmp/apache-karaf-2.3.5/lib/ext"
> -Dkaraf.home="/tmp/apache-karaf-2.3.5"
> -Dkaraf.base="/tmp/apache-karaf-2.3.5/instances/minion-test"
> -Dkaraf.data="/tmp/apache-karaf-2.3.5/instances/minion-test/data"
> -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath
> "/tmp/apache-karaf-2.3.5/lib/org.apache.servicemix.specs.activator-2.4.0.jar:/tmp/apache-karaf-2.3.5/lib/org.apache.servicemix.specs.locator-2.4.0.jar:/tmp/apache-karaf-2.3.5/lib/karaf-jaas-boot.jar:/tmp/apache-karaf-2.3.5/lib/karaf.jar"
> org.apache.karaf.main.Main{code}
> If I try to run that command on the command-line, I get the error:
> {code}Error: Could not find or load main class null{code}
> Note the "null" after the {code}-Dcom.sun.management.jmxremote{code} in the
> command-line it's trying to send; it appears that javaOpts is somehow ending
> up with some null junk in it when it attempts to create the call to start the
> sub-karaf.
> I tried digging into the code a bit but I can't figure out which part is
> responsible for actually creating those javaOpts.
--
This message was sent by Atlassian JIRA
(v6.2#6252)