You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jakub 1983 <jj...@gmail.com> on 2013/04/07 11:58:32 UTC

tomcat jmx disabled by default ?

why do I have to enable jmx with command

*set CATALINA_OPTS=-Dcom.sun.management.jmxremote \
    -Dcom.sun.management.jmxremote.port=%my.jmx.port% \
    -Dcom.sun.management.jmxremote.ssl=false \
    -Dcom.sun.management.jmxremote.authenticate=false*


http://tomcat.apache.org/tomcat-7.0-doc/monitoring.html

even when I run it *under java 6* ?
in java 6 jmx is active by default (it is active when I run my own main),
I cannot see how it is disabled by default by tomcat start scripts,
but when I run default startup, I cannot connect with jconsole,
when I set CATALINA_OPTS as above, it works fine,
but why doesn't it work without it ?

regards
Jakub

Re: tomcat jmx disabled by default ?

Posted by Rainer Frey <ra...@inxmail.de>.
On 07.04.2013, at 11:58, Jakub 1983 <jj...@gmail.com> wrote:

> why do I have to enable jmx with command
> 
> *set CATALINA_OPTS=-Dcom.sun.management.jmxremote \
>    -Dcom.sun.management.jmxremote.port=%my.jmx.port% \
>    -Dcom.sun.management.jmxremote.ssl=false \
>    -Dcom.sun.management.jmxremote.authenticate=false*
> 
> 
> http://tomcat.apache.org/tomcat-7.0-doc/monitoring.html


