You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2018/08/09 17:57:13 UTC

Re: [OT] Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

André,

On 8/9/18 12:39 PM, André Warnier (tomcat) wrote:
> 7) a helpful feature of tomcat, is that it itself provides code to 
> connect to localhost port 8005 and send that shutdown string, so
> that one does not have to write its own separate program to do
> that. The bit that is a bit confusing about this feature however,
> is that in order to use that code, one of course needs to start up
> another separate instance of tomcat, just to run that code and
> actually stop the "real" running tomcat.

This should really not be a requirement. Launching a JVM just to parse
some XML and send a single TCP packet is kind of wasteful. The problem
is that Tomcat can't rely on any particular utility programs being
installed on the server in order to do something possibly more efficient
.

I could whip-up something using grep, curl, and plain-old sh for
example that would work on most *NIX systems, but windows users
wouldn't benefit from that kind of thing.

I was very surprised to find out that Tomcat's Windows service-runner
doesn't have separate "launch parameters" versus "stop parameters"
(i.e. the equivalent of CATALINA_OPTS versus JAVA_OPTS for the
script-based service-management). I guess that's just a (another) pill
you'll have to swallow if you want to run on Windows.

> Of course, one could also wonder if you really need JMX when you
> run tomcat in production mode.  If this is only for testing, you
> could run tomcat in a console, where you would not have the same
> issue (because you would not have the wrapper with its
> single-minded preset JVM options).

Oh! André, if you aren't using JMX in production, you are missing-out
on a wealth of monitoring information about your JVM(s).

But rather than using the JMX protocol, I would recommend using
Tomcat's JMXProxyServlet -- a part of the Manager application. That
allows you to make JMX queries over HTTP, and you don't have to
mess-around with Java's JMX-protocol configuration and ugly (and
lacking) authentication capabilities.

> (Or you could switch to Linux ;-))

A wise choice IMHO, if you have the expertise to manage it. I wouldn't
recommend that a Windows shop just switch to Linux any time soon. But
if you have people very familiar with *NIX deployments, I would
recommend keeping Windows on desktops and leave the servers running
some kind of *NIX.

- -chris

