从Jenkins在控制台上启动Tomcat [英] Start Tomcat on Console from Jenkins

查看:1689
本文介绍了从Jenkins在控制台上启动Tomcat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个批处理文件,它按如下方式启动Tomcat(在Windows上运行时工作正常)

I have a batch file which start Tomcat as follows (when running it on Windows it works fine)

...
start C:\Users\root\tomcat\tomcat2\bin\startup.bat

从Jenkins调用批处理文件,如下所示

The batch file is called from Jenkins as follows

我在构建结束时在Jenkins Consol中出现此错误

I have this error in the Jenkins Consol at the end of the build

D:\jenkins\workspace\Start 3T2>start C:\Users\root\tomcat\tomcat2\bin\startup.bat 
Process leaked file descriptors. See http://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build for more information
Finished: SUCCESS

当我检查任务管理器时,我看到服务器已启动但在后台运行。我实际上需要在控制台中启动Tomcat。

When I check the task manager I see that the server is started but in background. I need actually to start Tomcat it in the Console.

这就是我所做的:


  • 我在jenkins-slave.xml
    中添加 -Dhudson.util.ProcessTree.disable = true 用于启动jenkins slave服务。

  • 我在startup.bat中添加了设置BUILD_ID = dontkillme来阻止Jenkins从
    到最后停止这个过程。

  • I added -Dhudson.util.ProcessTree.disable=true in jenkins-slave.xml used to start jenkins slave service.
  • I added set BUILD_ID=dontkillme in startup.bat to stop Jenkins from stopping the process in the end.

我认为Tomcat最终会正确启动,但不会在Console中启动。我正在运行Windows 2012服务器/ Tomcat7 / Jenkins 1.578。

I think Tomcat start correctly in the end but not in Console. I'm running Windows 2012 server/Tomcat7/Jenkins 1.578.

如何在控制台中启动Tomcat?

Any idea on how to start Tomcat in a Console ?

推荐答案

AFAIK,如果您尝试在Jenkins配置为 service 的给定计算机上启动Tomcat控制台,它将无法运行。要使其工作,您必须使用 JNLP 连接到给定的计算机。如果它是独立系统并且您想要使用Jenkins打开Tomcat控制台,则必须在同一台计算机上设置 Slave 并且在启动方法部分中也使用JNLP(通过Java Web Start启动从属代理) >詹金斯>管理Jenkins>管理节点>从节点的配置页面。

AFAIK, if you're trying to start Tomcat console on a given machine which has Jenkins configured as service, it will not work. To make it work, you will have to connect to the given machine using JNLP. In case it's a standalone system and you want to open a Tomcat console using Jenkins, you will have to set up a Slave on the same machine and that too using JNLP (Launch slave agents via Java Web Start) in the Launch method section in Jenkins > Manage Jenkins > Manage Nodes > Slave Node's Configure page.

您可以使用下面显示的任何方法连接到从站。配置从属节点后,您将看到以下选项,然后单击保存。我从Win命令提示符运行突出显示的命令。在我的设置中,我在同一台机器上配置了Master和Slave。我有Win 7 Professional,64位笔记本电脑。

You can connect to the slave using any of the methods shown below. You will see the below option as soon as you configure the slave node and click Save. I ran the highlighted command from the Win command prompt. In my set up, i had configured Master and Slave on the same machine. I have Win 7 Professional, 64-bit laptop.

运行该命令后,您将看到一个小窗口,该窗口将弹出并显示已连接消息,如下所示:

Once you run the command, you will see a small window that will pop-up and will display 'Connected' message as shown below:

至少对我来说,我检查了 hudson.util.ProcessTree.disable = true & BUILD_ID 不需要参数。我唯一需要的是确保未设置以下属性: HUDSON_SERVER_COOKIE

At least for me, i checked that hudson.util.ProcessTree.disable=true & BUILD_ID parameters were not required. The only thing that i needed was to make sure that the following property is unset: HUDSON_SERVER_COOKIE

PS:您可能必须确保重启时启动JNLP。启动脚本会这样做。此外,确保您的项目/作业绑定到使用 JNLP 机制运行的给定从站。

P.S.: You might have to make sure to start JNLP on reboot. A start-up script will do that. Also, ensure that your project/job is tied to the given slave which is running using JNLP mechanism.

这篇关于从Jenkins在控制台上启动Tomcat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