Accessing an MBean Programmatically

Hi can anybody tell me how access an mbean by a sample program .
For example in case of jboss , the jboss-service.xml contains an entry like the following...
<mbean code="org.jboss.jmx.adaptor.rmi.RMIAdaptorService"
     name="jboss.jmx:type=Connector,name=RMI">
<!-- Bind the RMIAdaptor to JNDI name jmx/rmi/RMIAdaptor -->
<attribute name="JndiName">jmx/rmi/RMIAdaptor</attribute>
<!-- Use an anonymous listening port -->
<attribute name="RMIObjectPort">0</attribute>
<!-- Bind on every available interface -->
<attribute name="ServerAddress"></attribute>
</mbean>
From this I use the part ....
'<attribute name="JndiName">jmx/rmi/RMIAdaptor</attribute>'
i.e. my JNDI Name is jmx/rmi/RMIAdaptor
So in my code it is like ..
MBeanServerConnection server = (MBeanServerConnection) ctx.lookup("jmx/rmi/RMIAdaptor");     
Now in case of JCAPS from where I can get the JNDI lookup string name ? If some one has any sample code or doc it will be very helpful for me .
Regards,
Ayan

To enable the JMX agent for local access, add the following JVM property:
-Dcom.sun.management.jmxremote
To enable remote monitoring a couple of other JVM Options need to be set:
-Dcom.sun.management.jmxremote.port=portNum
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
See also: http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.htm