> On 09.08.2018 02:06, Daniel Savard wrote:
>> Le mer. 8 août 2018 à 12:08, Louis Zipes <Lo...@gmcr.com> a
>> écrit :
>> 
>>> 
>>> Hi Calder, I can successfully start up as a Windows service and
>>> get JMX working BUT my problem is that Service doesn't stop
>>> cleanly (just repeating that problem in case it wasn't made
>>> clear).  It says the PORT is already in use which led me to try
>>> to use Catalina_Opts as per the suggestions on the internet.
>>> 
>>> Port already in use: 8008; nested exception is: 
>>> java.net.BindException: Address already in use: JVM_Bind
>>> 
>>> If you were able to get JMX working and you can start AND stop
>>> the Tomcat service cleanly, do you mind sharing me your
>>> 'scrubbed'  Java tab contents as I can seem to get the right
>>> combination to get it to Start and Stop the service.
>>> 
>>> Thanks, Louis
>>> 
>>> 
>>> 
>> Louis,
>> 
>> I believe you need to understand a bit more how things are
>> working with Java and the JVM. The -D options are pretty straight
>> forward for anyone knowing how you define properties to the JVM
>> on the command line. I already told you everything you need to
>> know to setup properly your Tomcat. Since you were the one
>> talking about CATALINA_OPTS I assumed you did know where and how
>> to setup the variable for your installation. Otherwise, just go
>> in the setup utility for Tomcat on Windows and put the 
>> -Dcom.sun.management.conf.file=${catalina.base}/conf/abc.def
>> entry there without the CATALINA_OPTS= stanza since this one's
>> intent is to set an environment variable for the process to pick
>> while the former is passing directly the property to the JVM from
>> the Tomcat Windows Setup dialog. There is many ways to do things.
>> Bottom line, you need to tell the JVM where is the configuration
>> file for JMX and put your properties in there as any other
>> properties file. This is standard stuff.
>> 
>> The effect is the JVM now knows your port is a JMX port and it
>> will stop to try to use it when it is already in use and free it
>> cleanly.
>> 
>> Regards,
>> 
>> ----------------- Daniel Savard
>> 
>> 
>>> 
>>> 
>> 
> 
> 
> ---------------------------------------------------------------------
>
> 
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAltsgHgACgkQHPApP6U8
pFg61BAAo+n7gJkweUGuLJK7Vld1n40tj2Pl4M8qS6dWs5RD250kZwNQfDCuB0h5
gjo8Uc0QjAaNchzo6kS8UUz1YqKP/MdqmLDkEzbR05saq+ge8fO45xpaSEjn1s2v
QP9aNc/M58TntaEJf5AVTqGMi+UdNWtWT9/InTjp5wixVYWpHSV6WTnFjlkw6YYs
xGSQc2C5J6tNDmEnPDzx1c61ZA/ukR6WmwA+7+Z9KGxPbmdj/qBw2NBt9Pt3OlRr
FMotxC2O9bXkjSwAWzFEcjzPeWnQYQoGmi872eiRKzBiozIjmU15MmeF12JU/f41
quS6RFeD65uxTy4y6bIQhSX1HN4at18UC+n7ts9xbGKr/nZ6glDYIvPlTiYBEJeK
763SZrTtFLylXJp7x+0Qj7EAvzcduKmuFModHYskv5tnARlBIsOEv8v2ZEJDBpS/
Jm8DjdEmZ1m63Ujf+TCZdkQyWv5cxV9u8YaZLrL+2A/EsO40GJyj2EoQp+kUMFZu
TtUBkNgWHGuiFVl6U5cddkQoUXoloLSeHTTvsnPaDRMqU74ASZlCf40j97jTH0g0
LuTWPH0CaBtok60bgYDmkv17AbsyY2dSfyXyD/+0XfbiaK6dnIrE857sxjcpk0nd
qhmopUIqAHYxFSpLtWMqFI7xboNMFvmpk0ru63H1m7eqLDFyYCI=
=sWUp
-----END PGP SIGNATURE-----

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


Re: [OT] Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

André,

On 8/9/18 6:22 PM, André Warnier (tomcat) wrote:
>> The problem remains though : Under Windows, a Service has a
>> single executable, which Windows starts when starting the
>> Service, and then waits for that executable to send back a
>> message indicating that the Service has properly started. 
>> Similarly, to stop the Service, Windows sends a message "please
>> stop" to that running executable, and waits for the executable to
>> acknowedge that it is stopping. With Tomcat, this executable is
>> "tomcatV.exe" (the renamed Apache Common wrapper). To my
>> knowledge, there is no provision in Windows for starting a
>> service by running one executable, and stopping it using
>> *another* executable.

This is true, but tomcatV.exe actually handles this correctly. But
there is a difference between "java" and "jvm" modes. Go back and read
Mark's message about it carefully, again; I had to do so myself before
I understood why it will work by switching modes.

>> So your suggestion above is indeed not usable for the Windows
>> Service context.

Correct. Even a self-contained "Tomcat-stopping win32 program"
wouldn't work in a Windows-service-context.

>> And thus, for stopping the Tomcat Service, the user is stuck
>> with tomcatV.exe, which uses the *same* JVM command-line
>> parameters whether it is to start or to stop tomcat.

Unless "jvm" mode is used.

>> A solution would be to add a separate options box to the
>> "Startup" and "Shutdown" tabs of the tomcat9w.exe dialog for
>> "additional JVM options at start" and "additional JVM options at
>> stop" (and of course all the associated plumbing in the wrapper
>> code). But I guess that this would go in the category of
>> "enhancement request".

Correct, but "jvm mode" should work with existing features.

>> I've seen Mark's previous answer, which seems to indicate that
>> there is actually another way, but I must confess that I did not
>> understand it.

If you use "java" mode, this is what happens:

Service launch:
1. Windows Service Manager invokes tomcatV.exe
2. tomcatV.exe reads registry for config
3. tomcatV.exe invokes "java [params] o.a.c.Bootstrap start"

Service shutdown:
1. Windows Service Manager invokes tomcatV.exe
2. tomcatV.exe reads registry for config
3. tomcatV.exe invokes "java [params] o.a.c.Bootstrap stop"

You see the problem because "[params]" are the same in both cases, and
the JMX port (and any other Java-specified ports, such as a profiling
agent, etc.) conflict.

If you use "jvm" mode, this is what happens:

Service launch:
1. Windows Service Manager invokes tomcatV.exe
2. tomcatV.exe reads registry for config
3. tomcatV.exe launches an in-process JVM with "[params]" and then
calls o.a.c.Bootstrap.main("start")

Service shutdown:
1. Windows Service Manager invokes tomcatV.exe
2. tomcatV.exe reads registry for config
3. tomcatV.exe calls o.a.c.Bootstrap.main("stop") on the
already-running in-process JVM

In the "jvm mode" case, only one JVM is launched for the start/stop
sequence instead of one JVM for each of start, stop.

So he port-conflict is avoided, and the system is more efficient
(launching a JVM is pretty expensive).

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlttvsEACgkQHPApP6U8
pFgnThAAvZXka+FYgjiJYM+RfYoBOuAwsym44WyToFo7JAAXhMzzIDM8CY6ZceOs
ZojWLcCAYCzDjiBhuEh2KdUfnaelrUPG0451jj0cBqNe6kkSXZ4soS27t+uyUSKG
SPx8u+j5CtHsvEhC5TwwBAVe9dLZ2kD4s8y14R7o3A/sbwim7kgKOw4cA7BdrrmT
0jK4+ce6d1vv5edTkU84HnjNx4y96jbr4/uKBOa+qPYgHeYct84/ADKXn4dZcce6
lliiPu6kGWOvpu04kqqSqwVY3KrcT91q5aXJ8UYyiSbOr+cj+HP4GhDy+Dxdnoze
Kzi+9V7bqkSa9g995kED4v3mRTfg76dRjuxnHbw1hGThkCO5Pi3MJQOjaUfs1XMo
EgT/OLvRqPQlYvi3S1r36QzDBCKh1LVyDntSMIiJn0ilthrwHJfhiPRH6n9jb7Gp
egP3tb+s6LJp15uA8noyTBTBVlOwFE8Kw8XXyEtwOE7cW0QJQXpJSkbatJqsHB94
v10a37SuagkkzaJugGfey6Vcg9oGjWWjENIxB7yK2dZHm1+cm263/9Qmi37WVj4d
KWMdghzoazdOxvK5ntFi2hOs0kdQ3v+EgxWQR9FKJz73piIvsIleVE3v4B49W5oh
nTM/eJtOwJcoYdLG3ljNpND61BvpjuFCm9JUbWizFgJMu6OjY2k=
=F5zk
-----END PGP SIGNATURE-----

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


Re: [OT] Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54

Posted by "André Warnier (tomcat)" <aw...@ice-sa.com>.
On 09.08.2018 20:05, Louis Zipes wrote:
> Oh! André, if you aren't using JMX in production, you are missing-out
> on a wealth of monitoring information about your JVM(s).

OK, fine, I accept that. I was just saying "IF you don't need it in production".
So, scratch the idea of running Tomcat in a console also.
You want to run Tomcat as a Service AND use JMX.
That thus leaves the problem that there is only one set of JVM command-line parameters.