Do you have the remote JMX lifecycle listener activated 
(from http://tomcat.apache.org/tomcat-7.0-doc/config/listeners.html#JMX_Remote_Lifecycle_Listener_-_org.apache.catalina.mbeans.JmxRemoteLifecycleListener)

This will IIRC disable the default JMX initialization.

Rainer


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


Re: tomcat jmx disabled by default ?

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

Jakub,

On 4/7/13 5:58 AM, Jakub 1983 wrote:
> why do I have to enable jmx with command
> 
> *set CATALINA_OPTS=-Dcom.sun.management.jmxremote \ 
> -Dcom.sun.management.jmxremote.port=%my.jmx.port% \ 
> -Dcom.sun.management.jmxremote.ssl=false \ 
> -Dcom.sun.management.jmxremote.authenticate=false*
> 
> 
> http://tomcat.apache.org/tomcat-7.0-doc/monitoring.html
> 
> even when I run it *under java 6* ? in java 6 jmx is active by
> default (it is active when I run my own main), I cannot see how it
> is disabled by default by tomcat start scripts, but when I run
> default startup, I cannot connect with jconsole, when I set
> CATALINA_OPTS as above, it works fine, but why doesn't it work
> without it ?

The above configuration sets up *remote* JMX management. JMX is always
enabled, and you can connect from localhost (as the same user, or
root) using tools like jvisualvm, etc. without specifying any of the
stuff above.

Note that enabling remote authentication with authentication disabled
(and SSL disabled, too!) is pretty much a terrible idea: anyone can
connect to your server and do all sorts of evil things.

Of course, firewalls, etc. can be configured to restrict access, but
it's generally a good idea to also restrict access via password and
encrypt the traffic from the remote host to the server.

Thanks,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRYZXfAAoJEBzwKT+lPKRYLlkP/3ue8hSLskZwyZIWxBbbltzH
5M5pWhSaViWAGxsszvx7BFqRQEUYOgndGl/TUsRNSc6rM/RQ2Gcq603/G22dsmLv
uM5IPnKV7D8Sk3g/qbG/b8kbPy2s+5d1QlEZF0gKVHbIS21uNmnhUyJE/KqjU858
lZmSNpfcSmtR0In+7BPDsy9QFGswkSQu7ZQdfGxhnIdTlbgIhFYz3+acHbC3hYpL
BW0hvgUNyUjJ3SvjzHpAaociXP8HyQPfWooj/aWOex2rgi+5D5LfxlBI2qfXDGj0
4gakMIUq+ONBHSFBEp3HcaS2BzUWbZ2gpghHFurQOdbrwXA/etfkC4ksiTsh2utU
M/k5wQ3XcpmuWjnWga6ATXWiFIiv8g+nhAl2mkl2bwkWPcrOPTK5O9WFA12zQaIZ
w202VopEQOqx6qlivaNQA1xXbM6SN7ZV3DjO+SMValuSMAllQ5LoueaL37lTTZIA
kGJ8+XonoN4GFBZ7snaL+mGtKTxykUjgg/s01eaOh4RL1NFrFRMPWy30JI4hQ8l/
DhJ8vv+ZKeoEqRvmCCfCB05tyWEgRG1qIS0AQTU+A5f70WRRkTJGvC16GMypn+kJ
+ioIdomkadTQsydkyxVEzTU6jagGSn8Xu0s/xUzQEXyM72/ausjZoOp5CaDCvr4o
Yjg2+7lZ5IVcAHO5Zgcz
=z+Y8
-----END PGP SIGNATURE-----

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


Re: tomcat jmx disabled by default ?

Posted by André Warnier <aw...@ice-sa.com>.
Jakub 1983 wrote:
> why do I have to enable jmx with command
> 
> *set CATALINA_OPTS=-Dcom.sun.management.jmxremote \
>     -Dcom.sun.management.jmxremote.port=%my.jmx.port% \
>     -Dcom.sun.management.jmxremote.ssl=false \
>     -Dcom.sun.management.jmxremote.authenticate=false*
> 
> 
> http://tomcat.apache.org/tomcat-7.0-doc/monitoring.html
> 
> even when I run it *under java 6* ?
> in java 6 jmx is active by default (it is active when I run my own main),
> I cannot see how it is disabled by default by tomcat start scripts,
> but when I run default startup, I cannot connect with jconsole,
> when I set CATALINA_OPTS as above, it works fine,
> but why doesn't it work without it ?
> 

What you say above seems to me largely nonsense.
There is nothing in the standard Tomcat startup scripts which sets or unsets these 
properties.  Consult the following page to see what the Java JVM defaults are for Oracle's 
Java 1.7.

http://docs.oracle.com/javase/7/docs/technotes/guides/management/agent.html

(for example, com.sun.management.jmxremote.ssl is true by default)

Other versions may have different properties or values.
Pre-packaged versions of Tomcat for various OS/platforms may also have different defaults, 
but that depends on those packages, not on Tomcat per se.

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


Re: tomcat jmx disabled by default ?

Posted by Jakub 1983 <jj...@gmail.com>.
The problem is solved,

It was caused by running jconsole with different version of java than
Tomcat.

Neven, thx again for suggestions and help.

Regards,
Jakub


On Mon, Apr 8, 2013 at 7:49 AM, Zdeněk Henek <vr...@gmail.com> wrote:

> Hi Jakub,
>
> do you have running Tomcat and JConsole as same user?
>
> JMX should really work out of box when both Tomcat and JConsole/JVisualVM
> are in same machine and same user.
>
> Regards,
> Zdenek
>
>
> On Sun, Apr 7, 2013 at 9:15 PM, Neven Cvetkovic
> <ne...@gmail.com>wrote:
>
> > Mark,
> >
> > When connecting to local jmx, connection is not over the network
> interface
> > but through local Java process that you need to have access to. So I
> doubt
> > that is Jakub's problem here.
> >
> > I've had issues when jdks didn't match and when different users were used
> > to start JVM process.
> >  On Apr 7, 2013 3:09 PM, "Mark Eggers" <it...@yahoo.com> wrote:
> >
> > > On 4/7/2013 7:54 AM, Jakub 1983 wrote:
> > >
> > >> Neven,
> > >>
> > >> thx for your reply,
> > >>
> > >> so my question is why when I start my own main without passing
> > >> -Dcom.sun.management.* properties I can connect to it with jconsole,
> > >> but I cannot connect with jconsole to tomcat (although it is visible
> in
> > >> jconsole) ?
> > >>
> > >> both my main, and tomcat, and jconsole are running on the same laptop.
> > >>
> > >> regards,
> > >> Jakub
> > >>
> > >>
> > >>
> > >>
> > >> On Sun, Apr 7, 2013 at 3:49 PM, Neven Cvetkovic
> > >> <ne...@gmail.com>**wrote:
> > >>
> > >>  Jakub,
> > >>>
> > >>> "You don't have to" configure Tomcat with above settings to get JMX.
> > You
> > >>> are correct that JMX works out of the box. However, that works only
> > >>> locally, above commands are for REMOTE JMX access. You are opening
> up a
> > >>> jmx
> > >>> port so external (not same machine) jconsole or jvirtualvm can access
> > JMX
> > >>> MBean server your Tomcat is running. Thus, if you want to connect to
> > >>> remote
> > >>> Tomcat instance, "you have to provide" JMX connection details, and
> > that's
> > >>> what we often do.
> > >>>
> > >>> The above settings are best configured in
> CATALINA_HOME/bin/setenv.bat
> > or
> > >>> setenv.sh script that you need to create. Even though this script
> > doesn't
> > >>> exist by default, startup script calls it if it is created by user.
> All
> > >>> your customizations should be contained there.
> > >>>
> > >>> Hope that helps. Cheers!
> > >>> On Apr 7, 2013 5:59 AM, "Jakub 1983" <jj...@gmail.com> wrote:
> > >>>
> > >>>  why do I have to enable jmx with command
> > >>>>
> > >>>> *set CATALINA_OPTS=-Dcom.sun.**management.jmxremote \
> > >>>>      -Dcom.sun.management.**jmxremote.port=%my.jmx.port% \
> > >>>>      -Dcom.sun.management.**jmxremote.ssl=false \
> > >>>>      -Dcom.sun.management.**jmxremote.authenticate=false*
> > >>>>
> > >>>>
> > >>>> http://tomcat.apache.org/**tomcat-7.0-doc/monitoring.html<
> > http://tomcat.apache.org/tomcat-7.0-doc/monitoring.html>
> > >>>>
> > >>>> even when I run it *under java 6* ?
> > >>>> in java 6 jmx is active by default (it is active when I run my own
> > >>>> main),
> > >>>> I cannot see how it is disabled by default by tomcat start scripts,
> > >>>> but when I run default startup, I cannot connect with jconsole,
> > >>>> when I set CATALINA_OPTS as above, it works fine,
> > >>>> but why doesn't it work without it ?
> > >>>>
> > >>>> regards
> > >>>> Jakub
> > >>>>
> > >>>>
> > >>>
> > >>
> > > Works for me . . . I just started my Tomcat 7.0.39 with Java 6 and a
> Java
> > > 6 version of jconsole connects right up:
> > >
> > > Environment:
> > >
> > > OS: Windows 7 Home Premium 64 bit
> > > JRE / JDK: 1.6.0_43
> > > Tomcat: 7.0.39
> > >
> > > I have a setenv.bat with:
> > >
> > > set "JRE_HOME=C:\Program Files\Java\jre6"
> > >
> > > since my normal environment is JRE / JDK 7.
> > >
> > > Maybe your Windows firewall isn't configured to allow Java network
> > > connections? However that wouldn't explain why it works when JMX is
> > > configured.
> > >
> > > . . . . just my two cents.
> > > /mde/
> > >
> > >
> > >
> ------------------------------**------------------------------**---------
> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.**apache.org<
> > users-unsubscribe@tomcat.apache.org>
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >
> > >
> >
>

Re: tomcat jmx disabled by default ?

Posted by Zdeněk Henek <vr...@gmail.com>.
Hi Jakub,

do you have running Tomcat and JConsole as same user?

JMX should really work out of box when both Tomcat and JConsole/JVisualVM
are in same machine and same user.

Regards,
Zdenek


On Sun, Apr 7, 2013 at 9:15 PM, Neven Cvetkovic
<ne...@gmail.com>wrote:

> Mark,
>
> When connecting to local jmx, connection is not over the network interface
> but through local Java process that you need to have access to. So I doubt
> that is Jakub's problem here.
>
> I've had issues when jdks didn't match and when different users were used
> to start JVM process.
>  On Apr 7, 2013 3:09 PM, "Mark Eggers" <it...@yahoo.com> wrote:
>
> > On 4/7/2013 7:54 AM, Jakub 1983 wrote:
> >
> >> Neven,
> >>
> >> thx for your reply,
> >>
> >> so my question is why when I start my own main without passing
> >> -Dcom.sun.management.* properties I can connect to it with jconsole,
> >> but I cannot connect with jconsole to tomcat (although it is visible in
> >> jconsole) ?
> >>
> >> both my main, and tomcat, and jconsole are running on the same laptop.
> >>
> >> regards,
> >> Jakub
> >>
> >>
> >>
> >>
> >> On Sun, Apr 7, 2013 at 3:49 PM, Neven Cvetkovic
> >> <ne...@gmail.com>**wrote:
> >>
> >>  Jakub,
> >>>
> >>> "You don't have to" configure Tomcat with above settings to get JMX.
> You
> >>> are correct that JMX works out of the box. However, that works only
> >>> locally, above commands are for REMOTE JMX access. You are opening up a
> >>> jmx
> >>> port so external (not same machine) jconsole or jvirtualvm can access
> JMX
> >>> MBean server your Tomcat is running. Thus, if you want to connect to
> >>> remote
> >>> Tomcat instance, "you have to provide" JMX connection details, and
> that's
> >>> what we often do.
> >>>
> >>> The above settings are best configured in CATALINA_HOME/bin/setenv.bat
> or
> >>> setenv.sh script that you need to create. Even though this script
> doesn't
> >>> exist by default, startup script calls it if it is created by user. All
> >>> your customizations should be contained there.
> >>>
> >>> Hope that helps. Cheers!
> >>> On Apr 7, 2013 5:59 AM, "Jakub 1983" <jj...@gmail.com> wrote:
> >>>
> >>>  why do I have to enable jmx with command
> >>>>
> >>>> *set CATALINA_OPTS=-Dcom.sun.**management.jmxremote \
> >>>>      -Dcom.sun.management.**jmxremote.port=%my.jmx.port% \
> >>>>      -Dcom.sun.management.**jmxremote.ssl=false \
> >>>>      -Dcom.sun.management.**jmxremote.authenticate=false*
> >>>>
> >>>>
> >>>> http://tomcat.apache.org/**tomcat-7.0-doc/monitoring.html<
> http://tomcat.apache.org/tomcat-7.0-doc/monitoring.html>
> >>>>
> >>>> even when I run it *under java 6* ?
> >>>> in java 6 jmx is active by default (it is active when I run my own
> >>>> main),
> >>>> I cannot see how it is disabled by default by tomcat start scripts,
> >>>> but when I run default startup, I cannot connect with jconsole,
> >>>> when I set CATALINA_OPTS as above, it works fine,
> >>>> but why doesn't it work without it ?
> >>>>
> >>>> regards
> >>>> Jakub
> >>>>
> >>>>
> >>>
> >>
> > Works for me . . . I just started my Tomcat 7.0.39 with Java 6 and a Java
> > 6 version of jconsole connects right up:
> >
> > Environment:
> >
> > OS: Windows 7 Home Premium 64 bit
> > JRE / JDK: 1.6.0_43
> > Tomcat: 7.0.39
> >
> > I have a setenv.bat with:
> >
> > set "JRE_HOME=C:\Program Files\Java\jre6"
> >
> > since my normal environment is JRE / JDK 7.
> >
> > Maybe your Windows firewall isn't configured to allow Java network
> > connections? However that wouldn't explain why it works when JMX is
> > configured.
> >
> > . . . . just my two cents.
> > /mde/
> >
> >
> > ------------------------------**------------------------------**---------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.**apache.org<
> users-unsubscribe@tomcat.apache.org>
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
>

Re: tomcat jmx disabled by default ?

Posted by Neven Cvetkovic <ne...@gmail.com>.
On Tue, Apr 9, 2013 at 10:15 AM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Neven,
>
> On 4/7/13 3:15 PM, Neven Cvetkovic wrote:
> > Mark,
> >
> > When connecting to local jmx, connection is not over the network
> > interface but through local Java process that you need to have
> > access to. So I doubt that is Jakub's problem here.
> >
> > I've had issues when jdks didn't match and when different users
> > were used to start JVM process.
>
> This might be the issue: if the JVM versions of the target process
> (e.g. Tomcat) and the connecting process (e.g. jvisualvm) are not the
> same, then the Attach API (local only) probably will fail.
>
> On the other hand, using "remote JMX" access, two different JVMs ought
> to be able to communicate because they are just using RMI to trade
> objects that are fairly well-defined and stable.


Chris,

That was exactly the issue and explains why system worked when going over
REMOTE JMX ports, and not for local connections.

Tomcat startup used JRE (that comes with windows, since
%SystemRoot%\system32 was defined in path before %JAVA_HOME%\bin) and
JConsole and JVisualVM used JDK (only defined in %JAVA_HOME%\bin) and those
were different versions and that caused the local connection failure.

However, when JMX REMOTE ports were defined and attached to JVM, JConsole
(of different JVM version) was able to connect to REMOTE JVM using well
defined JMX API.

:)

