Ok I figured it out. After it's finished building, Jenkins will destroy 
every process started during that build process. That is a bummer for those 
people like me that want to start Tomcat as part of the build process. If 
you're running Jenkins through Tomcat 7, you can disable it's auto kill 
functionality by adding this line to catalina.sh:

BUILD_ID=dontkillme

That will override the PID Jenkins keeps track of when it starts Tomcat, 
and thus Jenkins won't kill it. Hats off to you guys for your suggestions. 

Thanks for all your help!

Pedro

On Monday, August 6, 2012 11:30:12 AM UTC-7, Pedro Perez wrote:
>
> I tried both suggestions, the deploy plugin works great for me, as well as 
> using an ANT script to deploy it...the only problem is I need to shut 
> Tomcat down completely, manually place the .war, and then start up 
> Tomcat--otherwise Tomcat will remove some DB configuration files i keep in 
> /conf/Catalina/localhost. I wish there was a good way to stop/start/deploy 
> applications from Jenkins (the deploy plugin is nice, but it only 
> deploys...no controls to start and stop). 
>
> I'd be happy if Jenkins would stop automatically killing the Tomcat 
> process I start during the build, but I'm not sure how to disable the 
> auto-kill feature of jenkins when running Jenkins through the Tomcat 
> container...does anybody know how to do this?
>
> P
>
> On Monday, August 6, 2012 10:40:36 AM UTC-7, Jeff Vincent wrote:
>>
>> I tried the Jenkins deploy plugin but it wouldn't work with Tomcat 7 for 
>> some reason.  Maybe I missed something, but for my Maven projects, just 
>> ended up using the maven-tomcat7-plugin in the POM.
>>
>> On Mon, Aug 6, 2012 at 11:34 AM, Chris Marks <[email protected]>wrote:
>>
>>> You might also look at the deploy plugin. It creates a post-build step 
>>> that can remotely deploy a war to multiple containers including Tomcat. 
>>>
>>> Topher
>>> On Aug 6, 2012 12:30 PM, "Jeff" <[email protected]> wrote:
>>>
>>>>
>>>> http://tomcat.apache.org/tomcat-5.5-doc/manager-howto.html#Executing_Manager_Commands_With_Ant
>>>>  
>>>>
>>>> In the <$TOMCAT_HOME>/lib folder there should be a JAR called 
>>>> catalina-ant.jar.  Make sure it is in your ANT classpath.  Import the ant 
>>>> tasks in your ant script:
>>>>
>>>> <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"/> 
>>>> <taskdef name="list" classname="org.apache.catalina.ant.ListTask"/> 
>>>> <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"/> 
>>>> <taskdef name="resources" 
>>>> classname="org.apache.catalina.ant.ResourcesTask"/> 
>>>> <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"/> 
>>>> <taskdef name="start" classname="org.apache.catalina.ant.StartTask"/> 
>>>> <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"/> 
>>>> <taskdef name="undeploy" 
>>>> classname="org.apache.catalina.ant.UndeployTask"/>
>>>>
>>>>
>>>> Then call it:
>>>>
>>>> <target name="deploy_dev" description="Deploy the WAR to Tomcat"> 
>>>>   <*deploy *
>>>>       path="/${app.name}" 
>>>>       username="${tomcat.dev.username}" 
>>>>       war="file:${package.name}/${war.build.dir}/${app.name}.war" 
>>>>       password="${tomcat.dev.pwd}" 
>>>>       url="${tomcat.dev.url}"
>>>>   /> 
>>>> </target>
>>>>
>>>>
>>>> On Mon, Aug 6, 2012 at 11:04 AM, Pedro Perez <[email protected]>wrote:
>>>>
>>>>> Thanks for your reply ... I actually am using different Tomcat 
>>>>> deployments for Jenkins and my other app...my difficulty was in disabling 
>>>>> the process killer from Jenkins when Jenkins is run through Tomcat (there 
>>>>> are lots of instructions on how to disable the process killer when 
>>>>> Jenkins 
>>>>> is run as a java process without Tomcat). 
>>>>>
>>>>> I should look into that ANT task for deploying a webapp without 
>>>>> stopping/starting Tomcat...I don't know much about how to set that up 
>>>>> however.
>>>>>
>>>>> Thanks!
>>>>> P
>>>>>
>>>>>
>>>>> On Monday, August 6, 2012 9:50:04 AM UTC-7, Jeff Vincent wrote:
>>>>>>
>>>>>> I'm a relative n00b to Jenkins but if I were you, I wouldn't run your 
>>>>>> application on the same tomcat instance.  You are making your life 
>>>>>> harder. 
>>>>>>  Why not create another instance for deploying/testing the app?  You can 
>>>>>> run multiple versions and/or instances of tomcat on different ports, run 
>>>>>> one in a VM or on another system.
>>>>>>
>>>>>> Regardless, tomcat can undeploy/redeploy an application without 
>>>>>> stopping.  There is an ant Task for tomcat to allow deploying 
>>>>>> applications 
>>>>>> via the management API that do not require stopping or starting tomcat 
>>>>>> or 
>>>>>> affecting jenkins....unless it blows up or consumes memory, in which 
>>>>>> case 
>>>>>> it will mess up all applications running in that instance and kill your 
>>>>>> build/test processes anyway...so again, I wouldn't do it that way.
>>>>>>
>>>>>> Also if you were using Maven to build, there is a plugin that allows 
>>>>>> you to start a new tomcat instance for testing then shuts it down 
>>>>>> afterward.  I've not used it though.  There could be something similar 
>>>>>> for 
>>>>>> ANT.
>>>>>>
>>>>>> On Mon, Aug 6, 2012 at 10:20 AM, Pedro Perez <[email protected]>wrote:
>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I'm new to Jenkins and so far I love it...but I have an issue 
>>>>>>> integrating with Tomcat. I have Jenkins stopping and starting Tomcat 
>>>>>>> via 
>>>>>>> ant script. However I've found that Jenkins process-killer shuts down 
>>>>>>> tomcat for me after it's finished. I've read 
>>>>>>> https://wiki.jenkins-ci.**org/display/JENKINS/**ProcessTreeKiller<https://wiki.jenkins-ci.org/display/JENKINS/ProcessTreeKiller>
>>>>>>>  and 
>>>>>>> have tried to disable it, however I run Jenkins through Tomcat, and I'm 
>>>>>>> not 
>>>>>>> sure how to disable the process killer when Jenkins is run as a simple 
>>>>>>> web 
>>>>>>> app on Tomcat 7. I tried to simply override the BUILD_ID variable like 
>>>>>>> this:
>>>>>>>
>>>>>>> $BUILD_ID=dontKillMe
>>>>>>>
>>>>>>> to no avail. Even if that worked though, I'm wondering if there is a 
>>>>>>> "cleaner" solution to starting and stopping Tomcat with Jenkins. When 
>>>>>>> using 
>>>>>>> ANT to start/stop it usually works, but not 100% every time. I've read 
>>>>>>> about a tomcat plugin for Jenkins, but I think it doesn't stop/start 
>>>>>>> Tomcat 
>>>>>>> in the order I need it...basically my build script does a code 
>>>>>>> checkout, 
>>>>>>> compile, stop tomcat, replace war, start tomcat, run tests against 
>>>>>>> newly 
>>>>>>> deployed web app. 
>>>>>>>
>>>>>>> Does anybody know the "correct" way to interact with Tomcat and 
>>>>>>> Jenkins?
>>>>>>>
>>>>>>> Thanks
>>>>>>> Pedro
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> -- 
>>>>>> Jeff Vincent
>>>>>> [email protected]
>>>>>> See my LinkedIn profile at:
>>>>>> http://www.linkedin.com/in/**rjeffreyvincent<http://www.linkedin.com/in/rjeffreyvincent>
>>>>>> I ♥ DropBox <http://db.tt/9O6LfBX> !!  
>>>>>>
>>>>>>  
>>>>
>>>>
>>>> -- 
>>>> Jeff Vincent
>>>> [email protected]
>>>> See my LinkedIn profile at:
>>>> http://www.linkedin.com/in/rjeffreyvincent
>>>> I ♥ DropBox <http://db.tt/9O6LfBX> !!  
>>>>
>>>>  
>>
>>
>> -- 
>> Jeff Vincent
>> [email protected]
>> See my LinkedIn profile at:
>> http://www.linkedin.com/in/rjeffreyvincent
>> I ♥ DropBox <http://db.tt/9O6LfBX> !!  
>>
>>

Reply via email to