It's all about the answers!

Ask a question

Problem running JBE as Linux service


Cliff Gardiner (921033) | asked Sep 25 '13, 12:38 p.m.
Hi all,

I followed the instructions at https://jazz.net/wiki/bin/view/Main/JbeAsALinuxService for guidance but can't get this to work.  I am running RTC 4.0.3 in a Centos 6 virtual image (LXC) under a Ubuntu host.  This is a private setup for testing so I'm not bothered about security.

RTC runs under the user 'rtcadmin' and I can run the build engine at the command line as the rtcadmin user.  The JazzTeamServer file tree is owned by rtcadmin:rtcadmin, but the TeamConcert and TeamConcertBuild trees are owned by root:root.

I want to run the build engine as rtcadmin but connecting to RTC as another user, 'rtcbuild', so created this user locally and added it to the rtcadmin group as well as creating it in RTC itself and applying the buildsystem licence.  Builds will include those for WMB so I have amended the launch-jbe and jbe scripts as follows:

jbe

#!/bin/sh
#
# jbe:  Jazz Build Engine
#

# Source Red Hat function library.
. /etc/rc.d/init.d/functions;

repository='https://localhost:9443/ccm';
toolkitHome=/opt/IBM/TeamConcertBuild;
jazzHome=/opt/IBM/JazzTeamServer;
clientHome=/opt/IBM/TeamConcert;
engine=JBE;
buildWorkspace=/home/rtcadmin/workspace;
mqsiHome=/opt/ibm/mqsi/8.0.0.2;

start(){
    echo -n $"Starting jbe";
    echo "" > ${jazzHome}/server/logs/build_${engine}.log;
    chmod 664 ${jazzHome}/server/logs/build_${engine}.log;
    daemon --user rtcadmin "/home/rtcadmin/launch-jbe.sh $toolkitHome $repository $engine $jazzHome $clientHome $buildWorkspace $mqsiHome &";
    touch /var/lock/subsys/jbe;
    echo;
}

stop(){
    echo -n $"Shutting down jbe";
    kill $(ps -o pid= -s $(ps -o sess --no-heading --pid $(pgrep jbe)));
    rm -f  /var/lock/subsys/jbe;
    echo;
}

case "$1" in
      start)
            start;
            ;;
      stop)
            stop;
            ;;
      restart)
            stop;
            start;
            ;;
      *)
       echo $"Usage: $0 {start|stop|restart}";
       exit 1;
esac
exit 0;

launch-jbe.sh

toolkitHome=$1;
repository=$2;
engineId=$3;
rtcHome=$4;
clientHome=$5;
buildWorkspace=$6;
mqsiHome=$7;

buildUser=rtcbuild;
buildUserPwd=rtcbuild;

umask 0022;
. ${mqsiHome}/bin/mqsiprofile;
$toolkitHome/buildsystem/buildengine/eclipse/jbe -vm $clientHome/jdk/bin/java -repository $repository \
    -userId $buildUser -pass $buildUserPwd -engineId $engineId -data $buildWorkspace \
    - sleeptime 10 -verbose &> ${rtcHome}/server/logs/build_${engineId}.log;

I start the service, the three tasks start, and the log file shows the engine waiting for build requests.  When I request a build, I see this in the log:

Supplied arguments:
-repository https://localhost:9443/ccm -userId rtcbuild -pass ***** -engineId JBE -sleeptime 10 -verbose
Java Version:
JRE 1.6.0 IBM J9 2.4 Linux amd64-64 jvmxa6460sr13-20130114_134867 (JIT enabled, AOT enabled)
J9VM - 20130114_134867
JIT  - r9_20130108_31100
GC   - 20121212_AA
Engine Bundle Version:
com.ibm.team.build.engine, 3.0.500.v20130502_0139
2013-09-25 11:11:48 [Jazz build engine] Running build loop...
2013-09-25 11:11:50 [Jazz build engine] Not using a proxy to reach https://localhost:9443/ccm
2013-09-25 11:11:52 [Jazz build engine] Searching for build request...
2013-09-25 11:11:53 [Jazz build engine] No requests found.
2013-09-25 11:11:53 [Jazz build engine]
2013-09-25 11:11:53 [Jazz build engine] Sleeping for 10 seconds...
2013-09-25 11:12:03 [Jazz build engine] Searching for build request...
2013-09-25 11:12:03 [Jazz build engine] No requests found.
2013-09-25 11:12:03 [Jazz build engine]
2013-09-25 11:12:03 [Jazz build engine] Sleeping for 10 seconds...
2013-09-25 11:12:13 [Jazz build engine] Searching for build request...
2013-09-25 11:12:14 [Jazz build engine] Build "null" complete.
Exception in thread "Thread-7" java.lang.NullPointerException
    at com.ibm.team.build.internal.engine.BuildLoop.printToBuildLog(BuildLoop.java:1539)
    at com.ibm.team.build.internal.engine.BuildLoop.printSubstitutedProperties(BuildLoop.java:624)
    at com.ibm.team.build.internal.engine.BuildLoop.performPropertyVariableSubstitutions(BuildLoop.java:594)
    at com.ibm.team.build.internal.engine.BuildLoop.runLoop(BuildLoop.java:472)
    at com.ibm.team.build.internal.engine.BuildLoop$1.run(BuildLoop.java:211)
    at java.lang.Thread.run(Thread.java:738)
2013-09-25 11:12:14 [Jazz build engine] Interrupt of participant complete

The script I can use to successfully run and use the build engine at the command line is this:

#!/bin/sh
#
. /opt/ibm/mqsi/8.0.0.2/bin/mqsiprofile
/opt/IBM/TeamConcertBuild/buildsystem/buildengine/eclipse/jbe -vm /opt/IBM/TeamConcert/jdk/bin/java -repository https://localhost:9443/ccm -engineId JBE -userId rtcbuild -pass rtcbuild -sleeptime 10 > jbe.txt

So, I'm baffled.  I suspect there's some magic I've missed regarding what's running under whose credentials or something but I'm getting fed up with banging my head against the wall.

Can anyone help?

Thanks -
Cliff

3 answers



permanent link
Cliff Gardiner (921033) | answered Oct 01 '13, 1:00 p.m.
As per my comment!

permanent link
Krzysztof Kaźmierczyk (7.4k373103) | answered Sep 26 '13, 2:20 a.m.
Hi Cliff,
I found similar errors in jazz.net resources:

https://jazz.net/forum/questions/118516/jazz-build-engine-fails-in-printtobuildlog-and-crashes-when-receiving-build-request - Solution: remove the .metadata directory and start JBE again.

https://jazz.net/wiki/bin/view/Main/OrchestraterDevEnv - the problem may be caused by the build engine trying to write a temporary file to a read only directory. To fix this problem, open the run configuration and on the Arguments tab change the Working directory to a writeable directory.

Let us know if it helps for you.

permanent link
Cliff Gardiner (921033) | answered Oct 01 '13, 12:59 p.m.
Hi Krzysztof,
thanks for your response and I finally resolved the problem. 

I tried the approaches you suggested, and more besides but always got the same result.  I removed rtcadmin from the picture; I changed the ownership of the buildsystem tree to rtcbuild:rtcbuild, ran the service with --user rtcbuild, ensured rtcbuild could write to the working directory, log files, etc and again could successfully run the build engine from the command line as rtcbuild. 

I couldn't tell what file the build engine was trying to write or where, but the answer was simply to add a line to the jbe script to cd to the build user's home directory before starting the daemon.

Regards,
Cliff

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.