Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using of attach api in Java 5

 
Aliaksei Stasheuski
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello to everyone! I've recently started writing my own tool(like twiddle) for collecting Mbeans attributes from JBoss server. I'd like it to work in the same manner a Jconsole does. The code is below:

It works in the Java 6 as expected.But the problem is that "VirtualMachine" Class isn't available through the Java 5. Have anybody got any suggestions how to make it work in the Java 5. Thank in advance!
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where did you find the VirtualMachine class? I didn't see that in the javadocs for Java SE 6.

Look for jmx mbean tutorial. There is a really complicated URL that you can use to connect to the JMX manager for any Java app. This might also give some hints: http://community.jboss.org/thread/52375#168437
 
Aliaksei Stasheuski
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for reply! But in the jdk 1.6 the definitelly is such class in the tool.jar archive. which is situated in the lib folder of Java_Home. And what concerns the links you've provided, well it really work and I had it done before your reply. But I need to make in in the way like JConsole does, not through the rmi(I just want to watch MBeans in the locally running machines). The good news is that I've recently found the article I need:

http://bluesjava.blogspot.com/2010/03/access-local-sun-15-jvm-jmx-mxbeans.html

But I actually haven't started to develop the client in such a way. cause I've been installing all the applications on my test environment I need. I'll give you a reply, when I will finish the application.

May be it will happen to be usefull for you too!
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The com.sun.tools.attach.VirtualMachine is a Sun Java implementation specific class and will not work with other vendors of Java.
 
Aliaksei Stasheuski
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello to everybody. I promised to post a reply. when all will be finished. The method. I've proposed in the last post really works, but it needs -Dcom.sun.management.jmxremote to be added to the start configuration of the VM. But It didn't solve the issue in my situation. cause i'm not able to change any cnfiguration on a production server and need to write a request(
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic