Re: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Louis, On 8/15/18 7:58 AM, Louis Zipes wrote: > One correction. I meant to say that I'm using 8.5 (put my zero in > the wrong place) Glad you are upgrading. 8.5.x is mature enough at this point that there should be a remediation for any incompatibility you may find with previous versions of Tomcat. Moving to 9.0 may require some changes to the application because of stricter-adherence to various standards and the desire of the Tomcat team to finally move-on from backward-compatible hacks, etc. for those things. I would recommend that as soon as you get your application running properly under Tomcat 8.5.x you immediately begin testing it with Tomcat 9.0.x in order to future-proof said application. Any changes you make to fix issues with Tomcat 9.0.x /should/ be equally valid in Tomcat 8.5.x, but you'll also be ready for another upgrade in a year or so (or whatever your "major container upgrade" schedule turns out to be). FWIW, at $work we are only upgrading to 8.5.x starting this fall. > and yes, looking at the GUI for the Tomcat8w in the 'Start' and > 'Stop' tabs it does indeed say JVM and it runs with no 32 bit > error message like the packaged Tomcat 7.0.54 that came packaged > with my third party app. So the switch from "java" -> "jvm" is very likely the only relevant change, here. > Thanks again. There are a lot of articles on Stack Exchange that > would benefit from this additional information! Well, now you are an expert and you can enlighten everybody :) - -chris > > -Original Message- From: Christopher Schultz > [mailto:ch...@christopherschultz.net] Sent: Tuesday, August 14, > 2018 6:41 PM To: users@tomcat.apache.org Subject: Re: Question > about setting CATALINA_OPTS when starting Tomcat using a Windows > Service in Tomcat 7.0.54 > > - - - external message, proceed with caution - - - > > > Louis, > > On 8/14/18 3:28 PM, Louis Zipes wrote: >> Hi all, Just wanted to circle back. There was an early comment >> (maybe even in the first response to my question/problem) where >> someone mentioned that my set up (Running Tomcat as a Windows >> Service and putting the JMX parameters directly in the >> Tomcat7.0.54 GUI in the Java tab) SHOULD work and should startup >> and shutdown gracefully BUT that if it doesn't then try one of >> the of the later versions of Tomcat. > >> I did finally get a chance to try Tomcat 8.0.5X and it does seem >> to work with no other configuration changes. I can access JMX >> (JConsole) and start and shut down the Windows Service running >> Tomcat with no issues. Although, now my problem is that my >> third party application, that is running doesn't work, but that >> is not a problem for this mailing list. > >> So I think we can say that in the end the upgrade to a higher >> version resolved the issue. Thank you to all that contributed >> input! > > It's very possible that, if you used the service-installer, it > simply created a new service that uses the "jvm" launch-strategy. > > I'd be interested to see if that's the case. > > Before you spend a lot of time tracking-down the application > incompatabilities with 8.0.x, you might want to upgrade to 9.0.x > or 8.5.x and start there. Tomcat 8.0.x has reached EOL so it's > probably a waste of your time to test against it. > > Hope that helps, -chris > >> -----Original Message----- From: André Warnier (tomcat) >> [mailto:a...@ice-sa.com] Sent: Thursday, August 09, 2018 12:40 PM >> To: users@tomcat.apache.org Subject: Re: Question about setting >> CATALINA_OPTS when starting Tomcat using a Windows Service in >> Tomcat 7.0.54 > >> - - - external message, proceed with caution - - - > > >> Maybe it is time here to quote Arthur Clarke's 3rd law : "Any >> sufficiently advanced technology is indistinguishable from >> magic" (See : >> https://en.wikipedia.org/wiki/Clarke%27s_three_laws) > >> The process by which Tomcat is started and/or stopped - >> particularly under Windows and as a Service - is not very clear >> in the on-line documentation. Neither is it it very easy to write >> a comprehensive and accurate documentation, because the thing >> has gotten to a point where, for mere mortals, it is really >> quite complicated. (Have a look at bin/catalina.bat to get an >> idea). > >> So let me give you some overall pointers (some of them quite >> basic, I apologise), and maybe in there somewhere, you'll find >> wat you are missing to complete the picture and do what you want >> to do. > >> 1) Tomcat is a compiled java applica
RE: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
One correction. I meant to say that I'm using 8.5 (put my zero in the wrong place) and yes, looking at the GUI for the Tomcat8w in the 'Start' and 'Stop' tabs it does indeed say JVM and it runs with no 32 bit error message like the packaged Tomcat 7.0.54 that came packaged with my third party app. Thanks again. There are a lot of articles on Stack Exchange that would benefit from this additional information! -Original Message- From: Christopher Schultz [mailto:ch...@christopherschultz.net] Sent: Tuesday, August 14, 2018 6:41 PM To: users@tomcat.apache.org Subject: Re: 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 Louis, On 8/14/18 3:28 PM, Louis Zipes wrote: > Hi all, Just wanted to circle back. There was an early comment > (maybe even in the first response to my question/problem) where > someone mentioned that my set up (Running Tomcat as a Windows > Service and putting the JMX parameters directly in the > Tomcat7.0.54 GUI in the Java tab) SHOULD work and should startup > and shutdown gracefully BUT that if it doesn't then try one of the > of the later versions of Tomcat. > > I did finally get a chance to try Tomcat 8.0.5X and it does seem to > work with no other configuration changes. I can access JMX > (JConsole) and start and shut down the Windows Service running > Tomcat with no issues. Although, now my problem is that my third > party application, that is running doesn't work, but that is not > a problem for this mailing list. > > So I think we can say that in the end the upgrade to a higher > version resolved the issue. Thank you to all that contributed > input! It's very possible that, if you used the service-installer, it simply created a new service that uses the "jvm" launch-strategy. I'd be interested to see if that's the case. Before you spend a lot of time tracking-down the application incompatabilities with 8.0.x, you might want to upgrade to 9.0.x or 8.5.x and start there. Tomcat 8.0.x has reached EOL so it's probably a waste of your time to test against it. Hope that helps, - -chris > -Original Message- From: André Warnier (tomcat) > [mailto:a...@ice-sa.com] Sent: Thursday, August 09, 2018 12:40 PM To: > users@tomcat.apache.org Subject: Re: Question about setting > CATALINA_OPTS when starting Tomcat using a Windows Service in > Tomcat 7.0.54 > > - - - external message, proceed with caution - - - > > > Maybe it is time here to quote Arthur Clarke's 3rd law : "Any > sufficiently advanced technology is indistinguishable from magic" > (See : https://en.wikipedia.org/wiki/Clarke%27s_three_laws) > > The process by which Tomcat is started and/or stopped - > particularly under Windows and as a Service - is not very clear in > the on-line documentation. Neither is it it very easy to write a > comprehensive and accurate documentation, because the thing has > gotten to a point where, for mere mortals, it is really quite > complicated. (Have a look at bin/catalina.bat to get an idea). > > So let me give you some overall pointers (some of them quite basic, > I apologise), and maybe in there somewhere, you'll find wat you are > missing to complete the picture and do what you want to do. > > 1) Tomcat is a compiled java application, in java bytecode. To run > this bytecode, you need a JVM. The JVM is machine-executable code, > so to run tomcat, you run a JVM and tell it to run the tomcat > bytecode. 2) the java JVM for Windows is not very good at running > as a Windows Service (it does not handle the appropriate Windows > "signals" etc.). To solve this, when you want to run tomcat as a > Windows Service (or rather - see above - run the JVM as a Windows > Service), you actually run a specialised "wrapper program" which > does work well as a Windows Service, and you ask this wrapper to > start the JVM which runs tomcat. To make matters a bit more > confusing (or maybe, for some, clearer), this generic "Windows > Service JVM wrapper" is renamed to "tomcatV.exe" (where V is the > tomcat version, so for tomcat 9, the program is called > tomcat9.exe). 3) the wrapper program, when it starts the JVM, has > to know which command-line switches it should pass to it. For the > Windows Service flavor of tomcat, these parameters are stored in a > number of special keys in the Windows Registry, and that is where > the wrapper picks them up, before starting the JVM. 4) To make it > easier to set and edit these JVM command-line parameters, tomcat > provides another Windows executable program - a specialised GUI > Registry Editor - which is also renamed according to the tomcat >
Re: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Louis, On 8/14/18 3:28 PM, Louis Zipes wrote: > Hi all, Just wanted to circle back. There was an early comment > (maybe even in the first response to my question/problem) where > someone mentioned that my set up (Running Tomcat as a Windows > Service and putting the JMX parameters directly in the > Tomcat7.0.54 GUI in the Java tab) SHOULD work and should startup > and shutdown gracefully BUT that if it doesn't then try one of the > of the later versions of Tomcat. > > I did finally get a chance to try Tomcat 8.0.5X and it does seem to > work with no other configuration changes. I can access JMX > (JConsole) and start and shut down the Windows Service running > Tomcat with no issues. Although, now my problem is that my third > party application, that is running doesn't work, but that is not > a problem for this mailing list. > > So I think we can say that in the end the upgrade to a higher > version resolved the issue. Thank you to all that contributed > input! It's very possible that, if you used the service-installer, it simply created a new service that uses the "jvm" launch-strategy. I'd be interested to see if that's the case. Before you spend a lot of time tracking-down the application incompatabilities with 8.0.x, you might want to upgrade to 9.0.x or 8.5.x and start there. Tomcat 8.0.x has reached EOL so it's probably a waste of your time to test against it. Hope that helps, - -chris > -Original Message- From: André Warnier (tomcat) > [mailto:a...@ice-sa.com] Sent: Thursday, August 09, 2018 12:40 PM To: > users@tomcat.apache.org Subject: Re: Question about setting > CATALINA_OPTS when starting Tomcat using a Windows Service in > Tomcat 7.0.54 > > - - - external message, proceed with caution - - - > > > Maybe it is time here to quote Arthur Clarke's 3rd law : "Any > sufficiently advanced technology is indistinguishable from magic" > (See : https://en.wikipedia.org/wiki/Clarke%27s_three_laws) > > The process by which Tomcat is started and/or stopped - > particularly under Windows and as a Service - is not very clear in > the on-line documentation. Neither is it it very easy to write a > comprehensive and accurate documentation, because the thing has > gotten to a point where, for mere mortals, it is really quite > complicated. (Have a look at bin/catalina.bat to get an idea). > > So let me give you some overall pointers (some of them quite basic, > I apologise), and maybe in there somewhere, you'll find wat you are > missing to complete the picture and do what you want to do. > > 1) Tomcat is a compiled java application, in java bytecode. To run > this bytecode, you need a JVM. The JVM is machine-executable code, > so to run tomcat, you run a JVM and tell it to run the tomcat > bytecode. 2) the java JVM for Windows is not very good at running > as a Windows Service (it does not handle the appropriate Windows > "signals" etc.). To solve this, when you want to run tomcat as a > Windows Service (or rather - see above - run the JVM as a Windows > Service), you actually run a specialised "wrapper program" which > does work well as a Windows Service, and you ask this wrapper to > start the JVM which runs tomcat. To make matters a bit more > confusing (or maybe, for some, clearer), this generic "Windows > Service JVM wrapper" is renamed to "tomcatV.exe" (where V is the > tomcat version, so for tomcat 9, the program is called > tomcat9.exe). 3) the wrapper program, when it starts the JVM, has > to know which command-line switches it should pass to it. For the > Windows Service flavor of tomcat, these parameters are stored in a > number of special keys in the Windows Registry, and that is where > the wrapper picks them up, before starting the JVM. 4) To make it > easier to set and edit these JVM command-line parameters, tomcat > provides another Windows executable program - a specialised GUI > Registry Editor - which is also renamed according to the tomcat > version, as tomcatVw.exe (where V is the tomcat version, so for > tomcat 9 it would be tomcat9w.exe). > > 5) as a separate bit of knowledge, I would suppose that everyone > knows that on any given host, a given TCP listening port can only > be opened by one process at a time. If a second process tries to > open a port which is already opened by a first process, it will get > an error of the kind "port already in use", and most probably the > second process will then exit (non-gracefully). > > 6) in the tomcat conf/server.xml file, there is a tag : port="8005" shutdown="SHUTDOWN"> This provides a clue as to how one > actually *stops* tomcat : one opens a
RE: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
Hi all, Just wanted to circle back. There was an early comment (maybe even in the first response to my question/problem) where someone mentioned that my set up (Running Tomcat as a Windows Service and putting the JMX parameters directly in the Tomcat7.0.54 GUI in the Java tab) SHOULD work and should startup and shutdown gracefully BUT that if it doesn't then try one of the of the later versions of Tomcat. I did finally get a chance to try Tomcat 8.0.5X and it does seem to work with no other configuration changes. I can access JMX (JConsole) and start and shut down the Windows Service running Tomcat with no issues. Although, now my problem is that my third party application, that is running doesn't work, but that is not a problem for this mailing list. So I think we can say that in the end the upgrade to a higher version resolved the issue. Thank you to all that contributed input! - Louis -Original Message- From: André Warnier (tomcat) [mailto:a...@ice-sa.com] Sent: Thursday, August 09, 2018 12:40 PM To: users@tomcat.apache.org Subject: Re: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54 - - - external message, proceed with caution - - - Maybe it is time here to quote Arthur Clarke's 3rd law : "Any sufficiently advanced technology is indistinguishable from magic" (See : https://en.wikipedia.org/wiki/Clarke%27s_three_laws) The process by which Tomcat is started and/or stopped - particularly under Windows and as a Service - is not very clear in the on-line documentation. Neither is it it very easy to write a comprehensive and accurate documentation, because the thing has gotten to a point where, for mere mortals, it is really quite complicated. (Have a look at bin/catalina.bat to get an idea). So let me give you some overall pointers (some of them quite basic, I apologise), and maybe in there somewhere, you'll find wat you are missing to complete the picture and do what you want to do. 1) Tomcat is a compiled java application, in java bytecode. To run this bytecode, you need a JVM. The JVM is machine-executable code, so to run tomcat, you run a JVM and tell it to run the tomcat bytecode. 2) the java JVM for Windows is not very good at running as a Windows Service (it does not handle the appropriate Windows "signals" etc.). To solve this, when you want to run tomcat as a Windows Service (or rather - see above - run the JVM as a Windows Service), you actually run a specialised "wrapper program" which does work well as a Windows Service, and you ask this wrapper to start the JVM which runs tomcat. To make matters a bit more confusing (or maybe, for some, clearer), this generic "Windows Service JVM wrapper" is renamed to "tomcatV.exe" (where V is the tomcat version, so for tomcat 9, the program is called tomcat9.exe). 3) the wrapper program, when it starts the JVM, has to know which command-line switches it should pass to it. For the Windows Service flavor of tomcat, these parameters are stored in a number of special keys in the Windows Registry, and that is where the wrapper picks them up, before starting the JVM. 4) To make it easier to set and edit these JVM command-line parameters, tomcat provides another Windows executable program - a specialised GUI Registry Editor - which is also renamed according to the tomcat version, as tomcatVw.exe (where V is the tomcat version, so for tomcat 9 it would be tomcat9w.exe). 5) as a separate bit of knowledge, I would suppose that everyone knows that on any given host, a given TCP listening port can only be opened by one process at a time. If a second process tries to open a port which is already opened by a first process, it will get an error of the kind "port already in use", and most probably the second process will then exit (non-gracefully). 6) in the tomcat conf/server.xml file, there is a tag : This provides a clue as to how one actually *stops* tomcat : one opens a TCP connection to locahost port 8005 (on which tomcat listens), then sends the string "SHUTDOWN" on that connection. This causes tomcat to shutdown gracefully, at the end of which it does a "system.exit()" which shuts down the JVM that runs it. And this in turn causes the JVM wrapper program to tell Windows that the tomcat Service is shutting down, before itself exiting. And thus is all well and tidy in the Windows Service world. 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. And of course running a separate i
RE: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
Slotting this Interim update before we started using [OT] so not sure if this is the right spot. >> You see the error you are see because you are using Java mode. Switch >> to jvm mode and all should be well. I did try with JVM mode but now I'm getting a Client Version mismatch. I'm going to try to download the 64 bit version of Tomcat BUT I'm using the Tomcat that came pre-packaged with my application package so I wonder if there is a reason why they loaded it with 32 bit Error message on start up [2018-08-09 08:37:59] [info] [ 4304] Stopping service... [2018-08-09 08:37:59] [error] [ 4304] %1 is not a valid Win32 application. [2018-08-09 08:37:59] [error] [ 4304] Failed creating java C:\Program Files\Java\jdk1.7.0_80\jre\bin\server\jvm.dll [2018-08-09 08:37:59] [error] [ 4304] %1 is not a valid Win32 application. -Original Message- From: André Warnier (tomcat) [mailto:a...@ice-sa.com] Sent: Thursday, August 09, 2018 12:40 PM To: users@tomcat.apache.org Subject: Re: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54 - - - external message, proceed with caution - - - Maybe it is time here to quote Arthur Clarke's 3rd law : "Any sufficiently advanced technology is indistinguishable from magic" (See : https://en.wikipedia.org/wiki/Clarke%27s_three_laws) The process by which Tomcat is started and/or stopped - particularly under Windows and as a Service - is not very clear in the on-line documentation. Neither is it it very easy to write a comprehensive and accurate documentation, because the thing has gotten to a point where, for mere mortals, it is really quite complicated. (Have a look at bin/catalina.bat to get an idea). So let me give you some overall pointers (some of them quite basic, I apologise), and maybe in there somewhere, you'll find wat you are missing to complete the picture and do what you want to do. 1) Tomcat is a compiled java application, in java bytecode. To run this bytecode, you need a JVM. The JVM is machine-executable code, so to run tomcat, you run a JVM and tell it to run the tomcat bytecode. 2) the java JVM for Windows is not very good at running as a Windows Service (it does not handle the appropriate Windows "signals" etc.). To solve this, when you want to run tomcat as a Windows Service (or rather - see above - run the JVM as a Windows Service), you actually run a specialised "wrapper program" which does work well as a Windows Service, and you ask this wrapper to start the JVM which runs tomcat. To make matters a bit more confusing (or maybe, for some, clearer), this generic "Windows Service JVM wrapper" is renamed to "tomcatV.exe" (where V is the tomcat version, so for tomcat 9, the program is called tomcat9.exe). 3) the wrapper program, when it starts the JVM, has to know which command-line switches it should pass to it. For the Windows Service flavor of tomcat, these parameters are stored in a number of special keys in the Windows Registry, and that is where the wrapper picks them up, before starting the JVM. 4) To make it easier to set and edit these JVM command-line parameters, tomcat provides another Windows executable program - a specialised GUI Registry Editor - which is also renamed according to the tomcat version, as tomcatVw.exe (where V is the tomcat version, so for tomcat 9 it would be tomcat9w.exe). 5) as a separate bit of knowledge, I would suppose that everyone knows that on any given host, a given TCP listening port can only be opened by one process at a time. If a second process tries to open a port which is already opened by a first process, it will get an error of the kind "port already in use", and most probably the second process will then exit (non-gracefully). 6) in the tomcat conf/server.xml file, there is a tag : This provides a clue as to how one actually *stops* tomcat : one opens a TCP connection to locahost port 8005 (on which tomcat listens), then sends the string "SHUTDOWN" on that connection. This causes tomcat to shutdown gracefully, at the end of which it does a "system.exit()" which shuts down the JVM that runs it. And this in turn causes the JVM wrapper program to tell Windows that the tomcat Service is shutting down, before itself exiting. And thus is all well and tidy in the Windows Service world. 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. And of course running a separate instance of tomcat actually means running a separate instance of
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 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-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: [OT] Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
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:ch...@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 C
RE: [OT] Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
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:ch...@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 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. T
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 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-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > -BEGIN PGP SIGNATURE- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAltsgHgACgkQHPApP6U8
Re: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
Maybe it is time here to quote Arthur Clarke's 3rd law : "Any sufficiently advanced technology is indistinguishable from magic" (See : https://en.wikipedia.org/wiki/Clarke%27s_three_laws) The process by which Tomcat is started and/or stopped - particularly under Windows and as a Service - is not very clear in the on-line documentation. Neither is it it very easy to write a comprehensive and accurate documentation, because the thing has gotten to a point where, for mere mortals, it is really quite complicated. (Have a look at bin/catalina.bat to get an idea). So let me give you some overall pointers (some of them quite basic, I apologise), and maybe in there somewhere, you'll find wat you are missing to complete the picture and do what you want to do. 1) Tomcat is a compiled java application, in java bytecode. To run this bytecode, you need a JVM. The JVM is machine-executable code, so to run tomcat, you run a JVM and tell it to run the tomcat bytecode. 2) the java JVM for Windows is not very good at running as a Windows Service (it does not handle the appropriate Windows "signals" etc.). To solve this, when you want to run tomcat as a Windows Service (or rather - see above - run the JVM as a Windows Service), you actually run a specialised "wrapper program" which does work well as a Windows Service, and you ask this wrapper to start the JVM which runs tomcat. To make matters a bit more confusing (or maybe, for some, clearer), this generic "Windows Service JVM wrapper" is renamed to "tomcatV.exe" (where V is the tomcat version, so for tomcat 9, the program is called tomcat9.exe). 3) the wrapper program, when it starts the JVM, has to know which command-line switches it should pass to it. For the Windows Service flavor of tomcat, these parameters are stored in a number of special keys in the Windows Registry, and that is where the wrapper picks them up, before starting the JVM. 4) To make it easier to set and edit these JVM command-line parameters, tomcat provides another Windows executable program - a specialised GUI Registry Editor - which is also renamed according to the tomcat version, as tomcatVw.exe (where V is the tomcat version, so for tomcat 9 it would be tomcat9w.exe). 5) as a separate bit of knowledge, I would suppose that everyone knows that on any given host, a given TCP listening port can only be opened by one process at a time. If a second process tries to open a port which is already opened by a first process, it will get an error of the kind "port already in use", and most probably the second process will then exit (non-gracefully). 6) in the tomcat conf/server.xml file, there is a tag : This provides a clue as to how one actually *stops* tomcat : one opens a TCP connection to locahost port 8005 (on which tomcat listens), then sends the string "SHUTDOWN" on that connection. This causes tomcat to shutdown gracefully, at the end of which it does a "system.exit()" which shuts down the JVM that runs it. And this in turn causes the JVM wrapper program to tell Windows that the tomcat Service is shutting down, before itself exiting. And thus is all well and tidy in the Windows Service world. 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. And of course running a separate instance of tomcat actually means running a separate instance of the JVM which runs tomcat. Now armed with all the above knowledge, and with the dialog window offered by the tomcat9w.exe program, it is relatively easy to figure out what happens (or at least what may happen in your case, in my modest non-java-expert opinion). Looking only at the last 3 tabs of that window (Java / Startup / Shutdown), one can figure out that : - the "java" tab contains the path of the JVM to be started, and the command-line parameters that will be passed to that JVM - the "Startup" tab contains the java class that the JVM should invoke at the start of tomcat, and the argument ("start") to pass into that initial call. - the "Shutdown" tab contains the java class that the JVM should invoke to stop an already-running tomcat, and the argument ("stop") to pass into that initial call. (Thus triggering the code in (7) above). And I believe that, in the particular case of Tomcat being run as a Windows Service, here may be the origin of the problem which you are encountering : the "Java" tab lists command-line options that are *common* to both the JVM which starts tomcat, and to the (separate) JVM which stops tomcat. There is only one set of JVM options, for both cases. Which means that if, in these JVM command-line
Re: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
On 09/08/18 12:11, Suvendu Sekhar Mondal wrote: > On Thu, Aug 9, 2018 at 2:39 PM Mark Thomas wrote: >> >> On 09/08/18 01:06, Daniel Savard wrote: >> >>> Louis, >>> >>> I believe you need to understand a bit more how things are working with >>> Java and the JVM. >> >> Actually Daniel, it is you who needs to understand things better. >> >> >> Louis, >> >> Clearly, when Tomcat is started a new JVM instance is created and it >> listens on the configured JMX ports. >> >> The problem is that when Tomcat is stopped another JVM instance is >> created (to send the stop message to the first) and that uses the same >> configuration. Hence it tries to open the same JMX port and fails >> because it is already bound. >> >> If you were running from the command line, the fix would be easy. Put >> the JMX options in CATALINA_OPTS and they'd only be used on start but >> not stop. (JAVA_OPTS are used on both start and stop). >> >> There is also a simple fix if running as a Windows Service. The Windows >> Service wrapper is simply a renamed version Apache Common Daemon. When >> running a Java program as a Windows service there are three ways it can >> be integrated. >> >> 1. jvm. The Windows service wrapper starts and embedded JVM using the >> provided parameters and then calls the start method on the appropriate >> class. To stop, it calls the stop method on the appropriate class in the >> embedded jvm. >> >> 2. Java. The Windows service wrapper starts a separate Java process with >> the provided parameters. On stop, a second Java process is started using >> the same parameters which is expected to communicate with the first >> process and stop it. >> >> 3. exe. Same as 2 but any executable can be used rather than java.exe. >> >> You see the error you are see because you are using Java mode. Switch to >> jvm mode and all should be well. >> >> Finally 7.0.54 is very old. I strongly recommend an upgrade at least to >> the latest 7.0.x release is not 8.5.x/9.0.x >> >> Mark >> > One question Mark, if I use > org.apache.catalina.mbeans.JmxRemoteLifecycleListener, would that work > as JVM mode or Java mode? That would work in either mode of the Windows Service wrapper. If a second Java process is created to perform "stop", server.xml is parsed but only to read the shutdown port and command. Everything else is ignored. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
On 09/08/18 12:45, Louis Zipes wrote: > Hi Mark, > > You wrote: > > 1. You see the error you are see because you are using Java mode. Switch to > jvm mode and all should be well. > >>> I'm already using 'C:\Program >>> Files\Java\jdk1.7.0_80\jre\bin\server\jvm.dll' in my Java Virtual Machine >>> tab. I assume that means I'm already in JVM Mode. I think I recall when >>> setting up Tomcat last year it wouldn't start any other way. It doesn't. The service wrapper can use that dll either to start Java in process (jvm mode) or to start a separate process (Java mode). You want to look at the bottom option on both the Startup and Shutdown tabs of tomcat7w.exe. My expectation is that they will be set to "Java" whereas you need "jvm". Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
Hi Mark, You wrote: 1. You see the error you are see because you are using Java mode. Switch to jvm mode and all should be well. >> I'm already using 'C:\Program Files\Java\jdk1.7.0_80\jre\bin\server\jvm.dll' >> in my Java Virtual Machine tab. I assume that means I'm already in JVM >> Mode. I think I recall when setting up Tomcat last year it wouldn't start >> any other way. 2. Finally 7.0.54 is very old. I strongly recommend an upgrade at least to the latest 7.0.x release is not 8.5.x/9.0.x >> I'm going to try that today (or tomorrow depending on how busy it is at >> work). The issue that I might run into is the application that is running >> on Tomcat is not my application and I might run into a restriction on how >> high of a version I can go to but I will deal with that later if it does >> work. Thank you to all for the continued assistance. I have a thick skin. : ) - Louis -Original Message- From: Mark Thomas [mailto:ma...@apache.org] Sent: Thursday, August 09, 2018 5:10 AM To: users@tomcat.apache.org Subject: Re: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54 - - - external message, proceed with caution - - - On 09/08/18 01:06, Daniel Savard wrote: > Louis, > > I believe you need to understand a bit more how things are working with > Java and the JVM. Actually Daniel, it is you who needs to understand things better. Louis, Clearly, when Tomcat is started a new JVM instance is created and it listens on the configured JMX ports. The problem is that when Tomcat is stopped another JVM instance is created (to send the stop message to the first) and that uses the same configuration. Hence it tries to open the same JMX port and fails because it is already bound. If you were running from the command line, the fix would be easy. Put the JMX options in CATALINA_OPTS and they'd only be used on start but not stop. (JAVA_OPTS are used on both start and stop). There is also a simple fix if running as a Windows Service. The Windows Service wrapper is simply a renamed version Apache Common Daemon. When running a Java program as a Windows service there are three ways it can be integrated. 1. jvm. The Windows service wrapper starts and embedded JVM using the provided parameters and then calls the start method on the appropriate class. To stop, it calls the stop method on the appropriate class in the embedded jvm. 2. Java. The Windows service wrapper starts a separate Java process with the provided parameters. On stop, a second Java process is started using the same parameters which is expected to communicate with the first process and stop it. 3. exe. Same as 2 but any executable can be used rather than java.exe. You see the error you are see because you are using Java mode. Switch to jvm mode and all should be well. Finally 7.0.54 is very old. I strongly recommend an upgrade at least to the latest 7.0.x release is not 8.5.x/9.0.x Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@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-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
On Thu, Aug 9, 2018 at 2:39 PM Mark Thomas wrote: > > On 09/08/18 01:06, Daniel Savard wrote: > > > Louis, > > > > I believe you need to understand a bit more how things are working with > > Java and the JVM. > > Actually Daniel, it is you who needs to understand things better. > > > Louis, > > Clearly, when Tomcat is started a new JVM instance is created and it > listens on the configured JMX ports. > > The problem is that when Tomcat is stopped another JVM instance is > created (to send the stop message to the first) and that uses the same > configuration. Hence it tries to open the same JMX port and fails > because it is already bound. > > If you were running from the command line, the fix would be easy. Put > the JMX options in CATALINA_OPTS and they'd only be used on start but > not stop. (JAVA_OPTS are used on both start and stop). > > There is also a simple fix if running as a Windows Service. The Windows > Service wrapper is simply a renamed version Apache Common Daemon. When > running a Java program as a Windows service there are three ways it can > be integrated. > > 1. jvm. The Windows service wrapper starts and embedded JVM using the > provided parameters and then calls the start method on the appropriate > class. To stop, it calls the stop method on the appropriate class in the > embedded jvm. > > 2. Java. The Windows service wrapper starts a separate Java process with > the provided parameters. On stop, a second Java process is started using > the same parameters which is expected to communicate with the first > process and stop it. > > 3. exe. Same as 2 but any executable can be used rather than java.exe. > > You see the error you are see because you are using Java mode. Switch to > jvm mode and all should be well. > > Finally 7.0.54 is very old. I strongly recommend an upgrade at least to > the latest 7.0.x release is not 8.5.x/9.0.x > > Mark > One question Mark, if I use org.apache.catalina.mbeans.JmxRemoteLifecycleListener, would that work as JVM mode or Java mode? Thanks! Suvendu - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
On 09/08/18 01:06, Daniel Savard wrote: > Louis, > > I believe you need to understand a bit more how things are working with > Java and the JVM. Actually Daniel, it is you who needs to understand things better. Louis, Clearly, when Tomcat is started a new JVM instance is created and it listens on the configured JMX ports. The problem is that when Tomcat is stopped another JVM instance is created (to send the stop message to the first) and that uses the same configuration. Hence it tries to open the same JMX port and fails because it is already bound. If you were running from the command line, the fix would be easy. Put the JMX options in CATALINA_OPTS and they'd only be used on start but not stop. (JAVA_OPTS are used on both start and stop). There is also a simple fix if running as a Windows Service. The Windows Service wrapper is simply a renamed version Apache Common Daemon. When running a Java program as a Windows service there are three ways it can be integrated. 1. jvm. The Windows service wrapper starts and embedded JVM using the provided parameters and then calls the start method on the appropriate class. To stop, it calls the stop method on the appropriate class in the embedded jvm. 2. Java. The Windows service wrapper starts a separate Java process with the provided parameters. On stop, a second Java process is started using the same parameters which is expected to communicate with the first process and stop it. 3. exe. Same as 2 but any executable can be used rather than java.exe. You see the error you are see because you are using Java mode. Switch to jvm mode and all should be well. Finally 7.0.54 is very old. I strongly recommend an upgrade at least to the latest 7.0.x release is not 8.5.x/9.0.x Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
Le mer. 8 août 2018 à 12:08, Louis Zipes 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 > >
RE: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
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 -Original Message- From: calder [mailto:calder@gmail.com] Sent: Wednesday, August 08, 2018 12:01 PM To: Tomcat Users List Subject: Re: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54 - - - external message, proceed with caution - - - I configured my "Tomcat as a Service" a couple days ago for remote JMC a) navigate to Tomcat's "bin" subdir b) execute: tomcat7w //ES//"type service name here" c) go to Java tab d) add the properties in the "Java Options" text area e) select OK and restart Tomcat Service On Wednesday, August 8, 2018, Louis Zipes wrote: > Thanks for the assistance! See my comments below: > > >You put this to setenv.bat in your bin directory. If the setenv.bat file > does not exist, create it > > -- My problem throughout this is that I'm starting up my Tomcat using > Windows service so setenv.bat and catalina.bat seems to be ignored in that > scenario. Correct me if I'm wrong but everything on Google mentions this. > > >Note that you can also set your properties in CATALINA_OPTS directly, > i.e. you'd delete the line above in setenv.bat and paste in: > > -- When you say 'Set Catalina_Opts directly' do you mean the Environment > variable or some other location? > > -Original Message- > From: Marek Czernek [mailto:mczer...@redhat.com] > Sent: Wednesday, August 08, 2018 9:39 AM > To: users@tomcat.apache.org > Subject: Re: Question about setting CATALINA_OPTS when starting Tomcat > using a Windows Service in Tomcat 7.0.54 > > - - - external message, proceed with caution - - - > > > Hi Louis, > > try the following format: > > set > CATALINA_OPTS="-Dcom.sun.management.conf.file=% > CATALINA_BASE%\conf\abc.efg" > > In the above, %CATALINA_BASE% is a bariable that should be resolved by > Tomcat. If it is not, I made a mistake in the variable name, but I think > it should work (you could also try %catalina.base%). > > You put this to setenv.bat in your bin directory. If the setenv.bat file > does not exist, create it. Note that you can also set your properties in > CATALINA_OPTS directly, i.e. you'd delete the line above in setenv.bat > and paste in: > > set CATALINA_OPTS="-Dproperty1=value1 -Dproperty2=value2" etc. When you > start Tomcat, it should read all the properties in CATALINA_OPTS and > show you the properties at the beginning of the log. > > Hope this helps. > > On 08/08/2018 03:10 PM, Louis Zipes wrote: > > Hi Daniel, > > I apologize if maybe it is my lack of knowledge but I don't think I > understand the actual way to write the line 'Set Catalina_Opts =' in this > management file that I'm going to reference in the Java window/tabe in the > Tomcat 7w GUI. > > > > In my management.properties file (in the /CONF folder which is where > also the server.xml file sits) I have the following > > > > com.sun.management.jmxremote > > com.sun.management.jmxremote.port=8008 > > com.sun.management.jmxremote.authenticate=false > > com.sun.management.jmxremote.ssl=false > > java.rmi.server.hostname= > > > > How do I set these as my CATALINA_OPTS values? I have tried various > 'SET CATALINA_OPTS...' options but I can't seem to write it the correct way > for Windows. I have even tried to set the CATALINA_OPTS option, pointing > to the management.properties file in the Java tab in the Tomcat7w GUI but I > get an error that the Class can't be found so I must be writing it wrong. > > > > Thanks for the continued assistance. > > > > - Louis > > > > > > > > -Original Message- > > From: Daniel Savard [mailto:daniel.sav...@gmail.com] > > Sent: Friday, August 03, 2018 11:57 PM > > To: Tomcat Users List > > Subject: Re: Question about setting CATALINA_OPTS when starting Tomcat > using a Windows Service in Tomcat 7.0.54 > > > > - - - external message, proceed with caution - - - > > > > > > Le ven. 3 août 2018 à 12:03, Louis Zipes a écrit > :
Re: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
I configured my "Tomcat as a Service" a couple days ago for remote JMC a) navigate to Tomcat's "bin" subdir b) execute: tomcat7w //ES//"type service name here" c) go to Java tab d) add the properties in the "Java Options" text area e) select OK and restart Tomcat Service On Wednesday, August 8, 2018, Louis Zipes wrote: > Thanks for the assistance! See my comments below: > > >You put this to setenv.bat in your bin directory. If the setenv.bat file > does not exist, create it > > -- My problem throughout this is that I'm starting up my Tomcat using > Windows service so setenv.bat and catalina.bat seems to be ignored in that > scenario. Correct me if I'm wrong but everything on Google mentions this. > > >Note that you can also set your properties in CATALINA_OPTS directly, > i.e. you'd delete the line above in setenv.bat and paste in: > > -- When you say 'Set Catalina_Opts directly' do you mean the Environment > variable or some other location? > > -Original Message- > From: Marek Czernek [mailto:mczer...@redhat.com] > Sent: Wednesday, August 08, 2018 9:39 AM > To: users@tomcat.apache.org > Subject: Re: Question about setting CATALINA_OPTS when starting Tomcat > using a Windows Service in Tomcat 7.0.54 > > - - - external message, proceed with caution - - - > > > Hi Louis, > > try the following format: > > set > CATALINA_OPTS="-Dcom.sun.management.conf.file=% > CATALINA_BASE%\conf\abc.efg" > > In the above, %CATALINA_BASE% is a bariable that should be resolved by > Tomcat. If it is not, I made a mistake in the variable name, but I think > it should work (you could also try %catalina.base%). > > You put this to setenv.bat in your bin directory. If the setenv.bat file > does not exist, create it. Note that you can also set your properties in > CATALINA_OPTS directly, i.e. you'd delete the line above in setenv.bat > and paste in: > > set CATALINA_OPTS="-Dproperty1=value1 -Dproperty2=value2" etc. When you > start Tomcat, it should read all the properties in CATALINA_OPTS and > show you the properties at the beginning of the log. > > Hope this helps. > > On 08/08/2018 03:10 PM, Louis Zipes wrote: > > Hi Daniel, > > I apologize if maybe it is my lack of knowledge but I don't think I > understand the actual way to write the line 'Set Catalina_Opts =' in this > management file that I'm going to reference in the Java window/tabe in the > Tomcat 7w GUI. > > > > In my management.properties file (in the /CONF folder which is where > also the server.xml file sits) I have the following > > > > com.sun.management.jmxremote > > com.sun.management.jmxremote.port=8008 > > com.sun.management.jmxremote.authenticate=false > > com.sun.management.jmxremote.ssl=false > > java.rmi.server.hostname= > > > > How do I set these as my CATALINA_OPTS values? I have tried various > 'SET CATALINA_OPTS...' options but I can't seem to write it the correct way > for Windows. I have even tried to set the CATALINA_OPTS option, pointing > to the management.properties file in the Java tab in the Tomcat7w GUI but I > get an error that the Class can't be found so I must be writing it wrong. > > > > Thanks for the continued assistance. > > > > - Louis > > > > > > > > -Original Message- > > From: Daniel Savard [mailto:daniel.sav...@gmail.com] > > Sent: Friday, August 03, 2018 11:57 PM > > To: Tomcat Users List > > Subject: Re: Question about setting CATALINA_OPTS when starting Tomcat > using a Windows Service in Tomcat 7.0.54 > > > > - - - external message, proceed with caution - - - > > > > > > Le ven. 3 août 2018 à 12:03, Louis Zipes a écrit > : > > > >> Good catch!! I still had 'd' in front of my lines so once I removed > those > >> JMX starts up using Management.properties file but as you mentioned it > >> doesn't really change the behavior at all and the Service still doesn't > >> stop cleanly. So is there a way to force the JMX to use CATALINA_OPTS > in > >> this file. Something like SET CATALINA_OPTS = 'JMX settings'? > >> > >> That is if the JMX running on CATALINA_OPTS is indeed the answer. > >> Basically, trying to mimic the setenv file that is not used by the > Window > >> Service. > >> > >> -Original Message- > >> From: Christopher Schultz [mailto:ch...@christopherschultz.net] > >> Sent: Friday, August 03, 2018 11:52 AM > >> To: users@tomcat.apache.org > >> Subject: Re: Question about setting CATALINA_OPTS when starting Tomcat > >>
RE: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
Thanks for the assistance! See my comments below: >You put this to setenv.bat in your bin directory. If the setenv.bat file does >not exist, create it -- My problem throughout this is that I'm starting up my Tomcat using Windows service so setenv.bat and catalina.bat seems to be ignored in that scenario. Correct me if I'm wrong but everything on Google mentions this. >Note that you can also set your properties in CATALINA_OPTS directly, i.e. >you'd delete the line above in setenv.bat and paste in: -- When you say 'Set Catalina_Opts directly' do you mean the Environment variable or some other location? -Original Message- From: Marek Czernek [mailto:mczer...@redhat.com] Sent: Wednesday, August 08, 2018 9:39 AM To: users@tomcat.apache.org Subject: Re: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54 - - - external message, proceed with caution - - - Hi Louis, try the following format: set CATALINA_OPTS="-Dcom.sun.management.conf.file=%CATALINA_BASE%\conf\abc.efg" In the above, %CATALINA_BASE% is a bariable that should be resolved by Tomcat. If it is not, I made a mistake in the variable name, but I think it should work (you could also try %catalina.base%). You put this to setenv.bat in your bin directory. If the setenv.bat file does not exist, create it. Note that you can also set your properties in CATALINA_OPTS directly, i.e. you'd delete the line above in setenv.bat and paste in: set CATALINA_OPTS="-Dproperty1=value1 -Dproperty2=value2" etc. When you start Tomcat, it should read all the properties in CATALINA_OPTS and show you the properties at the beginning of the log. Hope this helps. On 08/08/2018 03:10 PM, Louis Zipes wrote: > Hi Daniel, > I apologize if maybe it is my lack of knowledge but I don't think I > understand the actual way to write the line 'Set Catalina_Opts =' in this > management file that I'm going to reference in the Java window/tabe in the > Tomcat 7w GUI. > > In my management.properties file (in the /CONF folder which is where also the > server.xml file sits) I have the following > > com.sun.management.jmxremote > com.sun.management.jmxremote.port=8008 > com.sun.management.jmxremote.authenticate=false > com.sun.management.jmxremote.ssl=false > java.rmi.server.hostname= > > How do I set these as my CATALINA_OPTS values? I have tried various 'SET > CATALINA_OPTS...' options but I can't seem to write it the correct way for > Windows. I have even tried to set the CATALINA_OPTS option, pointing to the > management.properties file in the Java tab in the Tomcat7w GUI but I get an > error that the Class can't be found so I must be writing it wrong. > > Thanks for the continued assistance. > > - Louis > > > > -Original Message- > From: Daniel Savard [mailto:daniel.sav...@gmail.com] > Sent: Friday, August 03, 2018 11:57 PM > To: Tomcat Users List > Subject: Re: Question about setting CATALINA_OPTS when starting Tomcat using > a Windows Service in Tomcat 7.0.54 > > - - - external message, proceed with caution - - - > > > Le ven. 3 août 2018 à 12:03, Louis Zipes a écrit : > >> Good catch!! I still had 'd' in front of my lines so once I removed those >> JMX starts up using Management.properties file but as you mentioned it >> doesn't really change the behavior at all and the Service still doesn't >> stop cleanly. So is there a way to force the JMX to use CATALINA_OPTS in >> this file. Something like SET CATALINA_OPTS = 'JMX settings'? >> >> That is if the JMX running on CATALINA_OPTS is indeed the answer. >> Basically, trying to mimic the setenv file that is not used by the Window >> Service. >> >> -Original Message- >> From: Christopher Schultz [mailto:ch...@christopherschultz.net] >> Sent: Friday, August 03, 2018 11:52 AM >> To: users@tomcat.apache.org >> Subject: Re: 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 >> >> Louis, >> >> On 8/3/18 11:32 AM, Louis Zipes wrote: >>> Hi Daniel, I tried your suggestion and while I think it is now >>> acknowledging the existence of the management.properties file >>> (Windows Service wouldn't start if I purposely misspelled >>> 'managemenX.properties') but it doesn't seem to be actually working >>> (JMX can't connect). >>> >>> What I did: >>> >>> I created a copy of an existing logging.properties file already in >>> the CONF folder, renamed it management.properties, and removed all >
Re: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
Hi Louis, try the following format: set CATALINA_OPTS="-Dcom.sun.management.conf.file=%CATALINA_BASE%\conf\abc.efg" In the above, %CATALINA_BASE% is a bariable that should be resolved by Tomcat. If it is not, I made a mistake in the variable name, but I think it should work (you could also try %catalina.base%). You put this to setenv.bat in your bin directory. If the setenv.bat file does not exist, create it. Note that you can also set your properties in CATALINA_OPTS directly, i.e. you'd delete the line above in setenv.bat and paste in: set CATALINA_OPTS="-Dproperty1=value1 -Dproperty2=value2" etc. When you start Tomcat, it should read all the properties in CATALINA_OPTS and show you the properties at the beginning of the log. Hope this helps. On 08/08/2018 03:10 PM, Louis Zipes wrote: Hi Daniel, I apologize if maybe it is my lack of knowledge but I don't think I understand the actual way to write the line 'Set Catalina_Opts =' in this management file that I'm going to reference in the Java window/tabe in the Tomcat 7w GUI. In my management.properties file (in the /CONF folder which is where also the server.xml file sits) I have the following com.sun.management.jmxremote com.sun.management.jmxremote.port=8008 com.sun.management.jmxremote.authenticate=false com.sun.management.jmxremote.ssl=false java.rmi.server.hostname= How do I set these as my CATALINA_OPTS values? I have tried various 'SET CATALINA_OPTS...' options but I can't seem to write it the correct way for Windows. I have even tried to set the CATALINA_OPTS option, pointing to the management.properties file in the Java tab in the Tomcat7w GUI but I get an error that the Class can't be found so I must be writing it wrong. Thanks for the continued assistance. - Louis -Original Message- From: Daniel Savard [mailto:daniel.sav...@gmail.com] Sent: Friday, August 03, 2018 11:57 PM To: Tomcat Users List Subject: Re: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54 - - - external message, proceed with caution - - - Le ven. 3 août 2018 à 12:03, Louis Zipes a écrit : Good catch!! I still had 'd' in front of my lines so once I removed those JMX starts up using Management.properties file but as you mentioned it doesn't really change the behavior at all and the Service still doesn't stop cleanly. So is there a way to force the JMX to use CATALINA_OPTS in this file. Something like SET CATALINA_OPTS = 'JMX settings'? That is if the JMX running on CATALINA_OPTS is indeed the answer. Basically, trying to mimic the setenv file that is not used by the Window Service. -Original Message- From: Christopher Schultz [mailto:ch...@christopherschultz.net] Sent: Friday, August 03, 2018 11:52 AM To: users@tomcat.apache.org Subject: Re: 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 Louis, On 8/3/18 11:32 AM, Louis Zipes wrote: Hi Daniel, I tried your suggestion and while I think it is now acknowledging the existence of the management.properties file (Windows Service wouldn't start if I purposely misspelled 'managemenX.properties') but it doesn't seem to be actually working (JMX can't connect). What I did: I created a copy of an existing logging.properties file already in the CONF folder, renamed it management.properties, and removed all contents of it and put in: Just FYI, there is nothing magical about an existing properties file. It's just a text file with name=value items in it. Dcom.sun.management.jmxremote Dcom.sun.management.jmxremote.port=8008 Dcom.sun.management.jmxremote.authenticate=false Dcom.sun.management.jmxremote.ssl=false Djava.rmi.server.hostname= I don't think you want those leading D characters. Is that a copy/paste error? -Dcom.sun.management.config.file= C:\ \Tomcat\conf\management.properties Daniel usually knows what he's talking about, but I'll be surprised if Tomcat doesn't fail the same way after making these changes... you are just moving the configuration from one place (multiple system properties) to another (one system property pointing to another file of properties). - -chris As Christopher said, you this file management.properties can be named whatever abc.efg would do the same and in that file you have attribute=value pairs, everything that concerns the com.sun.management.xxx properties. Then you pass the name of that file as a single option to the JVM with -Dcom.sun.management.config.file=${catalina.base}/conf/abc.efg and remove everything else from the CATALINA_OPTS which is in the configuration file. I strongly suggest to locate this file in the same directory as the server.xml file and use the ${catalina.base} variable asis and litterally into the CATALINA_OPTS="-Dcom.sun.management.conf.file=${catalina.base}/conf/abc.efg"
RE: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
Hi Daniel, I apologize if maybe it is my lack of knowledge but I don't think I understand the actual way to write the line 'Set Catalina_Opts =' in this management file that I'm going to reference in the Java window/tabe in the Tomcat 7w GUI. In my management.properties file (in the /CONF folder which is where also the server.xml file sits) I have the following com.sun.management.jmxremote com.sun.management.jmxremote.port=8008 com.sun.management.jmxremote.authenticate=false com.sun.management.jmxremote.ssl=false java.rmi.server.hostname= How do I set these as my CATALINA_OPTS values? I have tried various 'SET CATALINA_OPTS...' options but I can't seem to write it the correct way for Windows. I have even tried to set the CATALINA_OPTS option, pointing to the management.properties file in the Java tab in the Tomcat7w GUI but I get an error that the Class can't be found so I must be writing it wrong. Thanks for the continued assistance. - Louis -Original Message- From: Daniel Savard [mailto:daniel.sav...@gmail.com] Sent: Friday, August 03, 2018 11:57 PM To: Tomcat Users List Subject: Re: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54 - - - external message, proceed with caution - - - Le ven. 3 août 2018 à 12:03, Louis Zipes a écrit : > Good catch!! I still had 'd' in front of my lines so once I removed those > JMX starts up using Management.properties file but as you mentioned it > doesn't really change the behavior at all and the Service still doesn't > stop cleanly. So is there a way to force the JMX to use CATALINA_OPTS in > this file. Something like SET CATALINA_OPTS = 'JMX settings'? > > That is if the JMX running on CATALINA_OPTS is indeed the answer. > Basically, trying to mimic the setenv file that is not used by the Window > Service. > > -Original Message- > From: Christopher Schultz [mailto:ch...@christopherschultz.net] > Sent: Friday, August 03, 2018 11:52 AM > To: users@tomcat.apache.org > Subject: Re: 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 > > Louis, > > On 8/3/18 11:32 AM, Louis Zipes wrote: > > Hi Daniel, I tried your suggestion and while I think it is now > > acknowledging the existence of the management.properties file > > (Windows Service wouldn't start if I purposely misspelled > > 'managemenX.properties') but it doesn't seem to be actually working > > (JMX can't connect). > > > > What I did: > > > > I created a copy of an existing logging.properties file already in > > the CONF folder, renamed it management.properties, and removed all > > contents of it and put in: > > Just FYI, there is nothing magical about an existing properties file. > It's just a text file with name=value items in it. > > > Dcom.sun.management.jmxremote > > Dcom.sun.management.jmxremote.port=8008 > > Dcom.sun.management.jmxremote.authenticate=false > > Dcom.sun.management.jmxremote.ssl=false > > Djava.rmi.server.hostname= > > I don't think you want those leading D characters. Is that a > copy/paste error? > > > -Dcom.sun.management.config.file= C:\ > structure>\Tomcat\conf\management.properties > > Daniel usually knows what he's talking about, but I'll be surprised if > Tomcat doesn't fail the same way after making these changes... you are > just moving the configuration from one place (multiple system > properties) to another (one system property pointing to another file > of properties). > > - -chris > As Christopher said, you this file management.properties can be named whatever abc.efg would do the same and in that file you have attribute=value pairs, everything that concerns the com.sun.management.xxx properties. Then you pass the name of that file as a single option to the JVM with -Dcom.sun.management.config.file=${catalina.base}/conf/abc.efg and remove everything else from the CATALINA_OPTS which is in the configuration file. I strongly suggest to locate this file in the same directory as the server.xml file and use the ${catalina.base} variable asis and litterally into the CATALINA_OPTS="-Dcom.sun.management.conf.file=${catalina.base}/conf/abc.efg" definition. I skipped other configuration files for authentication, in my case I am authenticating the users against the Active Directory database. So, the informations I gave for the content of the configuration file is incomplete and do not necessarily apply to your case, that's why I didn't bother to put it in my original post. But, you may have to use extra properties for you particular situation. Why did I say to put everything in the configur
Re: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
Le ven. 3 août 2018 à 12:03, Louis Zipes a écrit : > Good catch!! I still had 'd' in front of my lines so once I removed those > JMX starts up using Management.properties file but as you mentioned it > doesn't really change the behavior at all and the Service still doesn't > stop cleanly. So is there a way to force the JMX to use CATALINA_OPTS in > this file. Something like SET CATALINA_OPTS = 'JMX settings'? > > That is if the JMX running on CATALINA_OPTS is indeed the answer. > Basically, trying to mimic the setenv file that is not used by the Window > Service. > > -Original Message- > From: Christopher Schultz [mailto:ch...@christopherschultz.net] > Sent: Friday, August 03, 2018 11:52 AM > To: users@tomcat.apache.org > Subject: Re: 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 > > Louis, > > On 8/3/18 11:32 AM, Louis Zipes wrote: > > Hi Daniel, I tried your suggestion and while I think it is now > > acknowledging the existence of the management.properties file > > (Windows Service wouldn't start if I purposely misspelled > > 'managemenX.properties') but it doesn't seem to be actually working > > (JMX can't connect). > > > > What I did: > > > > I created a copy of an existing logging.properties file already in > > the CONF folder, renamed it management.properties, and removed all > > contents of it and put in: > > Just FYI, there is nothing magical about an existing properties file. > It's just a text file with name=value items in it. > > > Dcom.sun.management.jmxremote > > Dcom.sun.management.jmxremote.port=8008 > > Dcom.sun.management.jmxremote.authenticate=false > > Dcom.sun.management.jmxremote.ssl=false > > Djava.rmi.server.hostname= > > I don't think you want those leading D characters. Is that a > copy/paste error? > > > -Dcom.sun.management.config.file= C:\ > structure>\Tomcat\conf\management.properties > > Daniel usually knows what he's talking about, but I'll be surprised if > Tomcat doesn't fail the same way after making these changes... you are > just moving the configuration from one place (multiple system > properties) to another (one system property pointing to another file > of properties). > > - -chris > As Christopher said, you this file management.properties can be named whatever abc.efg would do the same and in that file you have attribute=value pairs, everything that concerns the com.sun.management.xxx properties. Then you pass the name of that file as a single option to the JVM with -Dcom.sun.management.config.file=${catalina.base}/conf/abc.efg and remove everything else from the CATALINA_OPTS which is in the configuration file. I strongly suggest to locate this file in the same directory as the server.xml file and use the ${catalina.base} variable asis and litterally into the CATALINA_OPTS="-Dcom.sun.management.conf.file=${catalina.base}/conf/abc.efg" definition. I skipped other configuration files for authentication, in my case I am authenticating the users against the Active Directory database. So, the informations I gave for the content of the configuration file is incomplete and do not necessarily apply to your case, that's why I didn't bother to put it in my original post. But, you may have to use extra properties for you particular situation. Why did I say to put everything in the configuration file for com.sun.management.config.file? Because that way, the JVM knows these are for JMX and knows the port is for JMX and will not run into a nonesense when stopping the service saying the port is already in use. That's why you should put this into the configuration file and define the property to tell the JVM the pathname of the configuration file. Regards, - Daniel Savard
RE: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
Good catch!! I still had 'd' in front of my lines so once I removed those JMX starts up using Management.properties file but as you mentioned it doesn't really change the behavior at all and the Service still doesn't stop cleanly. So is there a way to force the JMX to use CATALINA_OPTS in this file. Something like SET CATALINA_OPTS = 'JMX settings'? That is if the JMX running on CATALINA_OPTS is indeed the answer. Basically, trying to mimic the setenv file that is not used by the Window Service. -Original Message- From: Christopher Schultz [mailto:ch...@christopherschultz.net] Sent: Friday, August 03, 2018 11:52 AM To: users@tomcat.apache.org Subject: Re: 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 Louis, On 8/3/18 11:32 AM, Louis Zipes wrote: > Hi Daniel, I tried your suggestion and while I think it is now > acknowledging the existence of the management.properties file > (Windows Service wouldn't start if I purposely misspelled > 'managemenX.properties') but it doesn't seem to be actually working > (JMX can't connect). > > What I did: > > I created a copy of an existing logging.properties file already in > the CONF folder, renamed it management.properties, and removed all > contents of it and put in: Just FYI, there is nothing magical about an existing properties file. It's just a text file with name=value items in it. > Dcom.sun.management.jmxremote > Dcom.sun.management.jmxremote.port=8008 > Dcom.sun.management.jmxremote.authenticate=false > Dcom.sun.management.jmxremote.ssl=false > Djava.rmi.server.hostname= I don't think you want those leading D characters. Is that a copy/paste error? > -Dcom.sun.management.config.file= C:\ structure>\Tomcat\conf\management.properties Daniel usually knows what he's talking about, but I'll be surprised if Tomcat doesn't fail the same way after making these changes... you are just moving the configuration from one place (multiple system properties) to another (one system property pointing to another file of properties). - -chris -BEGIN PGP SIGNATURE- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAltkejcACgkQHPApP6U8 pFjRPBAAghgmIUA3IBV7qWtk2icUSTOkmF1qd7oFt64pwkitSQmlmJ0FecnDJwVH OoMCEB9yg1KvtIKMOJ9nHDIgTn7an0iS7wK2MzbKZs4cWMAqpxagS6S2M1AmygNr pnsig+WTSmO2r5OkcdWM+JE2qmn+oeQecf2E439RIkEcb/OuzTIJLjk0iIVKSOlQ EihDsVKh+dBvDyDol5RC9k+cxNxNQyYH06ZcOKOTbJCOclMvSUqcqpLesEWnoM5r Zh1TaOXc40HtcvtBQCda6aOdrQE/qieI4pxtduT0BDGxBnjS2GijitrY1isqVv0k RnUYGbvGlcI3OHdfUBAkitl0Bhrx24zqDnaFJ73PHuItlP0aqBeH7eSMTwt5AGXg T7h3PylWdpeL8G2qh1MEdvUCzRKStOHqAYweKnwb0REuNf4YJs6t8n+zRc1sbnkk bNXidsZlUD5ofxdh9fSVeWKiPnHfEYNz3aDqlavymgN1mKDkNJ+qmZoxctEUdKSo Gv4/vNhNOHK6Vb7RSYyp2Ac87jxy4DDl+RL5ltv2oDAp1rIoH1EamDzOTMiJtFpk Sy6EyW8PqWjoLzOBsBC8gH8OdJUNojRkTrl/D+B/dysAEz1tsUw5Kj/4o0HRPvIU svv56gDNaOPTfMbXQvX4vyykfCAxYKKBouB0zyjp7GAY0+4SAG4= =LV/k -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@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.
Re: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Louis, On 8/3/18 11:32 AM, Louis Zipes wrote: > Hi Daniel, I tried your suggestion and while I think it is now > acknowledging the existence of the management.properties file > (Windows Service wouldn't start if I purposely misspelled > 'managemenX.properties') but it doesn't seem to be actually working > (JMX can't connect). > > What I did: > > I created a copy of an existing logging.properties file already in > the CONF folder, renamed it management.properties, and removed all > contents of it and put in: Just FYI, there is nothing magical about an existing properties file. It's just a text file with name=value items in it. > Dcom.sun.management.jmxremote > Dcom.sun.management.jmxremote.port=8008 > Dcom.sun.management.jmxremote.authenticate=false > Dcom.sun.management.jmxremote.ssl=false > Djava.rmi.server.hostname= I don't think you want those leading D characters. Is that a copy/paste error? > -Dcom.sun.management.config.file= C:\ structure>\Tomcat\conf\management.properties Daniel usually knows what he's talking about, but I'll be surprised if Tomcat doesn't fail the same way after making these changes... you are just moving the configuration from one place (multiple system properties) to another (one system property pointing to another file of properties). - -chris -BEGIN PGP SIGNATURE- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAltkejcACgkQHPApP6U8 pFjRPBAAghgmIUA3IBV7qWtk2icUSTOkmF1qd7oFt64pwkitSQmlmJ0FecnDJwVH OoMCEB9yg1KvtIKMOJ9nHDIgTn7an0iS7wK2MzbKZs4cWMAqpxagS6S2M1AmygNr pnsig+WTSmO2r5OkcdWM+JE2qmn+oeQecf2E439RIkEcb/OuzTIJLjk0iIVKSOlQ EihDsVKh+dBvDyDol5RC9k+cxNxNQyYH06ZcOKOTbJCOclMvSUqcqpLesEWnoM5r Zh1TaOXc40HtcvtBQCda6aOdrQE/qieI4pxtduT0BDGxBnjS2GijitrY1isqVv0k RnUYGbvGlcI3OHdfUBAkitl0Bhrx24zqDnaFJ73PHuItlP0aqBeH7eSMTwt5AGXg T7h3PylWdpeL8G2qh1MEdvUCzRKStOHqAYweKnwb0REuNf4YJs6t8n+zRc1sbnkk bNXidsZlUD5ofxdh9fSVeWKiPnHfEYNz3aDqlavymgN1mKDkNJ+qmZoxctEUdKSo Gv4/vNhNOHK6Vb7RSYyp2Ac87jxy4DDl+RL5ltv2oDAp1rIoH1EamDzOTMiJtFpk Sy6EyW8PqWjoLzOBsBC8gH8OdJUNojRkTrl/D+B/dysAEz1tsUw5Kj/4o0HRPvIU svv56gDNaOPTfMbXQvX4vyykfCAxYKKBouB0zyjp7GAY0+4SAG4= =LV/k -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
Hi Daniel, I tried your suggestion and while I think it is now acknowledging the existence of the management.properties file (Windows Service wouldn't start if I purposely misspelled 'managemenX.properties') but it doesn't seem to be actually working (JMX can't connect). What I did: I created a copy of an existing logging.properties file already in the CONF folder, renamed it management.properties, and removed all contents of it and put in: Dcom.sun.management.jmxremote Dcom.sun.management.jmxremote.port=8008 Dcom.sun.management.jmxremote.authenticate=false Dcom.sun.management.jmxremote.ssl=false Djava.rmi.server.hostname= And then in the Tomcat7w GUI under the Java tab I added it (last line) -Dcatalina.home=C:\ \Tomcat -Dcatalina.base=C:\ \Tomcat -Djava.endorsed.dirs=C:\ \Tomcat\endorsed -Djava.io.tmpdir=C:\ \Tomcat\temp -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=C:\ \Tomcat\conf\logging.properties -Dcom.sun.management.config.file= C:\ \Tomcat\conf\management.properties<== new line But it didn't connect through when opening up jconsole.exe under C:\Program Files\Java\jdk1.7.0_80\bin and I didn't see the PORT being used when I did NETSTAT. Note that I did an ECHO %CATALINA_OPTS% to make sure it wasn't hiding somewhere and nothing was returned Finally, just to confirm that my parameters in the management.properties file were correct I add in the contents of it back into the Tomcat7w GUI under the Java tab like I had originally set up (JMX does now work BUT my original problem of not being able to stop the Service cleanly returns) -Dcatalina.home=C:\ \Tomcat -Dcatalina.base=C:\ \Tomcat -Djava.endorsed.dirs=C:\ \Tomcat\endorsed -Djava.io.tmpdir=C:\ \Tomcat\temp -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=C:\ \Tomcat\conf\logging.properties -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8008 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname= Did I miss something in your instructions? Thanks, Louis -Original Message- From: Daniel Savard [mailto:daniel.sav...@gmail.com] Sent: Thursday, August 02, 2018 6:15 PM To: Tomcat Users List Subject: Re: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54 - - - external message, proceed with caution - - - In ${Tomcat}/conf create the file management.properties and put your stuff in this file like: com.sun.management.jmxremote = true com.sun.management.jmxremote.port = 9876 com.sun.management.registry.ssl =true com.sun.management.ssl = true com.sun.management.ssl.enebled.protocols = TLSv1.2 ... Then, remove your stuff from the CATALINA_OPTS and just point to this file with -Dcom.sun.management.config.file=${CATALINA_BASE}/conf/management.properties and you port in use message will disappear since this configuration will be handled properly. Regards, Le 2 août 2018 3:58 PM, "Louis Zipes" a écrit : Hi All, I'm trying to enable JMX monitoring using Tomcat 7.0.54. Turning on the JMX monitoring is not the problem. To do this I added the following to the Apache Tomcat 7.0 Properties 'JAVA' tab GUI Window, which opens up when you run 'TOMCAT7w.exe //ES/', and it works in that JMX can monitor it. -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.port=8555 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl= The problem is that when I go to STOP the Service it gives me the following error Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 8555; nested exception is: java.net.BindException: Address already in use: JVM_Bind I have to do a hard kill by either restarting the Appserver or doing SC QUERY which is not realistic I can find hits on the error message but the answers seem to relate to the need to set up JMX under CATALINA_OPTS. My issue is that I'm struggling to figure out how to set up CATALINA_OPTS that in Windows when starting Tomcat using a Service. The solutions I find either are Linux (I'm Windows) or talks about setting up JMX with a setenv.bat OR catalina.bat files. However, from my research the catalina.bat and setenv files are ignored when you use a Windows Service. So my question is how do I do I set up CATALINA_OPTS parameter in Tomcat 7.0.54 when I'm using a Windows Service? Thanks, Louis --- 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. --- CONFIDENTIALITY NOTICE: This message is for intended addressee(s)
RE: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
Thanks for the response >When you say "stop the service" you just mean clicking the "stop service" link >in the management snap-in, right? Correct >1. You only have a single Tomcat service defined. >2. It starts up just fine. > 3. It only fails when trying to stop it. Correct > Do you have any opportunities for upgrading to 7.0.latest? I have a sandbox where I can try that but it might cause issues with the application I'm running with Tomcat. I will try to try this within the next week and let you know. -Original Message- From: Christopher Schultz [mailto:ch...@christopherschultz.net] Sent: Thursday, August 02, 2018 5:04 PM To: users@tomcat.apache.org Subject: Re: 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 Louis, On 8/2/18 3:58 PM, Louis Zipes wrote: > Hi All, I'm trying to enable JMX monitoring using Tomcat 7.0.54. > Turning on the JMX monitoring is not the problem. To do this I > added the following to the Apache Tomcat 7.0 Properties 'JAVA' tab > GUI Window, which opens up when you run 'TOMCAT7w.exe //ES/ name>', and it works in that JMX can monitor it. > > -Djava.rmi.server.hostname=localhost > -Dcom.sun.management.jmxremote.port=8555 > -Dcom.sun.management.jmxremote.authenticate=false > -Dcom.sun.management.jmxremote.ssl= Congratulations on getting that working. Sometimes it can be a pain to get JMX working. FWIW, I always recommend using the JMX Proxy Servlet[1] because (a) you don't have to set up a remote-JMX port and (b) deal with the poor authentication support and (c) launch a whole JVM process just to take a quick sample. > The problem is that when I go to STOP the Service it gives me the > following error > > Error: Exception thrown by the agent : > java.rmi.server.ExportException: Port already in use: 8555; nested > exception is: java.net.BindException: Address already in use: > JVM_Bind Yuck. When you say "stop the service" you just mean clicking the "stop service" link in the management snap-in, right? Hrm. > I have to do a hard kill by either restarting the Appserver or > doing SC QUERY which is not realistic > > I can find hits on the error message but the answers seem to > relate to the need to set up JMX under CATALINA_OPTS. Yeah, that's usually because someone is using the scripts like catalina.sh (*NIX) or catalina.bat to launch (and stop) Tomcat and they have used JAVA_OPTS (which are applied to all JVM launches) to set those options instead of CATALINA_OPTS (which only applies to starting Tomcat, not to stopping it, etc.). > My issue is that I'm struggling to figure out how to set up > CATALINA_OPTS that in Windows when starting Tomcat using a > Service. Ignore all that. When using the service, the environment variables are not relevant (after creating the service). > The solutions I find either are Linux (I'm Windows) or talks about > setting up JMX with a setenv.bat OR catalina.bat files. > However, from my research the catalina.bat and setenv files are > ignored when you use a Windows Service. Exactly. > So my question is how do I do I set up CATALINA_OPTS parameter in > Tomcat 7.0.54 when I'm using a Windows Service? I'm surprised it's failing at all, honestly. Can you confirm the following: 1. You only have a single Tomcat service defined. 2. It starts up just fine. 3. It only fails when trying to stop it. Do you have any opportunities for upgrading to 7.0.latest? - -chris [1] http://tomcat.apache.org/tomcat-7.0-doc/monitoring.html#Using_the_JMXPro xyServlet -BEGIN PGP SIGNATURE- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAltjcd0ACgkQHPApP6U8 pFis3g/+Ll/6m4VYpII6IFgJF+weoMn9EZ/3E9zbmN/00b63l2uKgNL9rX5eFRXH v+8Mt9HLRy3ve+UXQsCE3dbm0Uw974ujjht6HrTr3dt4uTY6pGU1XtJqxUL4aFXF Ri1xL3CwbO8+lGMNsd7zW80kf9wvcyqDt2NfXKz50Y/EkjiFjPYwVbyO2qWjORx9 JdUGBY7GCyk6E9f/UeEJq1JAWRqX2DAdwOn9l8EQ7ECYpXNyd6Jp7gxO/sIpuEpL NuyRjIjrqyD/7ob65rTEjhXkWarZi5R88RMPmBJ2sHm+mefZQu1sVjJ47sU6emM4 eTAZVgB8RPdtHwjE2+rfezSnKk0969xF8rvI6ehkbaCJ+0qXNYwcqu2lbRhZrPv/ wMNSBj03NToglihLUfmKDraweH3LBvsUdLDLm/mUZoR44l7pjE55o8fc7bT7rJSM 1lFkPOPlXlWtbNrjIMXdLIaJU4fAh8StwQbIdg9Fxku4k9uo7+kT+w52tFVzGq6u dlKKG/uYIzmkSbJQBK/C1q4wy7hgi3s3kd5KnymRAXeBva9tPkbUkKlAvNdQVfxN f5RHdECFF6vL5lLNgcDAHNwRPsQJ2G7nPDdGuoBpf6hQR30jUN7l0nTv/CYYVZY1 0DWlxaVr+/mboIGwOTrB602qKif5FYSuf3WuoogHSuRAueBjBmM= =gT8A -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org --- CONFIDENTIALITY N
RE: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
Thanks. I will try this tomorrow. -Original Message- From: Daniel Savard [mailto:daniel.sav...@gmail.com] Sent: Thursday, August 02, 2018 6:15 PM To: Tomcat Users List Subject: Re: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54 - - - external message, proceed with caution - - - In ${Tomcat}/conf create the file management.properties and put your stuff in this file like: com.sun.management.jmxremote = true com.sun.management.jmxremote.port = 9876 com.sun.management.registry.ssl =true com.sun.management.ssl = true com.sun.management.ssl.enebled.protocols = TLSv1.2 ... Then, remove your stuff from the CATALINA_OPTS and just point to this file with -Dcom.sun.management.config.file=${CATALINA_BASE}/conf/management.properties and you port in use message will disappear since this configuration will be handled properly. Regards, Le 2 août 2018 3:58 PM, "Louis Zipes" a écrit : Hi All, I'm trying to enable JMX monitoring using Tomcat 7.0.54. Turning on the JMX monitoring is not the problem. To do this I added the following to the Apache Tomcat 7.0 Properties 'JAVA' tab GUI Window, which opens up when you run 'TOMCAT7w.exe //ES/', and it works in that JMX can monitor it. -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.port=8555 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl= The problem is that when I go to STOP the Service it gives me the following error Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 8555; nested exception is: java.net.BindException: Address already in use: JVM_Bind I have to do a hard kill by either restarting the Appserver or doing SC QUERY which is not realistic I can find hits on the error message but the answers seem to relate to the need to set up JMX under CATALINA_OPTS. My issue is that I'm struggling to figure out how to set up CATALINA_OPTS that in Windows when starting Tomcat using a Service. The solutions I find either are Linux (I'm Windows) or talks about setting up JMX with a setenv.bat OR catalina.bat files. However, from my research the catalina.bat and setenv files are ignored when you use a Windows Service. So my question is how do I do I set up CATALINA_OPTS parameter in Tomcat 7.0.54 when I'm using a Windows Service? Thanks, Louis --- 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. --- 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.
Re: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
In ${Tomcat}/conf create the file management.properties and put your stuff in this file like: com.sun.management.jmxremote = true com.sun.management.jmxremote.port = 9876 com.sun.management.registry.ssl =true com.sun.management.ssl = true com.sun.management.ssl.enebled.protocols = TLSv1.2 ... Then, remove your stuff from the CATALINA_OPTS and just point to this file with -Dcom.sun.management.config.file=${CATALINA_BASE}/conf/management.properties and you port in use message will disappear since this configuration will be handled properly. Regards, Le 2 août 2018 3:58 PM, "Louis Zipes" a écrit : Hi All, I'm trying to enable JMX monitoring using Tomcat 7.0.54. Turning on the JMX monitoring is not the problem. To do this I added the following to the Apache Tomcat 7.0 Properties 'JAVA' tab GUI Window, which opens up when you run 'TOMCAT7w.exe //ES/', and it works in that JMX can monitor it. -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.port=8555 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl= The problem is that when I go to STOP the Service it gives me the following error Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 8555; nested exception is: java.net.BindException: Address already in use: JVM_Bind I have to do a hard kill by either restarting the Appserver or doing SC QUERY which is not realistic I can find hits on the error message but the answers seem to relate to the need to set up JMX under CATALINA_OPTS. My issue is that I'm struggling to figure out how to set up CATALINA_OPTS that in Windows when starting Tomcat using a Service. The solutions I find either are Linux (I'm Windows) or talks about setting up JMX with a setenv.bat OR catalina.bat files. However, from my research the catalina.bat and setenv files are ignored when you use a Windows Service. So my question is how do I do I set up CATALINA_OPTS parameter in Tomcat 7.0.54 when I'm using a Windows Service? Thanks, Louis --- 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.
Re: Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Louis, On 8/2/18 3:58 PM, Louis Zipes wrote: > Hi All, I'm trying to enable JMX monitoring using Tomcat 7.0.54. > Turning on the JMX monitoring is not the problem. To do this I > added the following to the Apache Tomcat 7.0 Properties 'JAVA' tab > GUI Window, which opens up when you run 'TOMCAT7w.exe //ES/ name>', and it works in that JMX can monitor it. > > -Djava.rmi.server.hostname=localhost > -Dcom.sun.management.jmxremote.port=8555 > -Dcom.sun.management.jmxremote.authenticate=false > -Dcom.sun.management.jmxremote.ssl= Congratulations on getting that working. Sometimes it can be a pain to get JMX working. FWIW, I always recommend using the JMX Proxy Servlet[1] because (a) you don't have to set up a remote-JMX port and (b) deal with the poor authentication support and (c) launch a whole JVM process just to take a quick sample. > The problem is that when I go to STOP the Service it gives me the > following error > > Error: Exception thrown by the agent : > java.rmi.server.ExportException: Port already in use: 8555; nested > exception is: java.net.BindException: Address already in use: > JVM_Bind Yuck. When you say "stop the service" you just mean clicking the "stop service" link in the management snap-in, right? Hrm. > I have to do a hard kill by either restarting the Appserver or > doing SC QUERY which is not realistic > > I can find hits on the error message but the answers seem to > relate to the need to set up JMX under CATALINA_OPTS. Yeah, that's usually because someone is using the scripts like catalina.sh (*NIX) or catalina.bat to launch (and stop) Tomcat and they have used JAVA_OPTS (which are applied to all JVM launches) to set those options instead of CATALINA_OPTS (which only applies to starting Tomcat, not to stopping it, etc.). > My issue is that I'm struggling to figure out how to set up > CATALINA_OPTS that in Windows when starting Tomcat using a > Service. Ignore all that. When using the service, the environment variables are not relevant (after creating the service). > The solutions I find either are Linux (I'm Windows) or talks about > setting up JMX with a setenv.bat OR catalina.bat files. > However, from my research the catalina.bat and setenv files are > ignored when you use a Windows Service. Exactly. > So my question is how do I do I set up CATALINA_OPTS parameter in > Tomcat 7.0.54 when I'm using a Windows Service? I'm surprised it's failing at all, honestly. Can you confirm the following: 1. You only have a single Tomcat service defined. 2. It starts up just fine. 3. It only fails when trying to stop it. Do you have any opportunities for upgrading to 7.0.latest? - -chris [1] http://tomcat.apache.org/tomcat-7.0-doc/monitoring.html#Using_the_JMXPro xyServlet -BEGIN PGP SIGNATURE- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAltjcd0ACgkQHPApP6U8 pFis3g/+Ll/6m4VYpII6IFgJF+weoMn9EZ/3E9zbmN/00b63l2uKgNL9rX5eFRXH v+8Mt9HLRy3ve+UXQsCE3dbm0Uw974ujjht6HrTr3dt4uTY6pGU1XtJqxUL4aFXF Ri1xL3CwbO8+lGMNsd7zW80kf9wvcyqDt2NfXKz50Y/EkjiFjPYwVbyO2qWjORx9 JdUGBY7GCyk6E9f/UeEJq1JAWRqX2DAdwOn9l8EQ7ECYpXNyd6Jp7gxO/sIpuEpL NuyRjIjrqyD/7ob65rTEjhXkWarZi5R88RMPmBJ2sHm+mefZQu1sVjJ47sU6emM4 eTAZVgB8RPdtHwjE2+rfezSnKk0969xF8rvI6ehkbaCJ+0qXNYwcqu2lbRhZrPv/ wMNSBj03NToglihLUfmKDraweH3LBvsUdLDLm/mUZoR44l7pjE55o8fc7bT7rJSM 1lFkPOPlXlWtbNrjIMXdLIaJU4fAh8StwQbIdg9Fxku4k9uo7+kT+w52tFVzGq6u dlKKG/uYIzmkSbJQBK/C1q4wy7hgi3s3kd5KnymRAXeBva9tPkbUkKlAvNdQVfxN f5RHdECFF6vL5lLNgcDAHNwRPsQJ2G7nPDdGuoBpf6hQR30jUN7l0nTv/CYYVZY1 0DWlxaVr+/mboIGwOTrB602qKif5FYSuf3WuoogHSuRAueBjBmM= =gT8A -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Question about setting CATALINA_OPTS when starting Tomcat using a Windows Service in Tomcat 7.0.54
Hi All, I'm trying to enable JMX monitoring using Tomcat 7.0.54. Turning on the JMX monitoring is not the problem. To do this I added the following to the Apache Tomcat 7.0 Properties 'JAVA' tab GUI Window, which opens up when you run 'TOMCAT7w.exe //ES/', and it works in that JMX can monitor it. -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.port=8555 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl= The problem is that when I go to STOP the Service it gives me the following error Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 8555; nested exception is: java.net.BindException: Address already in use: JVM_Bind I have to do a hard kill by either restarting the Appserver or doing SC QUERY which is not realistic I can find hits on the error message but the answers seem to relate to the need to set up JMX under CATALINA_OPTS. My issue is that I'm struggling to figure out how to set up CATALINA_OPTS that in Windows when starting Tomcat using a Service. The solutions I find either are Linux (I'm Windows) or talks about setting up JMX with a setenv.bat OR catalina.bat files.However, from my research the catalina.bat and setenv files are ignored when you use a Windows Service. So my question is how do I do I set up CATALINA_OPTS parameter in Tomcat 7.0.54 when I'm using a Windows Service? Thanks, Louis --- 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.