How to get JMSDistributedQueueMBean in weblogic 10.3? - WebLogic Server - Management / Console / WLST / Configuration

Can anybody provide the route starting from DomainRuntimeServiceMBean to access JMSDistributedQueueMBean? I tried DomainRuntimeServiceMBean /DomainConfiguration(DomainMBean)/JMSDistributedQueues(JMSDistributedQueueMBean), but it said Attribute can not be found, the MBean Reference says this attribute (JMSDistributedQueues) has been deprecated since 9.0.
Also the weblogic doc says "the WebLogic Server MBean Reference lists other MBeans from which you can access the current MBean.", but for a MBean in ref, I only see "Related MBeans" and its Attributes, it doesn't tell me from which MBean(neither containment nor reference) I can access the current MBean, am I wrong here?
What I'm currently trying to achieve is to get all the queues defined in JMS Cluster and list the message counts for each queue instance of the distributed/logical queues on this cluster.
Any suggestion would be appreciated.

Related

Custom MBeans in a cluster

Hi,
Question: is there any way to get the current managed server port?
Here is some background. I have a web app that is deployed in a cluster. In the web app I have a class that caches information retrieved from the database. I'd like to have a web page on which I can reload these caches on all servers in the cluster.
I thought I could do it with JMX. I created a CacheControl MBean. I wanted to register this MBean locally in each application instance (on each server) during application startup and then use administration server's MBeanHome to access all these MBeans and call the appropriate methods.
In order to register the MBean in a local MBeanServer I need the JNDI provider port number (host is "localhost"). I have no clue where to get this information from during application startup (in a ServletContextListener). I could hardcode this in /web-app/listener/init-param but this wouldn't work when I deploy my application on a single machine with multiple servers running (each having different port)?
Anyone has any thoughts on what's the best way to register custom MBeans on a local MBeanServer?
I have a working solution in which I'm able to access the local MBeanHome through the admin JNDI context (using server name and weblogic.management.home._serverName_) however this will work only if admin server is up and running. In other words, I will not be able to register my custom MBean in a local MBeanServer if admin server is down :-( 
I think in case Admin server is not running its hard to accomplish described task with JMX (mbean etc).
If your requirement says to refresh irrespective of Admin server status.
You may need to implement a POJO (Plain Old Java Object), and keep list of servers in cluster in some config file and then implement cache management business logic.
Just a suggestion.... If you come across more elegant solution pl let group know...
Thanks,
Rahul 
Perhaps I'm missing something, but you're running code on one server where you want to register an mbean for the local server?
If so, you don't need to make a remote JNDI connection for this. Just create the InitialContext object with no properties. 
Yeah. That's what I figured out after some experiments. Basically, not specifying Environment.setProviderUrl(), the default url will be "local://" which gives access to local JNDI tree.
From there I can get the local MBeanServer (MBeanHome.LOCAL_JNDI_NAME) and register my MBeans in there.
Then, to call all my MBeans (each on a different server) from one of the servers I first figure out the Admin server URL. this is done by looking for ServerRuntimeMBean (MBeanHome.getMBeansByType("ServerRuntime")). I pick the first from the list and then "getAdminServerHost", "getAdminServerListenPort" and I have the info to access the Admin server context: "t3://" + adminHost + ":" + adminPort.
From admin MBeanServer I retrieve the list of all server names in the domain ("MBeanServer.getMBeansByType("ServerRuntime") and then "getName()" on each)
Finally, I get access to all those servers' MBeanHome interface using admin JNDI context and looking for 'MBeanHome.JNDI_NAME + "." + serverName'.
From there I can query MBeans and invoke operations on it.
If anybody interested I can post the code snapshot to do all this.
Thanks for your help.
Slawek 
I've already solved some similar problems, but I would like to see how you've done this, so yes, I'd like to see your code.

Changing the NodeManager username/password with WLST

Hi,
When connecting to a WLS managed by a node manager I can navigate to the SecurityConfiguration MBean:
cd("/SecurityConfiguration")
performing an ls() at this point lists all of the properties/methods availabe. Two of the properties are nodeManagerUsername and nodeManagerPassword. I'd like to change these values, however they don't appear to be exposed by JMX.
However, the API docs for this MBean at:
http://edocs.bea.com/wls/docs100/javadocs_mhome/weblogic/management/configuration/SecurityConfigurationMBean.html
indicate that I should be able to set both of these fields. So, how do I go about setting them? Or is the only way to do so via the
admin console, in which case, how does it get a handle on the MBean?
Thanks
Ryan

WLI 8.1 MBean Cluster

We are builing cluster environment for WLI usage. There is one admin server and two managed servers. We setup a cluster and included these two managed servers.
And of course we created and deploy some workflow projects into this cluster.
We need to use MBean API to access the workflow in other server. But the problem is ~~ I see that MBean is registed in "admin server". If the admin server is crash and managed server also alive. Does the MBean API also work well?? Does the cluster setting is useless when calling MBean? Anybody know that?
Regards,
Scharwenka 
I don't understand why you have used MBean API to access other servers workflow. You should have used either process control or service broker or JPD proxy. MBean API is mainly used to monitor the server performance and access configuration information. Also you can connect to the managed server directly and there is no need to go through admin server, hence no dependency.
Regards
Zulfi 
Thanks for your reply.
We need to get the nodes in someone workflow, so we use MBean API to do that. For example: A flow A->B->C->D.
We need to got total flow view (the result from SVGView is not useful). And we need to get previous(B) or next(D) node in someone step(C).
In WLI 7.0, the workflow operating API is provided. But in WLI 8.1, we just got the information that only MBean API can meet our requirement.
So anybody know how to solve MBean cluster problem?

Getting jms queue jndi name via jmx

Hi all,
I'm writing a utility that will help us migrate jms messages to new servers, stores, etc. I would like to connect to a server and programmatically discover the jndi names of all the queues and topics on that server. I know how to get all the destination mbeans via jmx, but I don't see a way to get the jndi names for them. They have a Name attr, but it's not the jndi name. Is this possible with WLS 9.2?
thanks 
I believe the attribute on the Destination Bean would be JNDIName, but I would use WLST to browse the information available via JMX. I.e.
1) connect to the domain
2) cd into the approriate jms system resource. Then perform ls() and cd() until you find the right information.
3) Then use print cmo - this will give you the JMX object name. ls() will show you the attribute name.
4) So you can either look up the MBeans directly using JMX or walk down the domain hierarchy 
Doing this programmatically was a real pain. There are separate config and runtime mbeans. You need the config mbean to get the jndi name and the runtime mbean to get durable sub info but no good way to associate the two beans. The best I could do was get the Name attr from the runtime mbean, strip off everything before the bang, and use the remainder to look up the config mbean. 
Can you post the code? I'm trying to do the same thing... 
The code here should help
http://weblogic-wonders.com/weblogic/2010/01/21/jms-resources-using-jmx/

