aspose file tools*
The moose likes JBoss/WildFly and the fly likes Using of attach api in Java 5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Using of attach api in Java 5" Watch "Using of attach api in Java 5" New topic
Author

Using of attach api in Java 5

Aliaksei Stasheuski
Greenhorn

Joined: Apr 08, 2011
Posts: 14
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

Joined: May 14, 2008
Posts: 5842
    
    7

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


JBoss In Action
Aliaksei Stasheuski
Greenhorn

Joined: Apr 08, 2011
Posts: 14
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

Joined: Jul 20, 2005
Posts: 10263
    
168

The com.sun.tools.attach.VirtualMachine is a Sun Java implementation specific class and will not work with other vendors of Java.

[My Blog] [JavaRanch Journal]
Aliaksei Stasheuski
Greenhorn

Joined: Apr 08, 2011
Posts: 14
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(
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using of attach api in Java 5