tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: How to run Tomcat as Service on windows start up.
Date Thu, 03 May 2012 07:28:33 GMT
Kiran Badi wrote:
> I just want to have one instance of tomcat up and running always 
> whenever I start my system exactly the way I have httpd service running 
> always.
> 
> ok now moving forward, I installed the tomcat 7.0.27 as service,made 
> changes to shutdown ports/APR ports etc and now its runing fine as a 
> service.I have now 2 tomcats sitting in same apache directory one is 
> 7.0.11(this runs with netbeans) and another is 7.0.27(this runs as 
> windows service).
> 
> Now I want to deploy the my app war file to 7.0.27.But for some reasons 
> Manager App is not accepting my credentials.Here is what I did,
> I copied the tomcat users file of 7.0.11 to 7.0.27 and after copying 
> restarted the service again,and tried to give the same credentials which 
> are working fine in 7.0.11,but to my surprise,those are not working in 
> 7.0.27
> here is tomcat users file,(Sorry for pasting some commented section in 
> below file,but its imp for me not to delete anything for which I dont 
> have much information or knowledge).Pls note that his tomcat users file 
> works perfect fine in 7.0.11 for user kiran/kiran

If it does, then there is severe bug somewhere.  As shown below, that file has 2 openin 
<tomcat-users> tags, and only one closing </tomcat-users> tag. That is invalid
xml.
Try again.

It is usually a better idea to make a copy of the original file as it was in the 
distribution (adding some suffix like ".original"), and then make a "working" version, 
removing all superfluous comments and leaving only what is really effective.
It also makes it a lot easier for people on the list to spot the errors, without having to

waft through kazillions of comment lines which may be badly-formatted in an email..



