Accessing WebLogic Server MBeans with JMX (c)

2010-12-03  来源:本站原创  分类:Java  人气:134 

Example: Monitoring Servlets

import java.util.Hashtable;
import javax.naming.Context;
public class MonitorServlets {
   private static MBeanServerConnection connection;
   private static JMXConnector connector;
   private static final ObjectName service;
// Initializing the object name for DomainRuntimeServiceMBean
   // so it can be used throughout the class.
   static {
      try {
         service = new ObjectName(
      }catch (MalformedObjectNameException e) {
         throw new AssertionError(e.getMessage());
   * Initialize connection to the Domain Runtime MBean Server
   public static void initConnection(String hostname, String portString,
      String username, String password) throws IOException,
      MalformedURLException {
      String protocol = "t3";
      Integer portInteger = Integer.valueOf(portString);
      int port = portInteger.intValue();
      String jndiroot = "/jndi/";
      String mserver = "";
JMXServiceURL serviceURL = new JMXServiceURL(protocol, hostname,
         port, jndiroot + mserver);
      Hashtable h = new Hashtable();
      h.put(Context.SECURITY_PRINCIPAL, username);
      h.put(Context.SECURITY_CREDENTIALS, password);
      connector = JMXConnectorFactory.connect(serviceURL, h);
      connection = connector.getMBeanServerConnection();
   * Get an array of ServerRuntimeMBeans
   public static ObjectName[] getServerRuntimes() throws Exception {
      return (ObjectName[]) connection.getAttribute(service,
   * Get an array of WebApplicationComponentRuntimeMBeans
   public void getServletData() throws Exception {
      ObjectName[] serverRT = getServerRuntimes();
      int length = (int) serverRT.length;
      for (int i = 0; i < length; i++) {
         ObjectName[] appRT =
            (ObjectName[]) connection.getAttribute(serverRT[i],
         int appLength = (int) appRT.length;
         for (int x = 0; x < appLength; x++) {
            System.out.println("Application name: " +
              (String)connection.getAttribute(appRT[x], "Name"));
            ObjectName[] compRT =
               (ObjectName[]) connection.getAttribute(appRT[x],
            int compLength = (int) compRT.length;
            for (int y = 0; y < compLength; y++) {
               System.out.println("  Component name: " +
                 (String)connection.getAttribute(compRT[y], "Name"));
               String componentType =
                  (String) connection.getAttribute(compRT[y], "Type");
               if (componentType.toString().equals("WebAppComponentRuntime")){
                  ObjectName[] servletRTs = (ObjectName[])
                     connection.getAttribute(compRT[y], "Servlets");
                  int servletLength = (int) servletRTs.length;
                  for (int z = 0; z < servletLength; z++) {
                     System.out.println("    Servlet name: " +
                     System.out.println("       Servlet context path: " +
                     System.out.println("       Invocation Total Count : " +
public static void main(String[] args) throws Exception {
      String hostname = args[0];
      String portString = args[1];
      String username = args[2];
      String password = args[3];
MonitorServlets s = new MonitorServlets();
      initConnection(hostname, portString, username, password);
  • Accessing WebLogic Server MBeans with JMX (d) 2010-12-03

    Use it in the web application container ......... .... private String getDomainName () { InitialContext ctx = null; String domainName = "DomainName"; try { ObjectName service = new ObjectName ( "Com.bea: Name = RuntimeService, Type = weblog

  • Accessing WebLogic Server MBeans with JMX (a) 2010-12-03

    From oracle Example: Connecting to the Domain Runtime MBean Server public class MyConnection { private static MBeanServerConnection connection; private static JMXConnector connector; private static final ObjectName service; /* * Initialize connection

  • Accessing WebLogic Server MBeans with JMX (b) 2010-12-03

    Example: Printing the Name and State of Servers import; import; import java.util.Hashtable; import; import; import

  • Accessing WebLogic Server MBeans with JMX (c) 2010-12-03

    Example: Monitoring Servlets import; import; import java.util.Hashtable; import; import; import

  • The Weblogic Server instance is set to Windows services (transfer from: Wei Hua Dad's blog) 2011-05-27

    If you want to start the WebLogic Server instance on your host computer automatically when Windows starts, you can set the server to Windows services. WebLogic Server in the Windows registry HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services,

  • WebLogic Server to achieve two-way SSL 2010-04-27

    Many describe the current network realization of SSL's article, but is either limited to theory, either one-way SSL, configure, or is based on Tomcat, and even, and WebLogic Server-related, nor to provide readers with a realization of the operation i

  • BEA WebLogic Server 9.2 application server refuses to start with Java Virtual Ma 2010-09-14

    Question Depending on the version of the Java ™ Virtual machine (JVM), the WebLogic Server application server refuses to start after the profile has been deployed. Cause During the start of the WebLogic Server application server, the following error

  • FLEX + JAVA use weblogic server 2010-10-16

    FLEX + JAVA use weblogic server, you need to change the flex folder under the services-config.xml configuration items in the <login-command server="Weblogic"/> My version is weblogic 10.x

  • Using Web Server Plug-Ins with WebLogic Server as revese proxy 2010-11-15

    I was assigned to lead a team to develop single sign-on project for a telecommunication company. Oracle and my company would implement the whole project together. Firstly, I was asked to install weblogic v10.3.1 + ADF v11.1.x + oracle http server (Fu

  • Weblogic Server in the Chinese show how to solve the garbage problem 2010-11-25

    Because the operating system, browser, database, JVM using the character set is different, based on Weblogic Server applications developed problems often garbled in Chinese, in fact, Weblogic Server WEB applications running on a lot of character sets

  • Installation Guide for Oracle WebLogic Server 11g Release 1 (10.3.3) 2010-12-04

    Welcome Welcome The Welcome screen is displayed each time you start the installer. Every time you start the installation, this welcome screen will be displayed on the screen. Choose Middleware Home Directory Middleware Home directory selection Specif

  • start / stop weblogic server in shell. 2009-12-18

    1. Knowledge: nohup: we can use that command to run job in the background. remember the last '&' start managed weblogic: connect using HTTP protocal, the user / pwd passed to command line = $ 2-Dweblogic.managemen

  • The WebLogic Server did not start up properly. Solution 2011-07-05

    Just when the initial configuration errors and solutions: 1 starts the following error The WebLogic Server did not start up properly.; local class incompatible: stream classdesc seria

  • Configuring WebLogic Server 11g cluster. Session replication (Windows) 2011-09-21

    Recently compiled a "weblogic 11g cluster, load balancing and session replication" of the document for later use as reference, we also want to be able to help. Documents directory as follows: 1 Preliminaries ... 4 2. This environment ... 5 3 con

  • WebLogic Server 组播问题疑难答解 2014-07-28

    当在您的配置中存在组播问题时,如果需要调试编译应用程序,您的问题通常要么是在BEA WebLogic Server 中组播配置错误,要么是网络问题(例如在所指有问题的机器中组播本身并没有建立).请使用该校验清单来检查配置.其他可能的问题以及组播的常见问题. 导致集群群集不能启动或服务器加入集群群集失败的最常见原因之一是组播地址问题.每个群集都需要组播地址.组播地址可以是介于224.0.0.0 到之间的一个IP地址,或者IP地址在该范围之内的一个主机名.您可以使用W

  • Linux 2.6.9-55.0.2.ELsmp 环境下WebLogic Server 8.1.6启动报错问题的解决 2012-03-09

    WLS的启动脚本如下 # Initialize the common environment. WL_HOME="/home/weblogic/bea/weblogic81" PRODUCTION_MODE="true" JAVA_VENDOR="Sun" JAVA_HOME="/home/weblogic/bea/jdk142_11" # Call commEnv here AFTER se

  • HBCZT信息中心Weblogic Server性能调优建议 2012-03-09

    l 调优背景 HBCZT信息中心使用IBM X366服务器Windows2003运行其基于J2EE1.4技术的应用系统.另外运行一个基于COM技术的数据采集应用程序.该程序客户端读入用户填写的xls格式表格文件信息,并通过该程序将XLS内容封装成为XML并打包ZIP后发送到数据采集程序的服务器端,服务器端接受到文件后,对该ZIP包进行解包.并对解包后的XML信息进行解析.使用SQL逐条将记录插入到Oracle数据库中.数据库连接池已经设置为20,但批量数据插入数据库的时候(数据量至少500000

  • WebLogic Server性能调优 2012-03-09

    虽然现在Weblogic的版本已经升级到10.3,并被包装为Oracle funsion middleware 11g,但是新资料还是比较少,这里分享一篇Weblogic经典版本8.1的性能调优文章. ------------------------------------------------------------------------------------------------------------------- 任何在市场上成功的产品都拥有良好的性能.虽然成为象WebLogic

  • WLS_008:WebLogic Server基本管理之五:不间断应用部署 [转] 2015-01-08

    WebLogic Server版本:10.3.5. 在生产环境中,一些重要的应用要求7×24小时运行,如何升级这些正在运行的应用是一个让人头疼的问题. Weblogic Server能够在不停止现有应用的情况下部署新版本. 这时,如果还有用户访问旧版本应用,那么可以继续访问:新来的用户将访问新版本的应用. 所有旧版本的用户访问完毕后,旧版本应用将自动"退休". 1. 使用java weblogic.Deployer 实现不间断应用部署 注意:使用此种方式实现不间断应用部署,要求应用第1

  • weblogic Server Migration to the first problem encountered 2011-05-23

    Described in the document we need to configure the floating IP Managed Server 1. For the floating ips to work, do I need 2 NICS and two cables on each server? Q: Do the two network cards We use Solaris Unix with Server migration and we don't need two