Similar Messages

  • ApplicationLifeCycleListener can't access Runtime MBean Server

    Hi all,
    I have encountered quite a strange behaviour in Weblogic 9.0. I am actually trying to deploy an application originally developed on Weblogic 9.2 to Weblogic 9.0. Everything works fine, except the ApplicationLifeCycleListener. The Post Start method tries to register MBeans to the Runtime MBean Server and deregisteres them when the application stops in Pre Stop. In Weblogic 9.2, it works fine. I can access the MBean Server with a local connection as described here: [url http://e-docs.bea.com/wls/docs90/jmx/accessWLS.html#1119237]
    The documentations on this for WL 9 and WL 9.2 do not differ significantly. Anyway, WL 9 quits any attempt to make local connections to the Runtime MBean Server with an Exception:
    javax.naming.NameNotFoundException: While trying to look up comp/env/jmx/runtime in .; remaining name 'comp/env/jmx/runtime'
    It works when I move the establishment of a connection into an EJB. I suppose that the ApplicationLifeCycleListener just can't see the Runtime MBean Server in Weblogic 9.0.
    What do I do wrong? :-)
    Thanks,
    S?ren

    I too am having problems accessing Directory server from Netscape Console installed on Winxp.
    If I try to open Directory server it doesn't give any error. No windows nothing.
    If I try th same from the machine on which it is installed everything is fine. What is strange is that it did open a couple of times. But at the same time I can open the admin server, Netscape Messaging server from the xp box. Searching all over for a solution. Any help/pointers would be greatly appreciated.
    Config details:
    iDS4.13, iMS 5.0, running on Sol 8 box
    Netscape Console 4.2 on WinXP.
    Thanks

  • Using the App Server DAS to access "my" MBeans on cluster servers

    I am wanting to use JMX to access some custom MBeans that are on server instances that are participating in app server clusters. I figured the way to do this is by connecting to the DAS, but the service groups don't show within the DAS (like when using JConsole), I can access other AMX services, but not my custom ones. I can access my MBeans if I directly connect to the app servers.
    Any ideas? I am trying to keep my jmx client from having to know physical location of the clustered servers, and only knowing about the DAS.
    Thanks,
    Scott

    Hi,
    I am not an Application Server expert so I won't be able to answer your question
    directly - but maybe the article 'Managing and Monitoring Web Services in
    Project GlassFish' could be of help:
    http://developers.sun.com/prodtech/appserver/reference/techart/ws_mgmt.html
    There's also the doc on docs.sun.com which you may already know:
    Chapter 20 Using the Application Server Management Extensions
    http://docs.sun.com/app/docs/doc/819-3659/6n5s6m5ck?a=view
    If you still don't get your answer - you may also want to visit the glassfish project:
    https://glassfish.dev.java.net/ (perhaps join its user's mailing list?)
    or The Aquarium: http://blogs.sun.com/theaquarium which has lots of interesting
    tips and articles.
    Hope this helps,
    -- daniel
    JMX, SNMP, Java, etc...
    http://blogs.sun.com/roller/page/jmxetc

  • Accessing Portal MBeans?

    Hi
    I would like to access the Portal 4.0 MBeans via a client app. Here is my sample
    program:
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    env.put(Context.PROVIDER_URL, "t3://xxxx-1:7501");
    env.put(Context.SECURITY_PRINCIPAL, "system");
    env.put(Context.SECURITY_CREDENTIALS, "xxxx");
    Context ctx = new InitialContext(env);
    MBeanHome homeBean = null ;
    homeBean = (MBeanHome)ctx.lookup(MBeanHome.JNDI_NAME + ".portalServer");
    Set s = null;
    Iterator iter = null;
    WebLogicMBean wBean = null;
    wBean = homeBean.getMBean("entityPropertyCache", com.bea.p13n.mbeans.CacheMBean.class.getName());
    if (wBean != null)
    System.out.println("It is " + wBean.getName());
    When I run this code, I get the following exception:
    Exception: javax.management.InstanceNotFoundException: portalDomain:Name=entityPropertyCache,Type=com.bea.p13n.mbeans.CacheMBean
    (admin server:true)
    Start server side stack trace:
    javax.management.InstanceNotFoundException: portalDomain:Name=entityPropertyCache,Type=com.bea.p13n.mbeans.CacheMBean
    (admin server:true)
         at weblogic.management.internal.MBeanHomeImpl.getMBean(MBeanHomeImpl.java:120)
         at weblogic.management.internal.MBeanHomeImpl.getMBean(MBeanHomeImpl.java:245)
         at weblogic.management.internal.MBeanHomeImpl_WLSkel.invoke(Unknown Source)
         at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
         at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267)
         at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    End server side stack trace
    Can the Gurus please tell me what I'm doing wrong? I have tried various routes to
    access the MBeans but nothing seems to work. The command-line weblogic.Admin GET
    yields no results either.
    Thanks,
    P Kesh

    Use queryNames instead of queryMBeans. queryNames returns a Set of ObjectName rather than a Set of ObjectInstance.
    �amonn McManus -- JMX Spec Lead -- http://weblogs.java.net/blog/emcmanus

  • Accessing Runtime Mbeans from the command line.

    Hi,
    I just wanted to know if runtime Mbeans can be invoked from the command line.
    I tried accessing the ExecuteQueueRuntime mbean from the command line but nothing ever comes back.I am able to retrieve configuration mbeans without errors.
    Do I need to create the runtime mbeans before I can use them ?
    Or I need to invoke these commands via server code only?
    Thanks.

    Can you post the command you are using? I just tried this and seems to work.
    D:\>java weblogic.Admin -username weblogic -password weblogic get -type ExecuteQueueRuntime -pretty
    MBeanName: "mydomain:Location=myserver,Name=weblogic.admin.RMI,ServerRuntime=myserver,Type=ExecuteQueueRuntime"
    CachingDisabled: true
    ExecuteThreadCurrentIdleCount: 2
    ExecuteThreadTotalCount: 3
    ExecuteThreads: [Lweblogic.management.runtime.ExecuteThread;@3eb934
    Name: weblogic.admin.RMI
    ObjectName: weblogic.admin.RMI
    Parent: myserver
    PendingRequestCurrentCount: 0
    PendingRequestOldestTime: 1129990444704
    Registered: false
    ServicedRequestTotalCount: 87
    Type: ExecuteQueueRuntime
    MBeanName: "mydomain:Location=myserver,Name=weblogic.kernel.System,ServerRuntime=myserver,Type=ExecuteQueueRuntime"
    CachingDisabled: true
    ExecuteThreadCurrentIdleCount: 5
    ExecuteThreadTotalCount: 5
    ExecuteThreads: [Lweblogic.management.runtime.ExecuteThread;@2cfc8c
    Name: weblogic.kernel.System
    ObjectName: weblogic.kernel.System
    Parent: myserver
    PendingRequestCurrentCount: 0
    PendingRequestOldestTime: 1129990444754
    Registered: false
    ServicedRequestTotalCount: 124
    Type: ExecuteQueueRuntime
    MBeanName: "mydomain:Location=myserver,Name=weblogic.kernel.Non-Blocking,ServerRuntime=myserver,Type=ExecuteQueueRuntime"
    CachingDisabled: true
    ExecuteThreadCurrentIdleCount: 0
    ExecuteThreadTotalCount: 0
    ExecuteThreads: [Lweblogic.management.runtime.ExecuteThread;@2d125d
    Name: weblogic.kernel.Non-Blocking
    ObjectName: weblogic.kernel.Non-Blocking
    Parent: myserver
    PendingRequestCurrentCount: 0
    PendingRequestOldestTime: 1129990444764
    Registered: false
    ServicedRequestTotalCount: 0
    Type: ExecuteQueueRuntime
    MBeanName: "mydomain:Location=myserver,Name=weblogic.admin.HTTP,ServerRuntime=myserver,Type=ExecuteQueueRuntime"
    CachingDisabled: true
    ExecuteThreadCurrentIdleCount: 2
    ExecuteThreadTotalCount: 2
    ExecuteThreads: [Lweblogic.management.runtime.ExecuteThread;@2d260e
    Name: weblogic.admin.HTTP
    ObjectName: weblogic.admin.HTTP
    Parent: myserver
    PendingRequestCurrentCount: 0
    PendingRequestOldestTime: 1129990444814
    Registered: false
    ServicedRequestTotalCount: 0
    Type: ExecuteQueueRuntime
    MBeanName: "mydomain:Location=myserver,Name=weblogic.kernel.Default,ServerRuntime=myserver,Type=ExecuteQueueRuntime"
    CachingDisabled: true
    ExecuteThreadCurrentIdleCount: 15
    ExecuteThreadTotalCount: 15
    ExecuteThreads: [Lweblogic.management.runtime.ExecuteThread;@2d3a8c
    Name: weblogic.kernel.Default
    ObjectName: weblogic.kernel.Default
    Parent: myserver
    PendingRequestCurrentCount: 0
    PendingRequestOldestTime: 1129990444854
    Registered: false
    ServicedRequestTotalCount: 7
    Type: ExecuteQueueRuntime
    D:\>
    Thanks,
    -satya
    BEA Blog: http://dev2dev.bea.com/blog/sghattu/

  • Access plot colors programmatically

    Hi all,
    When plotting multiple plots on the same axes, Labview automatically assigns each plot a different colour.
    How can I programmatically access this colour sequence (an array?) and set it with an array of colours I choose?
    Regards,
    Jamie
    Using Labview version 8.0

    Hi Jamie,
    the following code should work:
    Ton
    Message Edited by TonP on 02-11-2008 07:45 AM
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!
    Attachments:
    SetPlotColor.PNG ‏4 KB

  • Grant access to page programmatically

    Hi
    I am looking into using pl/sql procedures in portal 9.0.2 to grant access for users and groups, programmatically, to a page that i have created.
    I am trying to use this procedure:
    wwsec_api.set_user_acl(p_object_type_name,p_owner ,p_name ,p_authorization_function );
    However, i m not too sure how to set the variables for p_object_type_name and p_name and how are i can extract the correct object_type_name from WWSEC_PRIV_OBJECT_TYPE. I am also not sure if I am on the right track.
    Would appreciate if anyone can advise on this procedure and if there are any other ways of implementation.
    Thank you and best regards
    Siew Leng

    Select the Documents folder, choose Get Info from the Finder's File menu, give them access under Sharing & Permissions, and tell them to use the Go to Folder command in the Go menu to access /Users/yourname/Documents/. Alternatively, move them to /Users/Shared/.
    (75108)

  • Access navigation rules programmatically?

    Hello.
    Is there any way to access the attributes of a navigation rule programmatically?
    In Struts, I was accustomed to getting the URL of a forward that I had set up by doing something like:
    <html:rewrite forward="myForwardName"...>on my JSP page, but I can't seem to find any equivalent of this functionality in JSF.
    Also, I would like to be able to access the navigation rule attributes from Java code, too, particularly the "to-view-id" attribute, which is something I did in Struts with code like:
    String path = mapping.findForward("myForwardName").getPath();I know that this isn't apples-to-apples, and that a global forward in Struts is not set up the same way as a navigation rule in JSF, but I'm hoping that there's some kindly JSF super-genius who can point me in the right direction. :-)
    Thanks!
    --Mike                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Thanks, rei_nanto--that did shed a little light on the subject!
    Now, unfortunately, I am not using the Sun reference implementation (we're using the IBM implementation), and so I don't have the ApplicationAssociate class you mentioned.
    I went out and looked at the ApplicationAssociate and NavigationHandlerImpl classes in the RI jars, though, as you suggested, and I can see how it could be done.
    The reason I'm looking for a way to get this information, especially the <to-view-id> information, is because I need to do a popup window from my JSF application page, and I would like not to hard-code the URL of the JSF page I want to appear in the popup.
    Hence, if I could get the path out of <to-view-id> programatically, I wouldn't have to hard-code the path in my popup.
    Any additional thoughts on the matter, given this additional information?
    Thanks!
    --Mike                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to access the MBeans in the WLS 7.0

    Hi
    I have to access MBeans in the WLS7.0 using Management API (weblogic.management.*).
    Anyone could you tell me asap
    Regards
    Bala

    Same as 6.1..refer to the management and jmx thread for examples..
    "Raj" <[email protected]> wrote:
    >
    Hi
    I have to access MBeans in the WLS7.0 using Management API (weblogic.management.*).
    Anyone could you tell me asap
    Regards
    Bala

  • How to access View object programmatically and ...

    Hi,
    I have a hypothetical situation. I have for example a VO based on Emp and a data table in the UI with a button.
    When pressing this button I want to call a method that will programmatically read in teh values of the current row and then update a field in the UI (say an outputText).
    My problem is I am not sure where to pu this logic. I thought I shouldI create a new method in the Application module then bind that methid to the button. By having the code in the AM then it can easily access the VO attributes. But how can the method in the AM access the values in my backing bean and set them or read them ?
    I am not sure where to put the code - I could put it in teh backing bean and call teh application module from there but the manual doesn't really recommend that I think.

    This is probably logic that should be in the backing bean in a method that is activated from your button.
    The ADF Developer Guide shows you how to do it here:
    http://download.oracle.com/docs/html/B25947_01/bcservices005.htm#sthref681

  • Accessing WLS MBeans (8.1 + 9.2)

    Hello,
    I'm currently porting an app from WLS 8.1 to 9.2.
    One difference is the access to the WLS-Runtime-Konfiguration. In 8.1 we did this via weblogic.server.Server etc. Now in 9.2 I have to use the JMX conforming way described in http://e-docs.bea.com/wls/docs90/jmx/accessWLS.html.
    My question is: Is there a way to access the runtime config that works in 8.1 AND 9.2?
    (9.2 no longer supports the typesafe Interfaces and in 8.1 the runtime mbean server is not deployed at the same jndi node, if at all).
    Any ideas?
    Kai

    I did some more research and found this solution:
    As shown in
    http://edocs.bea.com/wls/docs81/jmx/basics.html
    you can still use the MBeanHome-Interface to access the Weblogic-MBean-Interfaces.
    However, this method of access is deprecated and will probably be removed in 9.3 (as I have heard) so reimplementing the management mbean access will be inevitable.

  • Question about accessing Runtime MBean server

    I would like to access the Runtime MBean server, and I've read this link: http://e-docs.bea.com/wls/docs91/jmx/accessWLS.html#1119237
    I want to access this from within my EJB application. My WLS 9.1 setup is simple (it's a Single Server Domain), and the class which is attempting to get to the runtime MBean server is from a stateful session bean. The Bean class is in a Jar which is deployed within an Ear as part of an ELB module.
    After reading "If the classes for the JMX client are located in a J2EE module, such as an EJB or Web application, then the JNDI name for the Runtime MBeanServer is", I expected to use the JNI name java:comp/jmx/runtime. But this failed.
    What worked was the other address specified (java:comp/env/jmx/runtime).
    So, apparently this means that "If the classes for the JMX client are located at the top level of an enterprise application (that is, if they are deployed from the application's APP-INF directory)"
    So, I'm not sure what this means? Can someone clarify when each address is available and when it's not? The existing explaination in the doco doesn't make sense to me. My application is defined as part of an EJB module, yet I can't use the JNI name for an EJB module?
    Thanks for any help,
    Ed

    It's called DNS registration.
    You need to talk with your network engineers or someone who manages your public website.
    We did our DNS registration of our Portal site through the telecom company who provides our office with Internet access.
    Our portal URL from the Internet is:
    https://portal.opnext.com/pls/portal
    If you can access it and want to log in using our "demo" ID, please send me an e-mail requesting the password.
    Eric
    [email protected]

  • Accessing the MBean for ProcessRuntime(WLI) through WLST

    Since the cmo is not available for Custom MBeans and WLI MBeans are custom, how can I access or execute the methods for the MBean from WLST. I guess I can probably do it with the invoke command but the sytax foroperation invocation is not that intuitive. Is there another way i can access the ProcessRuntime Bean and invoke the methods directly.
    Thanks.

    Marc,
    This is just a guess(have'nt done this), but I think the settings are not an exception, and you should be able to find the MBean here:
    http://docs.oracle.com/cd/E17904_01/webcenter.1111/e12405/wcadm_intro.htm#BHCCJJED
    This section of the doc seems to walk through an example setting properties in adf-config.xml
    I would interpret those instructions in the official doc to mean :
    1. If you don't mind changing this at deploy time and re-deploying(like we do when we're in deep development), you can change this and redeploy.
    2. If you have a deployed application, you can make changes through WLST. But keep in mind that the changes you make through WLST will not be overwritten later when you change the adf-config in Jdev and redeploy.
    (This lets you fine tune the timeouts for specific environments. ex: bigger timeouts for dev envs hosted with smaller resources/unstable un-optimized code, rather than guess a timeout that works for all environments )
    Now comes the conflicting parts :
    "If you must modify these properties, post deployment, you must edit adf-config.xml manually."
    I think,they mean "manually using WLST". This can probabaly be done with both WLST commands and the MBeans.
    Now once you make these changes to a deployed application, the changes you made are stored in MDS. This means that this "tuning" will survive a re-deployment.
    So if we :
    set the timeout to 1 minute initially at design time,
    then change that to 5 minutes through WLST,
    and then edit adf-config again in Jdev to a 10 minute value and redeploy,
    the MDS still has the 5 minute value, and it will overwrite the 10 minute value we set later at design time and redeployed.
    MDS documents are always applied on top of the deployed stuff.
    The doc you refered to : http://docs.oracle.com/cd/E17904_01/webcenter.1111/e12405/wcadm_app_config_files.htm#CHDGEDGJ
    does make a good explanation of how the changes persisted in MDS affects the final configuration.
    Hop that helps !

  • Access Visitor entitlements programmatically

    Hi,
    I wonder if it is possible to access (create, manage, delete) Visitor Entitlements programmatically by a Beehive control/Helper ...
    It is possible to do this for Delegated Admin roles with the DelegationRoleManagerControl control provided by Oracle. But I didn't find an equivalent to manage the Visitor Entitlements roles.
    I'm using Weblogic Portal 10.2 (Weblogic Server 10) on a JRockit R27.6.0 1.5.0_15
    Best.
    Edited by: user11804594 on 19 août 2009 02:54

    Hi
    if you want to get the list of roles for the currently logged in user thats possible.
    If you want to get the roles for any logged in user, its possible if you know what the entitlement definition is before hand. if the entitlement is based on directly assigning users to the role or groups to the role, then its fine and can be done without needing the code to know which role is which group, it can be done programmatically.
    if you have a more complicated and or clauses in the role definitiob or do not know the entitlement definition before hand then I dont think it is.
    Which scenario applies to you?

  • Accessing search criteria programmatically

    I have a client who asked me to modify a report that highlights the background of an on-demand subreport.  He then searches for a cheque number and when he finds the right cheque number, he clicks on the subreport.
    However, the subreport is highlighted (just a yellow background colour), for all cheques on the same page.  He has been clicking on the wrong one.
    He uses the Crystal interface to run the reports.  He wants to hit the search button, put in the cheque number, go to the page with the cheque number but have only the subreport for that cheque number highlighted.
    I know I can use a parameter to programmatically change the background colour and have him enter that during a refresh but he still has to search for the cheque and it could be 50 pages to look through.
    Any ideas?  TIA rasinc.

    Simply search the subreport again

Maybe you are looking for

  • How can I change the email associated with my forum account?

    How can I change the email associated with my forum account?  I didn't provide my work email to you, but you put it in my account.  My forum postings have nothing to do with my personal PC at home.  There isn't an option to update it. This question w

  • MacBook pro stuck at white screen right after the chime.

    Hi, yesterday I partitioned my hard drive and made a different partition titled backtrack 5. I inserted the backtrack live DVD into my MacBook Withe the option at boot and it installed on that exact partition. Then I exited opted Mac sox again. Brows

  • AppleTV does not recognize my MobileMe account

    I tried connecting to my MobileMe gallery through AppleTV and it keeps saying my account is not a valid one?????

  • Code to Join three tables.

    Hi All, I am a fresher to this ABAP. I have an task to join three tables which doesn't take much effort. But the problem is: the tables have same columns, (name, age and city) in all the three tables. The layout is as shown below: Table 1  ( T1 )    

  • Possible Bug - Photoshop CS6+Windows 8 Batch Editing

    Hello Everyone, I have spent hours trying to figure out this issue. I use photoshop as my recommended image software editing program. I do a lot of Android Development from maintaining roms to making themes for the android device. I am attempting to