Re: tomcat jmx disabled by default ?

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

Neven,

On 4/7/13 3:15 PM, Neven Cvetkovic wrote:
> Mark,
> 
> When connecting to local jmx, connection is not over the network
> interface but through local Java process that you need to have
> access to. So I doubt that is Jakub's problem here.
> 
> I've had issues when jdks didn't match and when different users
> were used to start JVM process.

This might be the issue: if the JVM versions of the target process
(e.g. Tomcat) and the connecting process (e.g. jvisualvm) are not the
same, then the Attach API (local only) probably will fail.

On the other hand, using "remote JMX" access, two different JVMs ought
to be able to communicate because they are just using RMI to trade
objects that are fairly well-defined and stable.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRZCKQAAoJEBzwKT+lPKRYbI8QAMXH4is5ICJFgIHxmlBs2vtH
0uwXXONU4PywQ72buaSMQoXD+G12iRtaD/iExIiIBL8aRPCbjg0oj3IvO4FddIja
8hYc3pvwrT+fUk17dfPviDDgI+AO1ZALcBxnEQ28J5xXXGDlZuINGAX1/fpyw/3K
ZLQQAvLXaKnzNHWYO2a+V/kC/GPrZg+QZHXG6m3aoDlfQCI8ncVe/dLnDSgGp0J1
ixsR7f0vB6MKP8UTkAEDdQzzY9Ogpr1sCu4MOZWyx5uUFJ2OM+dC2gNYVAIt2JQA
sjteVzVs2hRQ9koNvVq9XXsKbtr39x1SX5ir6NMBEXpoBiPTqm2Pq4aNV0VmZpHH
pT+z84GmMZAEDpsniDV88JZAO8i9Y20LIxJUiFqmIW8qicd4OEhmzZYcWK7jk+k9
zkpZsGYIXHW6iFsjZ3viOAuZqa/9Gq9xQlWPic6HpWtLpzqzGi2iHSzrW8mpoJsd
hq+zaEldQ48F32CjmhgBZJdBfvI0LcxFBppHMmVEit33Ma0VdQWPlDCsEgZLiQSh
rbLLraUwh36cHFoWiLRMw1Zla1M1xiAhV2Zil6wqbF4DS/sQHFRVlEqUsip6DleL
b4jtCa2MgEFdyzwBoi1rWquVghZdSkfMhFiRSRn+z0zmZM24Av09tx7StKCzjrVf
K/Vdm/ctCANg46lh05uY
=jLkx
-----END PGP SIGNATURE-----

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


