Getting references to the objects in a VM to dynamically link MBeans

Hi, I am dynamically generating MBeans and using Apache BCEL to change the resource classes to link themselves to the MBeans. The objective is to instrument applications wich we can't access the code and, if possible, do it on a running one.
I could use the Instrumentation API to change the classes of the application and the Attach API to do it on a running application, but only new instances would be affected, so the previously created objects would not be managed. I can generate MBeans in many ways, but can't link them to already running application objects.
So, what i want to know is in the title: is there a way to get references to the objects actually loaded in a Virtual Machine or another way to link an MBean to a running object?
I saw McManus talk at Sun One 2006 about the different ways to link MBeans to application objects, but all of them look to need code changes or previous suport to dependency injection, for example.
http://developers.sun.com/learning/javaoneonline/2006/coreplatform/TS-3523.html
I need it to a technical writing, so an official word can be enough, or even more helpful than a solution.
Thanks,
Gustavo

Gustavo,
Assuming I understand your question correctly, the only way I can see that you can enumerate instances of objects in a Java VM without changing the classes of those objects in any way is to use JVMTI <http://java.sun.com/javase/6/docs/platform/jvmti/jvmti.html#Heap_1_0>. That requires you to write native code somewhere as part of your solution. It is applicable to already-running apps via attach-on-demand <http://java.sun.com/javase/6/docs/jdk/api/attach/spec/index.html>. The MLet service from the JMX API might be convenient here to bridge from the jar file that the Attach API expects to the native code that you need to access JVMTI.
As you can see this is pretty advanced stuff, but your ideas are interesting and I'd be interested in knowing how they work out.
Regards,
�amonn McManus -- JMX Spec Lead -- http://weblogs.java.net/blog/emcmanus