> 
> <?xml version='1.0' encoding='cp1252'?>
> <!--
>   Licensed to the Apache Software Foundation (ASF) under one or more
>   contributor license agreements.  See the NOTICE file distributed with
>   this work for additional information regarding copyright ownership.
>   The ASF licenses this file to You under the Apache License, Version 2.0
>   (the "License"); you may not use this file except in compliance with
>   the License.  You may obtain a copy of the License at
> 
>       http://www.apache.org/licenses/LICENSE-2.0
> 
>   Unless required by applicable law or agreed to in writing, software
>   distributed under the License is distributed on an "AS IS" BASIS,
>   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>   See the License for the specific language governing permissions and
>   limitations under the License.
> -->
> <tomcat-users>
> <user name="admin" password="kiran" roles="admin-gui,manager-gui" />
> <!--
>   NOTE:  By default, no user is included in the "manager-gui" role required
>   to operate the "/manager/html" web application.  If you wish to use 
> this app,
>   you must define such a user - the username and password are arbitrary.
> -->
> <!--
>   NOTE:  The sample user and role entries below are wrapped in a comment
>   and thus are ignored when reading this file. Do not forget to remove
> <!.. ..> that surrounds them.
> -->
> <?xml version="1.0" encoding="UTF-8"?>
> <!--
>   Licensed to the Apache Software Foundation (ASF) under one or more
>   contributor license agreements.  See the NOTICE file distributed with
>   this work for additional information regarding copyright ownership.
>   The ASF licenses this file to You under the Apache License, Version 2.0
>   (the "License"); you may not use this file except in compliance with
>   the License.  You may obtain a copy of the License at
> 
>       http://www.apache.org/licenses/LICENSE-2.0
> 
>   Unless required by applicable law or agreed to in writing, software
>   distributed under the License is distributed on an "AS IS" BASIS,
>   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>   See the License for the specific language governing permissions and
>   limitations under the License.
> -->
> <tomcat-users>
> <!--
>   NOTE:  By default, no user is included in the "manager-gui" role required
>   to operate the "/manager/html" web application.  If you wish to use 
> this app,
>   you must define such a user - the username and password are arbitrary.
> -->
> <!--
>   NOTE:  The sample user and role entries below are wrapped in a comment
>   and thus are ignored when reading this file. Do not forget to remove
> <!.. ..> that surrounds them.
> -->
> <role rolename="AdminRole"/>
> <role rolename="UserRole"/>
> <user password="tomcat" roles="tomcat,role1" username="both"/>
> <user password="tomcat" roles="UserRole" username="role1"/>
> <user password="tomcat" roles="AdminRole,manager-script,admin" 
> username="tomcat"/>
> <role rolename="manager-gui"/>
> <user username="kiran" password="kiran" roles="manager-gui"/>
> <role rolename="probeuser" />
> <role rolename="poweruser" />
> <role rolename="poweruserplus" />
> <role rolename="manager" />
> <user username="admin" password="t0psecret" roles="manager" />
> </tomcat-users>
> 
> 
> Any ideas why its not working in 7.0.27 ?
> 
> My system is win 7 32 bit home premium with JDK 1.6.32
>>> ________________________________
>>> From: André Warnier<aw@ice-sa.com>
>>> To: Tomcat Users List<users@tomcat.apache.org>
>>> Sent: Sunday, April 29, 2012 2:18 PM
>>> Subject: Re: How to run Tomcat as Service on windows start up.
>>
>>>> Mark Eggers wrote:
>>>> NetBeans will complain that it cannot find the startup.bat and 
>>>> shutdown.bat
>>>> required to do these tasks if you install the service.
>>> Presumably then, you could replace startup.bat and shutdown.bat
>>> by similarly-named .bat files which respectively do
>>> net start "Apache Tomcat"
>>> and
>>> net stop "Apache Tomcat"
>>> (to keep it simple)
>>>
>> I suppose you could. I don't know how intrusive NetBeans' 
>> investigation of the scripts are. In Windows Vista and Windows 7, UAC 
>> might become a problem. I'm not a Windows person, so I'd have to 
>> investigate this.
>>
>>> Similarly, it should be possible to create .bat files which run the 
>>> Tomcat wrapper tomcatX.exe with the appropriate arguments to start, 
>>> stop, or run Tomcat in debug mode.
>>  From my recollection of the service, don't you have to configure the 
>> service for debug using the service configuration program? I'm not 
>> sure how you would handle that through NetBeans, since I believe it 
>> simply does what start.bat / catalina.bat require (pass the debug 
>> argument to catalina.bat).
>>
>> So, you might need a single startup.bat and shutdown.bat that would 
>> determine which service to run, and which service was running . . . .
>>
>>> No ?
>>>
>>> (Although, if I understood the OP's request correctly, the point here 
>>> would
>>> be to start Tomcat as a service as soon as Windows starts.  So 
>>> presumably,
>>> the necessity of having a "startup.bat" is not evident anymore).
>> It's a little unclear as to what the OP request is. It sounds like the 
>> OP has two requirements:
>>
>> 1. Deal with Tomcat in a development environment using NetBeans
>>
>> To me this means starting, stopping, debugging, launching with the 
>> security manager, etc. That's hard to do when you don't own / 
>> completely control the service.
>>
>> The same problem exists in Linux. People want a system-wide Tomcat but 
>> want to use NetBean's deploy and debug facilities. There are all sorts 
>> of interesting permissions problems with this.
>>
>> NetBeans operates by deploying a context.xml file as [app-name].xml in 
>> the appropriate Engine/host directory. The application is actually run 
>> out of [project-name]/build. This works fine, and you can do a lot of 
>> dynamic updates in this fashion.
>>
>> What happens when the user of the IDE doesn't have access to post a 
>> context. xml to the appropriate directory? What happens when Tomcat 
>> doesn't have access to read a user's [project-name]/build directory?
>>
>> So for this use case, it's far easier and cleaner to maintain your own 
>> copy of Tomcat that can be registered, managed, and controlled by 
>> NetBeans.
>>
>> 2. Demonstrate works in progress to other developers
>>
>> Putting aside for the moment that turning development box into a 
>> demonstration server may not be a good thing, it's sometimes handy. 
>> For this I was recommending a system-wide Tomcat (run as a service). 
>> You then just use the manager application to update it with the latest 
>> demonstration-ready software.
>>
>> I think this has a few advantages. You don't show off intermediate 
>> (and potentially embarrassing) code. The service is up regardless of 
>> whether you're developing or not (OP's original request).
>>
>>
>> . . . . just my two cents.
>>
>> /mde/
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message