Re: tomcat jmx disabled by default ?

Posted by Neven Cvetkovic <ne...@gmail.com>.
Mark,

When connecting to local jmx, connection is not over the network interface
but through local Java process that you need to have access to. So I doubt
that is Jakub's problem here.

I've had issues when jdks didn't match and when different users were used
to start JVM process.
 On Apr 7, 2013 3:09 PM, "Mark Eggers" <it...@yahoo.com> wrote:

> On 4/7/2013 7:54 AM, Jakub 1983 wrote:
>
>> Neven,
>>
>> thx for your reply,
>>
>> so my question is why when I start my own main without passing
>> -Dcom.sun.management.* properties I can connect to it with jconsole,
>> but I cannot connect with jconsole to tomcat (although it is visible in
>> jconsole) ?
>>
>> both my main, and tomcat, and jconsole are running on the same laptop.
>>
>> regards,
>> Jakub
>>
>>
>>
>>
>> On Sun, Apr 7, 2013 at 3:49 PM, Neven Cvetkovic
>> <ne...@gmail.com>**wrote:
>>
>>  Jakub,
>>>
>>> "You don't have to" configure Tomcat with above settings to get JMX. You
>>> are correct that JMX works out of the box. However, that works only
>>> locally, above commands are for REMOTE JMX access. You are opening up a
>>> jmx
>>> port so external (not same machine) jconsole or jvirtualvm can access JMX
>>> MBean server your Tomcat is running. Thus, if you want to connect to
>>> remote
>>> Tomcat instance, "you have to provide" JMX connection details, and that's
>>> what we often do.
>>>
>>> The above settings are best configured in CATALINA_HOME/bin/setenv.bat or
>>> setenv.sh script that you need to create. Even though this script doesn't
>>> exist by default, startup script calls it if it is created by user. All
>>> your customizations should be contained there.
>>>
>>> Hope that helps. Cheers!
>>> On Apr 7, 2013 5:59 AM, "Jakub 1983" <jj...@gmail.com> wrote:
>>>
>>>  why do I have to enable jmx with command
>>>>
>>>> *set CATALINA_OPTS=-Dcom.sun.**management.jmxremote \
>>>>      -Dcom.sun.management.**jmxremote.port=%my.jmx.port% \
>>>>      -Dcom.sun.management.**jmxremote.ssl=false \
>>>>      -Dcom.sun.management.**jmxremote.authenticate=false*
>>>>
>>>>
>>>> http://tomcat.apache.org/**tomcat-7.0-doc/monitoring.html<http://tomcat.apache.org/tomcat-7.0-doc/monitoring.html>
>>>>
>>>> even when I run it *under java 6* ?
>>>> in java 6 jmx is active by default (it is active when I run my own
>>>> main),
>>>> I cannot see how it is disabled by default by tomcat start scripts,
>>>> but when I run default startup, I cannot connect with jconsole,
>>>> when I set CATALINA_OPTS as above, it works fine,
>>>> but why doesn't it work without it ?
>>>>
>>>> regards
>>>> Jakub
>>>>
>>>>
>>>
>>
> Works for me . . . I just started my Tomcat 7.0.39 with Java 6 and a Java
> 6 version of jconsole connects right up:
>
> Environment:
>
> OS: Windows 7 Home Premium 64 bit
> JRE / JDK: 1.6.0_43
> Tomcat: 7.0.39
>
> I have a setenv.bat with:
>
> set "JRE_HOME=C:\Program Files\Java\jre6"
>
> since my normal environment is JRE / JDK 7.
>
> Maybe your Windows firewall isn't configured to allow Java network
> connections? However that wouldn't explain why it works when JMX is
> configured.
>
> . . . . just my two cents.
> /mde/
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.**apache.org<us...@tomcat.apache.org>
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: tomcat jmx disabled by default ?

