Configuring Jenkins in Linux without Tomcat or Apache (standalone service) With Borlands StarTeam

3.2k views Asked by At

I have read through the documentation on the jenkins page as well as a few other message boards and they all seem to provide their tutorials using Tomcat (ewwww)!!!. My task is to provide Jenkins as a stand alone service for maintainability reasons. So far I have set HUDSONHOME, CLASSPATH, and JAVA_HOME. My version of java is

java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.7) (rhel-1.39.1.9.7.el6-x86_64)
OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)

and I have a script in /etc/profile.d that does the following:

JAVA_HOME=/usr/java;
JRE_HOME=/usr/java/jre/bin;
if [ "${CLASSPATH}" == "" ]; then
CLASSPATH=/var/lib/jenkins/war/WEB-INF;
HUDSON_HOME=/var/lib/jenkins/war/WEB-INF;
else
CLASSPATH=${CLASSPATH}:/var/lib/jenkins/war/WEB-INF;
HUDSON_HOME=/var/lib/jenkins/war/WEB-INF;
fi
PATH=${PATH}:${JAVA_HOME}/bin:/opt/StarTeamCP_2009/bin:/opt/QtSDK/Desktop/Qt/474/gcc/bin:/opt/QtSDK/QtCreator/bin/:${CLASSPATH}:${HUDSON_HOME};
export JAVA_HOME;
export PATH;
export CLASPATH;

Looking in /etc/passwd, Jenkins default shell is bash so no need for a csh version of the script. As a user I can login as all variables are set correctly. I installed the Jenkins RPM from their homepage RPM link.

The error I am getting from Jenkins output window is:

FATAL: com/starbase/starteam/Folder
java.lang.NoClassDefFoundError: com/starbase/starteam/Folder
    at hudson.plugins.starteam.StarTeamSCM.checkout(StarTeamSCM.java:127)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1195)
    at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:576)
    at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:465)
    at hudson.model.Run.run(Run.java:1404)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:238)
Caused by: java.lang.ClassNotFoundException: com.starbase.starteam.Folder
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
    ... 8 more

What am I missing?


As for your "class not found" exception, you're pulling in libraries that aren't part of Tomcat or Jenkins, and they apparently depend on items that are also not in Tomcat or Jenkins. This leads to the question, "Why are you populating your environment with borland libraries if you want to run a non-borland application?"

In response to this, I am using the Starteam Plugin as part of Jenkins. Jenkins needs to know the definitions of the StarTeam classes contained within Borlands .jar files.

1

There are 1 answers

2
Edwin Buck On

--- Edited in response to update ---

Ok, you need the star team libraries for the Jenkins plugin. That's understood. Thank you for the clarification.

Since you are using the RPM version of Jenkins, you are using Tomcat (it's a dependency). Whether you attempt to run Jenkins without Tomcat in the future (and how you go about it) is your ultimate choice; however, you might find that Tomcat adds a lot more value than you think.

The problem you currently are encountering has to do with Tomcat's enforcement of secure class loading. You can't assume that CLASSPATH entries for Tomcat are available to the internal web applications. There are good reasons for this.

Since Tomcat differentiates between the two (container / application), applications can select what they need independently of each other. The plus side is that applications don't have to be rewritten or tweaked to use the same version of a library (jar file). The minus side is that classpaths, etc. need to be configured on a per webapp basis.

My guess is that somewhere in the Jenkins documentation is a item that mentions copying (or linking) in the relevant library somewhere in $(webapps)/jenkins/WEB-INF/lib. That said, if there is any Jenkins-starteam documentation to be had, I'd refer to it first.

Good luck.

--- Original post follows ---

Jenkens is a Java web application. Tomcat is a Java web server. It's going to be very difficult to run a Java web application outside of a Java web server.

The web server opens the port to accept web requests, and then routes processed forms of those requests to the web application. It is generally not possible to run an application in stand-alone mode as web applications know little to nothing about the details of the HTTP protocol, network sockets, session tracking, authentication, etc.

Sometimes is is possible to embed a small Java web server in the application (to provide quick deployment); however, that's not really a "more supportable" environment, as the second you need to run two "items" on the same machine, you run into issues of embedded configurations fighting for the same ports. This involves "unpacking" the application, making internal changes, and repacking it. Any "update" will completely reset the site-specific customization.

The only "ewwww" part about Tomcat is likely that you're uncomfortable with it. That's ok, everyone starts that way.

As for your "class not found" exception, you're pulling in libraries that aren't part of Tomcat or Jenkins, and they apparently depend on items that are also not in Tomcat or Jenkins. This leads to the question, "Why are you populating your environment with borland libraries if you want to run a non-borland application?"