>
> But rather than using the JMX protocol, I would recommend using
> Tomcat's JMXProxyServlet -- a part of the Manager application. That
> allows you to make JMX queries over HTTP, and you don't have to
> mess-around with Java's JMX-protocol configuration and ugly (and
> lacking) authentication capabilities.
>
>>> Just this moment we had a mystery 'hang' with my Tomcat service in PRD that required a Service Restart.  If I had JMX enabled then I might have been able to get some more information.  We just onboarded a bunch of new users but the Tomcat logs themselves don't clearly show memory issues so would have been nice to have that extra layer of logging that JMX would have given me to see if I could have figured it out.
>
> Still working on the other suggestions that people have given over the last 24 hours on trying to get it to working.
>
> -----Original Message-----
> From: Christopher Schultz [mailto:chris@christopherschultz.net]
> Sent: Thursday, August 09, 2018 1:57 PM
> To: users@tomcat.apache.org
> Subject: Re: [OT] Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
>
> - - - external message, proceed with caution - - -
>
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> André,
>
> On 8/9/18 12:39 PM, André Warnier (tomcat) wrote:
>> 7) a helpful feature of tomcat, is that it itself provides code to
>> connect to localhost port 8005 and send that shutdown string, so
>> that one does not have to write its own separate program to do
>> that. The bit that is a bit confusing about this feature however,
>> is that in order to use that code, one of course needs to start up
>> another separate instance of tomcat, just to run that code and
>> actually stop the "real" running tomcat.
>
> This should really not be a requirement. Launching a JVM just to parse
> some XML and send a single TCP packet is kind of wasteful. The problem
> is that Tomcat can't rely on any particular utility programs being
> installed on the server in order to do something possibly more efficient
> .

>
> I could whip-up something using grep, curl, and plain-old sh for
> example that would work on most *NIX systems, but windows users
> wouldn't benefit from that kind of thing.
>

Understood also.
The problem remains though :
Under Windows, a Service has a single executable, which Windows starts when starting the 
Service, and then waits for that executable to send back a message indicating that the 
Service has properly started.
Similarly, to stop the Service, Windows sends a message "please stop" to that running 
executable, and waits for the executable to acknowedge that it is stopping.
With Tomcat, this executable is "tomcatV.exe" (the renamed Apache Common wrapper).
To my knowledge, there is no provision in Windows for starting a service by running one 
executable, and stopping it using *another* executable.
So your suggestion above is indeed not usable for the Windows Service context.
And thus, for stopping the Tomcat Service, the user is stuck with tomcatV.exe, which uses 
the *same* JVM command-line parameters whether it is to start or to stop tomcat.
And that's where the problem lies currently, for the OP : if these JVM parameters contain 
the stanza needed to open the JMX port, then the "stop" command will try again to open the 
same JMX port, and fail.

Under Linux, and under Windows when running tomcat in a console, there is a distinction
between JAVA_OPTS (which are always used in the JVM command-line), and CATALINA_OPTS 
(which are only added when starting tomcat). So you could put the JMX parameters in 
CATALINA_OPTS, and the JVM would only open the JMX port when starting tomcat.
But, currently, when running tomcat as a Windows Service, there is apparently no way to 
provide JVM command-line parameters which are used only at start.

A solution would be to add a separate options box to the "Startup" and "Shutdown" tabs of 
the tomcat9w.exe dialog for "additional JVM options at start" and "additional JVM options 
at stop" (and of course all the associated plumbing in the wrapper code). But I guess that 
this would go in the category of "enhancement request".

I've seen Mark's previous answer, which seems to indicate that there is actually another 
way, but I must confess that I did not understand it.