Similar Messages

  • VI Scripting: get reference of the duplicate element

    In VI scripting I copy element (any type of indicator, control, constant) with Move method with duplicate property - true. The output top right terminal of the method is the reference to the source object, not the new one.
    Is there any straightforward way to get reference to that copy (other copy method, etc)?
    Not straightforward solutions (they may work on test examples, but not good)
    1) move to temporary cluster - easy to find a new element
    2) list all objects before, after and compare lists. But the source VI can be of any size and complexity.
    3) Create element copy manually - bad, the solution should work on all kinds of elements.
    Solved!
    Go to Solution.

    Good method.
    It is almost working!
    It can create controls and indicators, but fails with constants (Class conflict, when wiring constant reference to the Source Object Reference terminal)
    Besides, there is a wrong description of the method (LV 2011):
    LabVIEW help
    Create from reference method:
    Source Object Reference
    A reference to the object you want to duplicate on the target VI. If you use this parameter, you do not need to wire the _type descriptor and style fields_.
    There are no type descriptor and style fields at all, they are in other methods
    Who is failing, me or LV? =)
    Attachments:
    Duplicate constant fails.png ‏56 KB

  • Get reference to the stage in a AS Class

    Hello,
    I've created an AIR app with the minimeze() and close()
    options. Now these functions are handled in the MainApp.mxml of the
    application. But I want to move them to a class, so I don't have
    any AS in my MXML file.
    My app works like this now:
    MainApp.mxml creates a new instance the Main.as class (which
    extends MainVisual.mxml) by calling <mainVisual:Main /> in
    the MainApp.mxml
    MainVisual.mxml extends Canvas.
    There I handle all visual elements of my app, but I can't get
    a reference to the stage.nativeWindow here. Does anyone knows how
    to do this?
    Thanks!

    Every display object, including the Canvas, has a stage
    property. However, this property will be null until the Canvas
    object is added to the stage. You can use the ADDED_TO_STAGE event
    to detect when that happens.

  • How Do I Convert a String that Names an Object to a Reference to the Object

    You get many program-specific object names in the XML that is returned by describeType.  Suppose I find an object that interests me.  What is the best way to convert the String that names the object (e.g. the id of the object) to a reference variable that points to the object? 

    Sure.  I am working on a complex application that involves several ViewStacks, several Accordions, some checkboxes, some radio buttons, some text boxes.  These components are scattered about, but all are children of a base class that is successfully enumerated by
    var classInfo:XML = describeType(vwstk);
    Suppose I write a loop as follows:
     for each (var a:XML in classInfo..accessor){
    Inside that loop I have a series of tests like
    if (a.@type == "mx.controls::CheckBox"{
    Then, I iterate thru all of the children of the base class as in:
    for  
    (var u:Object in vwstk)
    {        if  
    Inside the if I persist the checked/not checked status of the checkbox.
    The tricky part is going from the string a.@name to the Object reference u.  I doubt my proposed method will work.  Do you have a better idea?

  • Calling a SubVI without providing a reference to the objects inside the SubVI?

    Hi all,
    Suppose I have a SubVI that plots Y1 vs. X1 and Y2 vs. X2 on the same XYGraph. See the attachment.
    The XYGraph property node is linked to the XYGraph. It sets the line width and point style for each curve on the XYGraph.
    If I call this SubVI 4 times in another code (to make 4 diferent XYGraphs (XYGraph1, XYGraph2, XYGraph3, XYGraph4, each containing two curves for Y1 vs. X1 and Y2 vs. X2)), 
    why would I need to create 4 different references for the 4 different XYGraphs? 
    The question really is this: if the property node is explicitly linked to the XYGraph in the SubVI, why would the property node need to be updated via a reference if the SubVI is called
    multiple times to make multiple XYGraphs? Wouldn't the SubVI take the inputs, plot the curves the XYGraph, update the property nodes and then produce a final XYGraph with
    updated properties?
    Solved!
    Go to Solution.
    Attachments:
    Plot1.vi ‏16 KB

    If this is to be a subVI why do you have a graph on its front panel and manipulating its properties? You need to be manipulating the properties of the graph on the top-level VI's front panel. You see a graph is not a datatype -- it's a display object. All that is passed through terminals to calling VIs is data, and the datatype in this case is an array of clusters containing an array of x-values and an array of y-values.
    If you want to make a subVI that does this operation you have to pass it a reference to the graph you want to manipulate as one of it's input data values.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Differences between using a Object Reference and the Object itself

    Example:
    public class Myclass
    //difference between
    Myclass myobj;
    //and
    Myclass myobj = new Myclass();
    can anyone help me?

    Both lines you showed declare an object reference.
    The first one is not explictely assigned a value and
    is thus implicetly assigned the null reference (= a
    reference pointing to no object). The latter is
    initialized with an reference to the newly created
    Object (new Myclass()).
    They're both given a value of null first.
    The second one is then given a value that points to that object that was created.
    If they were inside a method, then the first one's value would be undefined.

  • Tried to upgrade and after uninstalling and reinstalling several times, keep getting "procedure entry point could not be located in dynamic link library" followed by "iTunes was not installed properly"  Error 7.....Help, please??

    Tried to upgrade as instructed and after uninstalling and reinstalling (even back to the former iTunes which I was happy with)several times, keep getting message "Procedure entry point could not be located in dynamic link library"  followed by "iTunes was not installed properly"  "Error 7".    Help, please??

    Entry point errors can usually be fixed by deleting the offending dll, then repairing the component it is part of from the programs and features control panel. Unfortunately you neglected to include the detail of which dll is mentioned.
    For general advice see Troubleshooting issues with iTunes for Windows updates.
    The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down the page in case one of them applies.
    The further information area has direct links to the current and recent builds in case you have problems downloading, need to revert to an older version or want to try the iTunes for Windows (64-bit - for older video cards) release as a workaround for installation or performance issues, or compatibility with QuickTime or third party software.
    Your library should be unaffected by these steps but there are also links to backup and recovery advice should it be needed.
    tt2

  • Is it possible to get and operate the objects declared in debuggee !?

    Hi,
    I can get the ObjectReferences of the local variables or fields and get or set their values.
    But what I want is to get the real object instance, is it possible ?
    for example: I have a class A, and I want to debug it
    class A{
    StringBuffer sb = new StringBuffer("This is ");
    A(){
    I can get the objectreference "objref_sb" of sb,
    but I wish to get the reference of sb (that's say ref_sb)in class A, such that I can operate ref_sb directly.
    i.e. ref_sb.append("test");
    How can I do it ?
    thanks in advance !

    I wish to get the reference of sb (that's say ref_sb)in
    class A, such that I can operate ref_sb directly.
    i.e. ref_sb.append("test");You would need to evaluate that operation in the debugee VM.
    Take a look at the eval <expr> command in jdb.
    Something like this would do it:
    % cat -n HelloWorld.java
         1  public class HelloWorld {
         2      public static void main(String args[]) {
         3          StringBuffer sb = new StringBuffer();
         4          sb.append("Hello");
         5          System.out.println(sb.toString());
         6      }
         7  }
    % jdb HelloWorld
    Initializing jdb...
    stop at HelloWorld:5Deferring breakpoint HelloWorld:5.
    It will be set after the class is loaded.
    runrun HelloWorld
    >
    VM Started: Set deferred breakpoint HelloWorld:5
    Breakpoint hit: thread="main", HelloWorld.main(), line=5, bci=15
      5         System.out.println(sb.toString());
    main[1] eval sb.append(" world")
    sb.append(" world") = instance of java.lang.StringBuffer(id=193)
    main[1] eval sb.toString()
    sb.toString() = "Hello world"
    main[1] cont
    Hello world
    The application exited

  • No method (within view controlle) to get reference to the window controller

    Hello all,
    I need to fire the exit plug of the window controller out of an embedded view.
    All help I can find in the internet tell me to "easily" get a ref to the window controller and thus to fire its plug as follows:
    data: L_REF_MAIN_WINDOW type ref to IG_MAIN_WINDOW .
    L_REF_MAIN_WINDOW =   WD_THIS->GET_MAIN_WINDOW_CTR( ).
    L_REF_MAIN_WINDOW->FIRE_MY_EXIT_PLUG_PLG(  ).
    But my view-controller dos not implement a method like
    GET_MAIN_WINDOW_CTR( )
    How can I get this method generated? What am I doing wrong?
    Thanks for your replies.
    Edited by: iSD1977 on Aug 23, 2011 4:09 PM

    Hello,
    in the Properties tab of the View Controller, add Window Controller as Used Controller.
    BR, Saravanan

  • Changing the reference of the object?

    public class A {
      public static void change(X a, X b) {
        a = b;
        System.out.println("a:" + a + " b:" + b);
      public static void main(String[] args) {
        X a = new X(1);
        X b = new X(2);
        change(a,b);
        System.out.println("a:" + a + " b:" + b);
    public class X {
      int k = 1;
      public X(int kk){
        k = kk;
      public String toString(){
        return k + "";
    }Why is the output
    a:2 b:2
    a:1 b:2
    not
    a:2 b:2
    a:2 b:2
    Edited by: yeeen on Oct 5, 2009 12:22 PM

    Here's another example:
    public static void main(String[] args) {
        String[] s = {"foo", "bar"};
        changeReference(s);
        System.out.println(Arrays.toString(s)); // Still prints foo, bar. Reference is not changed.
        changeValue(s);
        System.out.println(Arrays.toString(s)); // Prints foo, foo. Value is changed.
    public static void changeReference(String[] s) {
        s = new String[] {"bar", "bar"};
    public static void changeValue(String[] s) {
        s[1] = "foo";
    }

  • Import movie from iPhone gives "An unknown error has occurred while reading the video file. Connecting to Dynamic Link server failed. (1)

    Tried previous suggestions about purging the Camera Raw Cache and I raised it to 20.0 GB.
    Still lightroom fails to read most of the videos that I create on my iPhone 6 plus.
    Aperture, iMovie, and Image Capture have no problem with these files.
    Respectfully,
    Kay Fisher

    This is an iPhoto problem. It is, IMHO, one of the worst photo/video programs ever thought up by any company.
    I suggest you find your original video files, which won't contain any edits and or adjustment you have made in iPhoto, and copy them to some other folder on your drive that you create and then import them to LR.
    Usually iPhoto stores all original image and video files in a folder called Masters buried deep inside the iPhoto Photolibrary package folder. Which makes almost impossible for any normal computer user to get to.
    Next time you are in the market for a new computer think long and hard before you drink the Apple Mac Cool-aid.

  • How do I get a reference to the SecurityServices instance in my web appl?

    I would like to use the audit provider of weblogic to log audit event that I send from my servlet. For writing a auditevent I need a reference to the AuditService instance. How do I obtain that? IS there any static class through with I can get references to the security services?
    Lakshmi

    Pete,
    The Thread class's public static Thread currentThread() method will return a reference to the Thread object that represents the thread of execution that is live when the method is invoked. More simply, it provides a reference to the currently executing thread.
    So you could use this as a key in a hashtable to represent which thread has a lock on some entity:
       // "hash" is a hashtable
       // entity is an Object representing something that is locked (like
       // a record number or a resource identifier)
       hash.put(Thread.currentThread(),entity);I think this answers your question, unless I misunderstood you.
    Damian

  • How to get a reference to the owner of a class instance?

    Within a method of a class, how can I get a reference to the
    object containing the class instance?
    To be clear: I have class B that contains a method, say
    "myfunc()". Class A (say, the application itself or a custom
    component) instantiates a new instance of Class B : myclassB=new
    ClassB()
    Now, from within myfunc() can I get a reference to Class A?
    The simplest way here is to pass a "this" reference when
    calling myfunc(), i.e. "myclassB.myfunc(this)" but I would prefer
    not to have to remember to always use 'this'.

    Are these objects within each other. Does classA own classB?
    If that is the case, then Greg is correct and it should be
    available in parentDocument.
    In projects in the past we have created a central
    refObjectLocator object that is available to all objects.
    Mostly we use events to communicate between objects. Dispatch
    an event and let whoever listen for it.
    Here is a copy of our reflocator if you are interested.
    package com.goconfigure.model {
    import mx.collections.ArrayCollection;
    import com.adobe.cairngorm.model.ModelLocator;
    import com.goconfigure.util.HashMap;
    [Bindable]
    public class RefObjectLocator implements ModelLocator {
    // this instance stores a static reference to itself
    private static var refObject : RefObjectLocator;
    public var refObjectHM : HashMap = new HashMap();
    // singleton: constructor only allows one model locator
    public function AppLocator() : void {
    if ( RefObjectLocator.refObject != null )
    throw new Error( "Only one RefObjectLocator instance should
    be instantiated" );
    // singleton: always returns the one existing static
    instance to itself
    public static function getInstance() : RefObjectLocator {
    if ( refObject == null )
    refObject = new RefObjectLocator();
    return refObject;
    public function addRefObject( pRefObject : Object, pName :
    String ) : void {
    refObjectHM.put(pName,pRefObject);
    public function getRefObject( pName : String ) : Object {
    return refObjectHM.getValue(pName);
    public function removeRefObject( pName : String ) : void {
    refObjectHM.remove(pName);
    public function clearRefObject() : void {
    refObjectHM.clear();

  • ClickOnce: Reference in the manifest does not match the identity of the downloaded assembly Office.dll

    I have WPF application, which has the excel component reference. I have the deployment issue when i user Office 2007 installed on my server and try to access the application i get Reference in the manifest does not match the identity of the downloaded assembly Office.dll , but when office 2003 is installed there is no issue deplying.
    Below is the detail of the issue.
    PLATFORM VERSION INFO
        Windows             : 5.1.2600.131072 (Win32NT)
        Common Language Runtime     : 2.0.50727.3082
        System.Deployment.dll         : 2.0.50727.3053 (netfxsp.050727-3000)
        mscorwks.dll             : 2.0.50727.3082 (QFE.050727-3000)
        dfshim.dll             : 2.0.50727.3053 (netfxsp.050727-3000)
    SOURCES
        Deployment url            : http://<Server>/VFOLDER/pages.xbap
        Application url            : http://Server/VFOLDER/Application%20Files/pages_1_0_0_3/pages.exe.manifest
    IDENTITIES
        Deployment Identity        : pages.xbap, Version=1.0.0.3, Culture=neutral, PublicKeyToken=70c49c4ca21b317d, processorArchitecture=msil
        Application Identity        : pages.exe, Version=1.0.0.3, Culture=neutral, PublicKeyToken=70c49c4ca21b317d, processorArchitecture=msil, type=win32
    APPLICATION SUMMARY
        * Online only application.
        * Browser-hosted application.
    ERROR SUMMARY
        Below is a summary of the errors, details of these errors are listed later in the log.
        * An exception occurred while downloading the application. Following failure messages were detected:
            + Reference in the manifest does not match the identity of the downloaded assembly Office.dll.
    COMPONENT STORE TRANSACTION FAILURE SUMMARY
        No transaction error was detected.
    WARNINGS
        There were no warnings during this operation.
    OPERATION PROGRESS STATUS
        No phase information is available.
    ERROR DETAILS
        Following errors were detected during this operation.
        * [6/22/2009 5:43:31 PM] System.Deployment.Application.InvalidDeploymentException (RefDefValidation)
            - Reference in the manifest does not match the identity of the downloaded assembly Office.dll.
            - Source: System.Deployment
            - Stack trace:
                at System.Deployment.Application.DownloadManager.ProcessDownloadedFile(Object sender, DownloadEventArgs e)
                at System.Deployment.Application.FileDownloader.DownloadModifiedEventHandler.Invoke(Object sender, DownloadEventArgs e)
                at System.Deployment.Application.FileDownloader.OnModified()
                at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
                at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
                at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
                at System.Deployment.Application.DownloadManager.DownloadDependencies(SubscriptionState subState, AssemblyManifest deployManifest, AssemblyManifest appManifest, Uri sourceUriBase, String targetDirectory, String group, IDownloadNotification notification, DownloadOptions options)
                at System.Deployment.Application.DeploymentManager.SynchronizeCore(Boolean blocking)
                at System.Deployment.Application.DeploymentManager.SynchronizeAsyncWorker()
    COMPONENT STORE TRANSACTION DETAILS
        No transaction information is available.
    Any one has faced the problem... any help will be very grateful.
    Thanks in Advance.
    Sunil

    Thanks for the reply Robin, here is some of the observation, hope you can provide some solution from your end.
    1. When Publish my build, in the Manifest file dependentAssembly has two reference to Office.dll one with version 11.0.0.0 and another with version 7.0.3300.0.
    2. In the pages_1_0_0_4 Published folder has one office.dll with version 11.0.5530.0
    3. In the root folder of the virtual directory has one office.dll with version 7.0.9466.0
    Can you please give your thoughts, what exactly wrong with the deployment, i feel its a assembly mismatch.  where in the application files i have set the required assembly. please provide your useful solution.
    Thanks in Advance.
    Sunil

  • Reference to C# objects in TestStand - how to save and retreive them

    I am new to LabView and TestStand.
    I want to use 2 .NET objects in those applications
    In Labiew, I successfully created the objects, manipulate the functions through VIs and closed the references.
    While I could use the VIs for TestStand, I would rather use the DLL directly.
    I am able to create both objects in a sequence, but I have problems with the following:
      - I don't know how to save the reference to the object after the constructor is run.
        - is the object stored in Globlal variables? I tried 'RunState.Engine' but it does not work
      - I don't know how to get the reference back in the other steps where I want to reuse the object to invoke a method on.
      - Once I can do the above, I need to get it to work in the 'batch' or 'parallel' modes.
         I am using successfully the 'RunState.TestSockets.MyIndex' to select my testing resources,
         but I am still confuse as where the array of objects would be.
         Note that I already set the number of DUT <> 1 and I can create successfully my 2 objects in X instances.
    Thanks,
    Daniel Coupal

    dcoupal,
    Getting the reference to the object involves specifying that as a return value in one of your parameters when you specify the module for that action. Inside of the parameters table you can also save that return value as a local object reference and then use it later on in the sequence.
    Regarding your second question, I'm not sure what the array of objects is that you're referring to but this KB might be of some assistance.
    Message Edited by Jon M on 11-01-2006 12:44 PM
    Test Engineer - CTA

Maybe you are looking for