使用 Borlands StarTeam 在没有 Tomcat 或 Apache(独立服务)的 Linux 中配置 Jenkins
我已经阅读了 jenkins 页面上的文档以及其他一些留言板,他们似乎都提供了使用 Tomcat 的教程(ewwww)!!!。出于可维护性的原因,我的任务是提供 Jenkins 作为独立服务。到目前为止,我已经设置了 HUDSONHOME、CLASSPATH 和 JAVA_HOME。我的 java 版本是
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)
,我在 /etc/profile.d 中有一个脚本执行以下操作:
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;
查看 /etc/passwd,Jenkins 默认 shell 是 bash,因此不需要 csh 版本的脚本。作为用户,我可以登录,因为所有变量都设置正确。我从他们的主页安装了 Jenkins RPM RPM 链接< /a>.
我从 Jenkins 输出窗口得到的错误是:
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
我缺少什么?
至于“找不到类”异常,您正在拉入不属于 Tomcat 或 Jenkins 的库,并且它们显然依赖于也不属于 Tomcat 或 Jenkins 的项目。这就引出了一个问题:“如果您想运行非 borland 应用程序,为什么要使用 borland 库填充您的环境?”
为此,我使用 Starteam 插件作为 Jenkins 的一部分。 Jenkins 需要了解 Borlands .jar 文件中包含的 StarTeam 类的定义。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
--- 为响应更新而编辑 ---
好的,您需要 Jenkins 插件的明星团队库。就这么理解了。谢谢您的澄清。
由于您使用的是 Jenkins 的 RPM 版本,因此您使用的是 Tomcat(它是一个依赖项)。将来是否尝试在没有 Tomcat 的情况下运行 Jenkins(以及如何进行)是您的最终选择;然而,您可能会发现 Tomcat 增加的价值比您想象的要多得多。
您当前遇到的问题与 Tomcat 强制执行安全类加载有关。您不能假设 Tomcat 的 CLASSPATH 条目可用于内部 Web 应用程序。这是有充分理由的。
由于 Tomcat 区分了两者(容器/应用程序),因此应用程序可以彼此独立地选择所需的内容。优点是应用程序不必重写或调整即可使用相同版本的库(jar 文件)。不利的一面是类路径等需要在每个 web 应用程序的基础上进行配置。
我的猜测是,Jenkins 文档中的某处提到了在 $(webapps)/jenkins/WEB-INF/lib 中的相关库中复制(或链接)。也就是说,如果有任何 Jenkins-starteam 文档,我会首先参考它。
祝你好运。
--- 原帖如下 ---
Jenkens 是一个 Java Web 应用程序。 Tomcat 是一个 Java Web 服务器。在 Java Web 服务器之外运行 Java Web 应用程序将非常困难。
Web 服务器打开端口以接受 Web 请求,然后将这些请求的已处理形式路由到 Web 应用程序。通常不可能以独立模式运行应用程序,因为 Web 应用程序对 HTTP 协议、网络套接字、会话跟踪、身份验证等细节知之甚少。
有时可以嵌入小型 Java Web 服务器在应用程序中(提供快速部署);然而,这并不是真正的“更可支持”的环境,因为当您需要在同一台计算机上运行两个“项目”时,您会遇到嵌入式配置争夺相同端口的问题。这涉及“解包”应用程序、进行内部更改以及重新打包。任何“更新”都将完全重置特定于站点的自定义。
关于 Tomcat 的唯一“ewwww”部分可能是您对它感到不舒服。没关系,每个人都是这样开始的。
至于“未找到类”异常,您正在拉入不属于 Tomcat 或 Jenkins 的库,并且它们显然依赖于也不属于 Tomcat 或 Jenkins 的项目。这就引出了一个问题:“如果您想运行非 borland 应用程序,为什么要在您的环境中填充 borland 库?”
--- 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?"