> I was very surprised to find out that Tomcat's Windows service-runner
> doesn't have separate "launch parameters" versus "stop parameters"
> (i.e. the equivalent of CATALINA_OPTS versus JAVA_OPTS for the
> script-based service-management). I guess that's just a (another) pill
> you'll have to swallow if you want to run on Windows.
>
>> Of course, one could also wonder if you really need JMX when you
>> run tomcat in production mode.  If this is only for testing, you
>> could run tomcat in a console, where you would not have the same
>> issue (because you would not have the wrapper with its
>> single-minded preset JVM options).
>
> Oh! André, if you aren't using JMX in production, you are missing-out
> on a wealth of monitoring information about your JVM(s).
>
> But rather than using the JMX protocol, I would recommend using
> Tomcat's JMXProxyServlet -- a part of the Manager application. That
> allows you to make JMX queries over HTTP, and you don't have to
> mess-around with Java's JMX-protocol configuration and ugly (and
> lacking) authentication capabilities.
>
>> (Or you could switch to Linux ;-))
>
> A wise choice IMHO, if you have the expertise to manage it. I wouldn't
> recommend that a Windows shop just switch to Linux any time soon. But
> if you have people very familiar with *NIX deployments, I would
> recommend keeping Windows on desktops and leave the servers running
> some kind of *NIX.
>
> - -chris
>
>> On 09.08.2018 02:06, Daniel Savard wrote:
>>> Le mer. 8 août 2018 à 12:08, Louis Zipes <Lo...@gmcr.com> a
>>> écrit :
>>>
>>>>
>>>> Hi Calder, I can successfully start up as a Windows service and
>>>> get JMX working BUT my problem is that Service doesn't stop
>>>> cleanly (just repeating that problem in case it wasn't made
>>>> clear).  It says the PORT is already in use which led me to try
>>>> to use Catalina_Opts as per the suggestions on the internet.
>>>>
>>>> Port already in use: 8008; nested exception is:
>>>> java.net.BindException: Address already in use: JVM_Bind
>>>>
>>>> If you were able to get JMX working and you can start AND stop
>>>> the Tomcat service cleanly, do you mind sharing me your
>>>> 'scrubbed'  Java tab contents as I can seem to get the right
>>>> combination to get it to Start and Stop the service.
>>>>
>>>> Thanks, Louis
>>>>
>>>>
>>>>
>>> Louis,
>>>
>>> I believe you need to understand a bit more how things are
>>> working with Java and the JVM. The -D options are pretty straight
>>> forward for anyone knowing how you define properties to the JVM
>>> on the command line. I already told you everything you need to
>>> know to setup properly your Tomcat. Since you were the one
>>> talking about CATALINA_OPTS I assumed you did know where and how
>>> to setup the variable for your installation. Otherwise, just go
>>> in the setup utility for Tomcat on Windows and put the
>>> -Dcom.sun.management.conf.file=${catalina.base}/conf/abc.def
>>> entry there without the CATALINA_OPTS= stanza since this one's
>>> intent is to set an environment variable for the process to pick
>>> while the former is passing directly the property to the JVM from
>>> the Tomcat Windows Setup dialog. There is many ways to do things.
>>> Bottom line, you need to tell the JVM where is the configuration
>>> file for JMX and put your properties in there as any other
>>> properties file. This is standard stuff.
>>>
>>> The effect is the JVM now knows your port is a JMX port and it
>>> will stop to try to use it when it is already in use and free it
>>> cleanly.
>>>
>>> Regards,
>>>
>>> ----------------- Daniel Savard
>>>
>>>
>>>>
>>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>>
>>
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
> -----BEGIN PGP SIGNATURE-----
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
>
> iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAltsgHgACgkQHPApP6U8
> pFg61BAAo+n7gJkweUGuLJK7Vld1n40tj2Pl4M8qS6dWs5RD250kZwNQfDCuB0h5
> gjo8Uc0QjAaNchzo6kS8UUz1YqKP/MdqmLDkEzbR05saq+ge8fO45xpaSEjn1s2v
> QP9aNc/M58TntaEJf5AVTqGMi+UdNWtWT9/InTjp5wixVYWpHSV6WTnFjlkw6YYs
> xGSQc2C5J6tNDmEnPDzx1c61ZA/ukR6WmwA+7+Z9KGxPbmdj/qBw2NBt9Pt3OlRr
> FMotxC2O9bXkjSwAWzFEcjzPeWnQYQoGmi872eiRKzBiozIjmU15MmeF12JU/f41
> quS6RFeD65uxTy4y6bIQhSX1HN4at18UC+n7ts9xbGKr/nZ6glDYIvPlTiYBEJeK
> 763SZrTtFLylXJp7x+0Qj7EAvzcduKmuFModHYskv5tnARlBIsOEv8v2ZEJDBpS/
> Jm8DjdEmZ1m63Ujf+TCZdkQyWv5cxV9u8YaZLrL+2A/EsO40GJyj2EoQp+kUMFZu
> TtUBkNgWHGuiFVl6U5cddkQoUXoloLSeHTTvsnPaDRMqU74ASZlCf40j97jTH0g0
> LuTWPH0CaBtok60bgYDmkv17AbsyY2dSfyXyD/+0XfbiaK6dnIrE857sxjcpk0nd
> qhmopUIqAHYxFSpLtWMqFI7xboNMFvmpk0ru63H1m7eqLDFyYCI=
> =sWUp
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
> ---------------------------------------
> CONFIDENTIALITY NOTICE: This message is for intended addressee(s) only and may contain information that is confidential, proprietary or exempt from disclosure. If you are not the intended recipient, please contact the sender immediately. Unauthorized use or distribution is prohibited and may be unlawful.
>
> ---------------------------------------------------------------------
> 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