Access ServiceMix MBeans for Metric Extenstions

Trying a new method for monitoring ActiveMQ (ServiceMix) within OEM 12c (12.0.1.0.1). I have a custom built plugin that monitors specific aspects of a ServiceMix instance but would like the ability to create custom metrics based on the MBeans within ActiveMQ. When setting up the ME (Metric Extension), it asks for an MBean Pattern (ObjectName etc) to access the specific MBean and the corresponding Attributes, in order to set up the metrics. I can't seem to access the MBean. Does anyone know how to access the Mbeans for ActiveMQ to setup Metric Extensions for OEM 12c? What is the syntax for the MBean Pattern it is looking for and how do I point it at that location, to load the appropriate MBean attributes? 
There are different styles of mbeans that will result in a different type of pattern necessary to access it. Since we're talking about a 3rd party customer mbean, it's hard to predict what the pattern to locate it might be.
The easiest way to locate that mbeans pattern may be to use an mbean browser in a development environment to find the mbean and get its pattern. If you are using a JRF enabled domain, there is an mbean browser built into the Fusion Middleware Control. If not, you can try using and external mbean browser like jconsole or wlshell in order to locate the mbean. 
Maybe there is a more logical way to monitor an ActiveMQ instance on a server. Something within OEM that will just select the ActiveMQ instance as a target and from there, it will have a JMX connection to the MBeanServer. Anyone familiar with this? 
So I think I see the issue. The plugin we are using allows us to set up a custom Target Type of ServiceMix. With this, we give it a name and then a JMX Hostname, which ends up being the hostname of the server the ActiveMQ instance is running. The ServiceURL the plugin uses is service:jmx:rmi:///jndi/rmi://%jmx_hostName%:1099/karaf-root. The jmx_hostName is fed from that user input, I am assuming. Well when I try to run the Metric Extension against a serviceMix target, it says:
Failed to get test Metric Extension metric result.: cannot communicate with Target: java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ConfigurationException [Root exception is java.rmi.UnknownHostException: Unknown host: %jmx_hostName%; nested exception is:
     java.net.UnknownHostException: %jmx_hostName%]
It looks like because the Metric Extension is a generic setup, even though I am passing it a ServiceMix target, the JMX hostname is not being set and is sitting as the variable. Which means we can't access the MbeanServer because it doesn't know which JMX Hostname is. Just some assumptions...would love some feedback... maybe a better way to monitor ActiveMQ, by adding a type of target in OEM, selecting the activemq instance and then being able to access the MBeans of THAT target through Metric Extensions.

Categories

Resources