puppet-zookeeper
puppet-zookeeper copied to clipboard
Refactor CLASSPATH configuration
Currently the CLASSPATH environment variable is reconfigured at multiple places, custom systemd config looks like this:
ExecStart=/bin/sh -c 'set -x; \
. /etc/zookeeper/conf/environment; \
CLASSPATH="/usr/lib/zookeeper/zookeeper.jar:/usr/lib/zookeeper/lib/*:$CLASSPATH"; \
CLASSPATH="$([ -r /usr/lib/zookeeper/bin/zkEnv.sh ] && . /usr/lib/zookeeper/bin/zkEnv.sh ; echo $CLASSPATH)"; \
mkdir -p /var/log/zookeeper; \
$JAVA "-Dzookeeper.log.dir=/var/log/zookeeper" "-Dzookeeper.root.logger=$ZOO_LOG4J_PROP" -cp "$CLASSPATH" $JAVA_OPTS "$ZOOMAIN" "$ZOOCFG"'
in /etc/zookeeper/conf/environment file is CLASSPATH set only for archive install method:
<% if scope.lookupvar('zookeeper::install_method') != 'archive' -%>
# TODO this is really ugly
# How to find out, which jars are needed?
# seems, that log4j requires the log4j.properties file to be in the classpath
CLASSPATH="$ZOOCFGDIR:/usr/share/java/jline.jar:/usr/share/java/log4j-1.2.jar:/usr/share/java/xercesImpl.jar:/usr/share/java/xmlParserAPIs.jar:/usr/share/java/netty.jar:/usr/share/java/slf4j-api.jar:/usr/share/java/slf4j-log4j12.jar:/usr/share/java/zookeeper.jar:$CLASSPATH"
<% end -%>
Each OS might have slightly different CLASSPATH:
- Debian:
/usr/share/java/zookeeper.jar - CentOS:
/usr/lib/zookeeper/lib/*:/usr/lib/zookeeper/zookeeper.jar
Originally reported in #103.
Any progress on this issue? It's currently hosing me on centos 7 it appears. Error: Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain
Is the only alternative to use archive?
@matthewmrichter and anyone else struggling to get this working on centos 7 I got a workaround from here:
https://github.com/deric/puppet-zookeeper/issues/103
Pass in this parameter into the module class: java_opts => '-cp "/usr/lib/zookeeper/lib/*:/usr/lib/zookeeper/zookeeper.jar"'
It adds /usr/lib/zookeeper/lib/*:/usr/lib/zookeeper/zookeeper.jar to the end of the class path which is what it needs to work on centos 7.