Posted by Mark Eggers <it...@yahoo.com>.
On 4/7/2013 7:54 AM, Jakub 1983 wrote:
> Neven,
>
> thx for your reply,
>
> so my question is why when I start my own main without passing
> -Dcom.sun.management.* properties I can connect to it with jconsole,
> but I cannot connect with jconsole to tomcat (although it is visible in
> jconsole) ?
>
> both my main, and tomcat, and jconsole are running on the same laptop.
>
> regards,
> Jakub
>
>
>
>
> On Sun, Apr 7, 2013 at 3:49 PM, Neven Cvetkovic
> <ne...@gmail.com>wrote:
>
>> Jakub,
>>
>> "You don't have to" configure Tomcat with above settings to get JMX. You
>> are correct that JMX works out of the box. However, that works only
>> locally, above commands are for REMOTE JMX access. You are opening up a jmx
>> port so external (not same machine) jconsole or jvirtualvm can access JMX
>> MBean server your Tomcat is running. Thus, if you want to connect to remote
>> Tomcat instance, "you have to provide" JMX connection details, and that's
>> what we often do.
>>
>> The above settings are best configured in CATALINA_HOME/bin/setenv.bat or
>> setenv.sh script that you need to create. Even though this script doesn't
>> exist by default, startup script calls it if it is created by user. All
>> your customizations should be contained there.
>>
>> Hope that helps. Cheers!
>> On Apr 7, 2013 5:59 AM, "Jakub 1983" <jj...@gmail.com> wrote:
>>
>>> why do I have to enable jmx with command
>>>
>>> *set CATALINA_OPTS=-Dcom.sun.management.jmxremote \
>>>      -Dcom.sun.management.jmxremote.port=%my.jmx.port% \
>>>      -Dcom.sun.management.jmxremote.ssl=false \
>>>      -Dcom.sun.management.jmxremote.authenticate=false*
>>>
>>>
>>> http://tomcat.apache.org/tomcat-7.0-doc/monitoring.html
>>>
>>> even when I run it *under java 6* ?
>>> in java 6 jmx is active by default (it is active when I run my own main),
>>> I cannot see how it is disabled by default by tomcat start scripts,
>>> but when I run default startup, I cannot connect with jconsole,
>>> when I set CATALINA_OPTS as above, it works fine,
>>> but why doesn't it work without it ?
>>>
>>> regards
>>> Jakub
>>>
>>
>