RE: [OT] Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54

Posted by Louis Zipes <Lo...@gmcr.com>.
Oh! André, if you aren't using JMX in production, you are missing-out
on a wealth of monitoring information about your JVM(s).

But rather than using the JMX protocol, I would recommend using
Tomcat's JMXProxyServlet -- a part of the Manager application. That
allows you to make JMX queries over HTTP, and you don't have to
mess-around with Java's JMX-protocol configuration and ugly (and
lacking) authentication capabilities.

>> Just this moment we had a mystery 'hang' with my Tomcat service in PRD that required a Service Restart.  If I had JMX enabled then I might have been able to get some more information.  We just onboarded a bunch of new users but the Tomcat logs themselves don't clearly show memory issues so would have been nice to have that extra layer of logging that JMX would have given me to see if I could have figured it out.

Still working on the other suggestions that people have given over the last 24 hours on trying to get it to working.

-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net]
Sent: Thursday, August 09, 2018 1:57 PM
To: users@tomcat.apache.org
Subject: Re: [OT] Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54

- - - external message, proceed with caution - - -


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

André,

On 8/9/18 12:39 PM, André Warnier (tomcat) wrote:
> 7) a helpful feature of tomcat, is that it itself provides code to
> connect to localhost port 8005 and send that shutdown string, so
> that one does not have to write its own separate program to do
> that. The bit that is a bit confusing about this feature however,
> is that in order to use that code, one of course needs to start up
> another separate instance of tomcat, just to run that code and
> actually stop the "real" running tomcat.

This should really not be a requirement. Launching a JVM just to parse
some XML and send a single TCP packet is kind of wasteful. The problem
is that Tomcat can't rely on any particular utility programs being
installed on the server in order to do something possibly more efficient
.

I could whip-up something using grep, curl, and plain-old sh for
example that would work on most *NIX systems, but windows users
wouldn't benefit from that kind of thing.

I was very surprised to find out that Tomcat's Windows service-runner
doesn't have separate "launch parameters" versus "stop parameters"
(i.e. the equivalent of CATALINA_OPTS versus JAVA_OPTS for the
script-based service-management). I guess that's just a (another) pill
you'll have to swallow if you want to run on Windows.

> Of course, one could also wonder if you really need JMX when you
> run tomcat in production mode.  If this is only for testing, you
> could run tomcat in a console, where you would not have the same
> issue (because you would not have the wrapper with its
> single-minded preset JVM options).

Oh! André, if you aren't using JMX in production, you are missing-out
on a wealth of monitoring information about your JVM(s).

But rather than using the JMX protocol, I would recommend using
Tomcat's JMXProxyServlet -- a part of the Manager application. That
allows you to make JMX queries over HTTP, and you don't have to
mess-around with Java's JMX-protocol configuration and ugly (and
lacking) authentication capabilities.

> (Or you could switch to Linux ;-))

A wise choice IMHO, if you have the expertise to manage it. I wouldn't
recommend that a Windows shop just switch to Linux any time soon. But
if you have people very familiar with *NIX deployments, I would
recommend keeping Windows on desktops and leave the servers running
some kind of *NIX.

- -chris

> On 09.08.2018 02:06, Daniel Savard wrote:
>> Le mer. 8 août 2018 à 12:08, Louis Zipes <Lo...@gmcr.com> a
>> écrit :
>>
>>>
>>> Hi Calder, I can successfully start up as a Windows service and
>>> get JMX working BUT my problem is that Service doesn't stop
>>> cleanly (just repeating that problem in case it wasn't made
>>> clear).  It says the PORT is already in use which led me to try
>>> to use Catalina_Opts as per the suggestions on the internet.
>>>
>>> Port already in use: 8008; nested exception is:
>>> java.net.BindException: Address already in use: JVM_Bind
>>>
>>> If you were able to get JMX working and you can start AND stop
>>> the Tomcat service cleanly, do you mind sharing me your
>>> 'scrubbed'  Java tab contents as I can seem to get the right
>>> combination to get it to Start and Stop the service.
>>>
>>> Thanks, Louis
>>>
>>>
>>>
>> Louis,
>>
>> I believe you need to understand a bit more how things are
>> working with Java and the JVM. The -D options are pretty straight
>> forward for anyone knowing how you define properties to the JVM
>> on the command line. I already told you everything you need to
>> know to setup properly your Tomcat. Since you were the one
>> talking about CATALINA_OPTS I assumed you did know where and how
>> to setup the variable for your installation. Otherwise, just go
>> in the setup utility for Tomcat on Windows and put the
>> -Dcom.sun.management.conf.file=${catalina.base}/conf/abc.def
>> entry there without the CATALINA_OPTS= stanza since this one's
>> intent is to set an environment variable for the process to pick
>> while the former is passing directly the property to the JVM from
>> the Tomcat Windows Setup dialog. There is many ways to do things.
>> Bottom line, you need to tell the JVM where is the configuration
>> file for JMX and put your properties in there as any other
>> properties file. This is standard stuff.
>>
>> The effect is the JVM now knows your port is a JMX port and it
>> will stop to try to use it when it is already in use and free it
>> cleanly.
>>
>> Regards,
>>
>> ----------------- Daniel Savard
>>
>>
>>>
>>>
>>
>
>
> ---------------------------------------------------------------------
>
>
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAltsgHgACgkQHPApP6U8
pFg61BAAo+n7gJkweUGuLJK7Vld1n40tj2Pl4M8qS6dWs5RD250kZwNQfDCuB0h5
gjo8Uc0QjAaNchzo6kS8UUz1YqKP/MdqmLDkEzbR05saq+ge8fO45xpaSEjn1s2v
QP9aNc/M58TntaEJf5AVTqGMi+UdNWtWT9/InTjp5wixVYWpHSV6WTnFjlkw6YYs
xGSQc2C5J6tNDmEnPDzx1c61ZA/ukR6WmwA+7+Z9KGxPbmdj/qBw2NBt9Pt3OlRr
FMotxC2O9bXkjSwAWzFEcjzPeWnQYQoGmi872eiRKzBiozIjmU15MmeF12JU/f41
quS6RFeD65uxTy4y6bIQhSX1HN4at18UC+n7ts9xbGKr/nZ6glDYIvPlTiYBEJeK
763SZrTtFLylXJp7x+0Qj7EAvzcduKmuFModHYskv5tnARlBIsOEv8v2ZEJDBpS/
Jm8DjdEmZ1m63Ujf+TCZdkQyWv5cxV9u8YaZLrL+2A/EsO40GJyj2EoQp+kUMFZu
TtUBkNgWHGuiFVl6U5cddkQoUXoloLSeHTTvsnPaDRMqU74ASZlCf40j97jTH0g0
LuTWPH0CaBtok60bgYDmkv17AbsyY2dSfyXyD/+0XfbiaK6dnIrE857sxjcpk0nd
qhmopUIqAHYxFSpLtWMqFI7xboNMFvmpk0ru63H1m7eqLDFyYCI=
=sWUp
-----END PGP SIGNATURE-----

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

---------------------------------------
CONFIDENTIALITY NOTICE: This message is for intended addressee(s) only and may contain information that is confidential, proprietary or exempt from disclosure. If you are not the intended recipient, please contact the sender immediately. Unauthorized use or distribution is prohibited and may be unlawful.