Le ven. 3 août 2018 à 12:03, Louis Zipes <louis.zi...@gmcr.com> 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=<my host machine IP address>
>
> I don't think you want those leading D characters. Is that a
> copy/paste error?
>
> > -Dcom.sun.management.config.file= C:\ <my folder
> > 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

Reply via email to