Works for me . . . I just started my Tomcat 7.0.39 with Java 6 and a 
Java 6 version of jconsole connects right up:

Environment:

OS: Windows 7 Home Premium 64 bit
JRE / JDK: 1.6.0_43
Tomcat: 7.0.39

I have a setenv.bat with:

set "JRE_HOME=C:\Program Files\Java\jre6"

since my normal environment is JRE / JDK 7.

Maybe your Windows firewall isn't configured to allow Java network 
connections? However that wouldn't explain why it works when JMX is 
configured.

. . . . just my two cents.
/mde/


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


Re: tomcat jmx disabled by default ?

Posted by Neven Cvetkovic <ne...@gmail.com>.
Jakub,

I am not sure that I understand "when I start my own main ..." - I
assume you refer to your own Java class that has main() method and
that you start, e.g.

java com.mydomain.MyApp

What specific command do you use when starting up your Tomcat? Also,
include what version and what operating system you use (I assume 7.0.x
and Windows). Also include which version of JDK you use (I assume JDK
1.6.0_x).

So when you start jconsole (or similar tool jvisualvm - try it if you
haven't already it is an awesome tool) - you should see the list of
all Java processes that you have access to. You should be able to
connect to any Java process listed there, including Catalina/Tomcat
process (usually defined with pid - process id) and including your own
application (MyApp). Once you connect to a Java process, you would be
able to see JMX namespaces, MBeans, memory configuration, classes
loaded, etc...

So, does the Tomcat process show up in the list of processes (without
remote JMX configuration) same way your MyApp shows up? When you try
to connect to Tomcat/Catalina process what is the error message if
any?

What user owns the Tomcat process?

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


Re: tomcat jmx disabled by default ?

Posted by Jakub 1983 <jj...@gmail.com>.
Neven,

thx for your reply,

so my question is why when I start my own main without passing
-Dcom.sun.management.* properties I can connect to it with jconsole,
but I cannot connect with jconsole to tomcat (although it is visible in
jconsole) ?

both my main, and tomcat, and jconsole are running on the same laptop.

regards,
Jakub




On Sun, Apr 7, 2013 at 3:49 PM, Neven Cvetkovic
<ne...@gmail.com>wrote:

> Jakub,
>
> "You don't have to" configure Tomcat with above settings to get JMX. You
> are correct that JMX works out of the box. However, that works only
> locally, above commands are for REMOTE JMX access. You are opening up a jmx
> port so external (not same machine) jconsole or jvirtualvm can access JMX
> MBean server your Tomcat is running. Thus, if you want to connect to remote
> Tomcat instance, "you have to provide" JMX connection details, and that's
> what we often do.
>
> The above settings are best configured in CATALINA_HOME/bin/setenv.bat or
> setenv.sh script that you need to create. Even though this script doesn't
> exist by default, startup script calls it if it is created by user. All
> your customizations should be contained there.
>
> Hope that helps. Cheers!
> On Apr 7, 2013 5:59 AM, "Jakub 1983" <jj...@gmail.com> wrote:
>
> > why do I have to enable jmx with command
> >
> > *set CATALINA_OPTS=-Dcom.sun.management.jmxremote \
> >     -Dcom.sun.management.jmxremote.port=%my.jmx.port% \
> >     -Dcom.sun.management.jmxremote.ssl=false \
> >     -Dcom.sun.management.jmxremote.authenticate=false*
> >
> >
> > http://tomcat.apache.org/tomcat-7.0-doc/monitoring.html
> >
> > even when I run it *under java 6* ?
> > in java 6 jmx is active by default (it is active when I run my own main),
> > I cannot see how it is disabled by default by tomcat start scripts,
> > but when I run default startup, I cannot connect with jconsole,
> > when I set CATALINA_OPTS as above, it works fine,
> > but why doesn't it work without it ?
> >
> > regards
> > Jakub
> >
>

Re: tomcat jmx disabled by default ?

Posted by Neven Cvetkovic <ne...@gmail.com>.
Jakub,

"You don't have to" configure Tomcat with above settings to get JMX. You
are correct that JMX works out of the box. However, that works only
locally, above commands are for REMOTE JMX access. You are opening up a jmx
port so external (not same machine) jconsole or jvirtualvm can access JMX
MBean server your Tomcat is running. Thus, if you want to connect to remote
Tomcat instance, "you have to provide" JMX connection details, and that's
what we often do.

The above settings are best configured in CATALINA_HOME/bin/setenv.bat or
setenv.sh script that you need to create. Even though this script doesn't
exist by default, startup script calls it if it is created by user. All
your customizations should be contained there.

Hope that helps. Cheers!
On Apr 7, 2013 5:59 AM, "Jakub 1983" <jj...@gmail.com> wrote:

> why do I have to enable jmx with command
>
> *set CATALINA_OPTS=-Dcom.sun.management.jmxremote \
>     -Dcom.sun.management.jmxremote.port=%my.jmx.port% \
>     -Dcom.sun.management.jmxremote.ssl=false \
>     -Dcom.sun.management.jmxremote.authenticate=false*
>
>
> http://tomcat.apache.org/tomcat-7.0-doc/monitoring.html
>
> even when I run it *under java 6* ?
> in java 6 jmx is active by default (it is active when I run my own main),
> I cannot see how it is disabled by default by tomcat start scripts,
> but when I run default startup, I cannot connect with jconsole,
> when I set CATALINA_OPTS as above, it works fine,
> but why doesn't it work without it ?
>
> regards
> Jakub
>