Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 6675
  • Last Modified:

Connecting jconsole to Tomcat on Windows

I am trying to get jconsole to run on my Tomcat 5.5 installation.

I can run jconsole on a sample app that I run from the command line. For example:
$ javac com/example/mbeans/*.java
$ java -Dcom.sun.management.jmxremote com.example.mbeans.Main
$ jconsole

The above works and will find my app.

However for Tomcat I am trying to run jconsole by specifying the PID.  So for example if the pid for Tomcat is 4800:
$ jconsole 4800

I get the following error message:
Unable to attach to 4800: Could not map vmid to user name

Now I am logged in as Administrator.  When I check the task manager, the username for Tomcat is SYSTEM.  The problem is probably here, but I don't know how to resolve it.

And to be thorough in this post, I did set in my CATALINA_OPTS environment variable this line as perscribed and the box has been restarted:
-Dcom.sun.management.jmxremote

Thanks!
0
mtadj
Asked:
mtadj
1 Solution
 
aozarovCommented:
1. did you get your tomcat pid by doing: jps
2. Are you running tomcat with java 1.5
0
 
mtadjAuthor Commented:
In the above example I got the pid from the Windows Task Manager.  Running:
$ jps
gave me a different pid not listed in the task manager.  4748.

However running:
$ jconsole 4748
gave me the same error msg as before.

Yes, we are running java 1.5

Thanks
0
 
aozarovCommented:
Read: http://java.sun.com/performance/jvmstat/faq.html (last section)
15. I'm getting the error "Could not attach to vmid : Could not map vmid to user Name"?
This error message occurs when an application makes a native call to setuid() to change the user id associated with the process. Applications often do this because they need to start as root in order to bind to a TCP/IP port below 1024 but then change to a non-privileged user id through this native call. One workaround to this problem is to configure the application to not use a privileged port and to disable its setuid call. Otherwise the jvmstat tools must be run with the same user credentials as the non-privileged application user.

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
aozarovCommented:
If that is your problem then maybe you want to consider using mod_jk apache to tomcat bridge (so you can bind tomcat to port 8080 without the need for root permissions).
0
 
mtadjAuthor Commented:
Yeah, I had seen that.  I wasn't sure it applied to our situation, but perhaps it does.

We haven't needed mod_jk for anything so far, so the optimal solution would be to have it working with our current configuration.  But I'll take a look at mod_jk in the mean time.

I don't think we have a special setup really, I was hoping there would be some answer to get jconsole to work with tomcat out-of-the-box.

Thanks
0
 
aozarovCommented:
You can run Tomcat as root (though many people don't like it) and in such case there is no need to apply the call to setuid.
0
 
mtadjAuthor Commented:
Okay, still not working, but here's an update and a checklist of what we've done.

 * We are running Tomcat as Administrator now (not root, this is a Windows Server 2003 box) and we are logging in as Administrator
 ** Tomcat's version is 5.5
 ** Tomcat is running as a Service in windows
 ** When I view the Tomcat tasks in Windows Task Manager it says was logged on with Administrator

 * For the CATALINA_OPTS=-Dcom.sun.management.jmxremote environment variable we set this by going to ControlPanel->System->AdvancedTab->EnvironmentVariables and created an entry under System Variables
 ** Even though Tomcat is running as a service, this is still the correct place to set the environment variable, right?

 * For the pid I am a bit confused on which it should be.  All of the following have different pids.
 ** $ jps
 ** Taskmanager has pids for javaw, tomcat5, and tomcat5w
 ** I've tried them all of course
 ** The command to try them is $ jconsole pid
 ** The error message is alwasy the same: Unable to attach to [port number]: Could not map vmid to user name
 
 * If the pid that jconsole needs to connect to is a java one and not a tomcat one, then in this case the user is still SYSTEM.  How would we change this to Administrator, and which pid should it be?  The one from $ pds or the one for javaw in the Task Manager?

Sorry if that's a lot of information, but hopefully it is enough to solve the problem.

Thanks!
0
 
aozarovCommented:
>> this is still the correct place to set the environment variable, right?
For global settings, yes.

For each pid you tried try to run jconsole with that pid user (either login using that user or use the Windows RUNAS command)
0
 
mtadjAuthor Commented:
I think the above suggestions were good but they never solved our problem.  We are not going to pursue this one any further.  Thanks for your help.
0
 
NetminderCommented:
Closed, 500 points refunded.
Netminder
Site Admin
0
 
StampelCommented:
Well i'm not satisfied with the solution , i ran out in the same problem with Windows 2003 (same configuration) and i dont have solution :)
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now