import java.io.IOException; import java.net.MalformedURLException; import java.util.Hashtable; import java.rmi.Remote import javax.management.MBeanServer import javax.management.MBeanServerConnection; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; import javax.management.remote.JMXConnector; import javax.management.remote.JMXConnectorFactory; import javax.management.remote.JMXServiceURL; import javax.naming.Context; public class EnvDetail { public static String username = "system"; public static String password = "password"; public static int chkValue; public static String hostname = null; public static String port = null; 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("com.bea:Name=DomainRuntimeService,Type=weblogic.management.mbeanservers.domainruntime.DomainRuntimeServiceMBean"); }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 = "weblogic.management.mbeanservers.domainruntime"; 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); h.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES, "weblogic.management.remote"); connector = JMXConnectorFactory.connect(serviceURL, h); connection = connector.getMBeanServerConnection(); } /* * Print an array of ServerRuntimeMBeans. * This MBean is the root of the runtime MBean hierarchy, and * each server in the domain hosts its own instance. */ public static ObjectName[] getServerRuntimes() throws Exception { return (ObjectName[]) connection.getAttribute(service, "ServerRuntimes"); } public void getJvmRuntime() throws Exception { ObjectName[] serverRT = getServerRuntimes(); int length = (int) serverRT.length; for (int i = 0; i < length; i++) { String name = (String) connection.getAttribute(serverRT,"Name"); ObjectName jvmRT = (ObjectName) connection.getAttribute(serverRT[i],"JVMRuntime"); System.out.println("\n..<"+name+" : .JVMRuntime>"); Long heapSMX =(Long)connection.getAttribute(jvmRT, "HeapSizeMax"); System.out.println("HeapSizeMax :" Math.round((heapSMX.longValue()/1048576*100000)/100000) " MB ("+connection.getAttribute(jvmRT, "HeapSizeMax")+")" ); Long heapSC =(Long)connection.getAttribute(jvmRT, "HeapSizeCurrent"); System.out.println("HeapSizeCurrent :" Math.round((heapSC.longValue()/1048576*100000)/100000) " MB ("+connection.getAttribute(jvmRT, "HeapSizeCurrent")+" bytes)"); Long heapFC =(Long)connection.getAttribute(jvmRT, "HeapFreeCurrent"); System.out.println("HeapFreeCurrent :" Math.round((heapFC.longValue()/1048576*100000)/100000) " MB ("+connection.getAttribute(jvmRT, "HeapFreeCurrent")+" bytes)"); System.out.println("HeapFreePercent :" + connection.getAttribute(jvmRT, "HeapFreePercent")+"%"); System.out.println("JavaVendor :" + connection.getAttribute(jvmRT, "JavaVendor")); System.out.println("JavaVersion :" + connection.getAttribute(jvmRT, "JavaVersion")); Long uptime =(Long)connection.getAttribute(jvmRT, "Uptime"); System.out.println("Uptime :" + connection.getAttribute(jvmRT, "Uptime")+" milliseconds (" + (uptime*.001)+" Seconds)"); System.out.println("******************\n"); } } public void getJdbcRuntime() throws Exception { ObjectName[] serverRT = getServerRuntimes(); int length = (int) serverRT.length; for (int i = 0; i < length; i++) { String name = (String) connection.getAttribute(serverRT[i],"Name"); ObjectName[] appRT = (ObjectName[]) connection.getAttribute(new ObjectName("com.bea:Name="+name+",ServerRuntime="+name+",Location="+name+",Type=JDBCServiceRuntime"),"JDBCDataSourceRuntimeMBeans"); int appLength = (int) appRT.length; for (int x = 0; x < appLength; x++) { System.out.println("\n.. .<"+name+" : JDBCDataSourceRuntimeMBeans>" + (String)connection.getAttribute(appRT[x], "Name")+""); System.out.println("ActiveConnectionsCurrentCount : " + connection.getAttribute(appRT[x], "ActiveConnectionsCurrentCount")); System.out.println("ActiveConnectionsAverageCount : " + connection.getAttribute(appRT[x], "ActiveConnectionsAverageCount")); System.out.println("ActiveConnectionsAverageCount : " + connection.getAttribute(appRT[x], "ActiveConnectionsAverageCount")); System.out.println("ConnectionsTotalCount : " + connection.getAttribute(appRT[x], "ConnectionsTotalCount")); System.out.println("CurrCapacity : " + connection.getAttribute(appRT[x], "CurrCapacity")); System.out.println("CurrCapacityHighCount : " + connection.getAttribute(appRT[x], "CurrCapacityHighCount")); System.out.println("HighestNumAvailable : " + connection.getAttribute(appRT[x], "HighestNumAvailable")); System.out.println("HighestNumAvailable : " + connection.getAttribute(appRT[x], "HighestNumAvailable")); System.out.println("LeakedConnectionCount : " + connection.getAttribute(appRT[x], "LeakedConnectionCount")); System.out.println("WaitSecondsHighCount : " + connection.getAttribute(appRT[x], "WaitSecondsHighCount")); System.out.println("WaitingForConnectionCurrentCount: " + connection.getAttribute(appRT[x], "WaitingForConnectionCurrentCount")); System.out.println("WaitingForConnectionFailureTotal: " + connection.getAttribute(appRT[x], "WaitingForConnectionFailureTotal")); System.out.println("WaitingForConnectionTotal : " + connection.getAttribute(appRT[x], "WaitingForConnectionTotal")); System.out.println("WaitingForConnectionHighCount : " + connection.getAttribute(appRT[x], "WaitingForConnectionHighCount")); System.out.println(".\n"); } } } public void getThreadStateandName() throws Exception { ObjectName[] serverRT = getServerRuntimes(); //System.out.println("got server runtimes"); int length = (int) serverRT.length; for (int i = 0; i < length; i++) { String name = (String) connection.getAttribute(serverRT[i], "Name"); String state = (String) connection.getAttribute(serverRT[i],"State"); System.out.println("Server name: " + name + ". Server state: " + state); ObjectName ThreadRT =(ObjectName) connection.getAttribute(serverRT[i], "ThreadPoolRuntime"); System.out.println("ExecuteThreadTotalCount :"+ (Object)connection. getAttribute(ThreadRT,"ExecuteThreadTotalCount")); System.out.println("StandbyThreadCount:"+ (Object)connection.getAttribute(ThreadRT, "StandbyThreadCount")); Integer e_ThreadTotal =(Integer)(Object)connection. getAttribute(ThreadRT,"ExecuteThreadTotalCount"); Integer e_standbyCount = (Integer)connection.getAttribute(ThreadRT, "StandbyThreadCount"); int eThreadTotal = e_ThreadTotal.intValue(); int estandbyCount = e_standbyCount.intValue(); System.out.println("ExecuteActiveThreadCount:"+(eThreadTotal-estandbyCount)); System.out.println("ExecuteThreadIdleCount :"+ (Object)connection. getAttribute(ThreadRT,"ExecuteThreadIdleCount")); System.out.println("ExecuteHoggingThreadCount:"+ (Object)connection.getAttribute(ThreadRT, "HoggingThreadCount")); System.out.println("Throughput :"+ (Object)connection.getAttribute(ThreadRT, "Throughput")); System.out.println("HealthState :"+ (Object)connection.getAttribute(ThreadRT, "HealthState")); //System.out.println("QueueLength:"+ (Object)connection.getAttribute(ThreadRT, "QueueLength")); //System.out.println("StandbyThreadCount:"+ (Object)connection.getAttribute(ThreadRT, "StandbyThreadCount")); //System.out.println("ExecuteActiveThreadCount:"+ (Object[])connection.getAttribute(ThreadRT, "ExecuteThreads")); //System.out.println("ExecuteActiveThreadCount:"+ ((Object[])connection.getAttribute(ThreadRT, "ExecuteThreads")).size()); //System.out.println("ExecuteActiveThreadCount:"+ ((Object[])connection.getAttribute(ThreadRT, "ExecuteThreads")).length); } } public void getExecuteAll() throws Exception { System.out.println("*****************-Heap-****************"); getJvmRuntime(); System.out.println("*****************-JDBC-****************"); getJdbcRuntime(); System.out.println("*****************-Thread-****************"); getThreadStateandName(); } public static void main(String[] args) throws Exception { if (args.length != 5) { System.out.println("\n CheckValue ------> HeapCheck : 1\n"); System.out.println(" CheckValue ------> DBCConnectionCheck : 2\n"); System.out.println(" CheckValue ------> ThreadStatusCheck : 3\n"); System.out.println(" CheckValue ------> All : 0\n"); System.out.println("Usage: java EnvDetail HostName Port CheckValue\n"); //System.out.println(args[0]); String hostname =args[0]; //System.out.println(args[1]); String port= args[1]; //System.out.println(args[2]); chkValue = Integer.parseInt(args[2]); EnvDetail ts = new EnvDetail(); initConnection(hostname,port, username, password); switch (chkValue) { case 1: ts.getJvmRuntime(); break; case 2: ts.getJdbcRuntime(); break; case 3: ts.getThreadStateandName(); break; case 0: ts.getExecuteAll(); break; case 5: System.out.println("CheckValue5"); break; } return; } }//main method }// class
相关推荐
WebLogic Server,简称WLS,是由Oracle公司提供的一个企业级应用服务器,是Java EE应用程序的运行平台。在本文中,我们将深入探讨WebLogic Server的基础知识、实战技巧以及它在实际应用中的重要性。 1. **WebLogic ...
在WebLogic服务器中,WLS-WSAT (Web Services Atomic Transactions) 组件可能存在某些安全漏洞,为了保护系统免受潜在攻击,可以通过禁用此组件的方式来修补这些漏洞。本文将详细介绍如何在不同版本的WebLogic服务器...
【标题】"wls基本管理.rar_WLS PDF_wls" 提供的是关于WebLogic Server(WLS)的基础管理知识,其中“WLS”是WebLogic Server的缩写,是一款由Oracle公司开发的企业级Java应用服务器,广泛用于部署和管理Java应用程序...
WLS通过赋予每个数据点一个权重来调整其对总误差的影响,权重通常与观测值的不确定性成反比。 在MATLAB中实现WLS,通常包括以下步骤: 1. **数据准备**:首先,你需要定义观测数据(因变量`y`)、自变量`X`以及...
在计算机视觉领域,基于立体视觉的深度估计是获取三维场景信息的重要手段之一。视差图是通过匹配左右图像像素来计算对应像素之间的水平偏差,从而得到的表示深度信息的图像。然而,原始的视差图通常包含噪声和不准确...
【压缩包子文件的文件名称列表】中仅列出" wls12130",这可能是一个错误或者不完整的信息,因为在正常情况下,一个完整的WebLogic Server开发包会包含多个文件和目录,如安装脚本、JAR文件、配置文件、文档、示例...
通过深入理解WLS及其在信息融合中的应用,我们可以更好地处理和分析数据,提高预测和决策的准确性。阅读和分析提供的源代码文件可以帮助我们了解具体实现细节,并可能启发我们如何在实际问题中应用这一技术。
5. **启动与管理**:启动WebLogic Server,可以使用`startWebLogic.sh`(Unix/Linux)或`startWebLogic.cmd`(Windows),然后通过Console或JMX接口管理服务器。 6. **部署应用**:将打包好的Java EE应用(WAR、EAR...
1. WebLogic Server身份验证:WLS作为Java EE应用服务器,提供了一套全面的安全框架,其中包括多种认证机制,如基本认证、digest认证、表单认证等。数据库认证是其中一种,通过与外部数据库系统集成,实现用户登录和...
WLS算法通过构建一个误差函数,该函数衡量了实际测量值与理论预测值的差异,并引入权重因子,对不同的测量数据赋予不同的信任度。 MATLAB作为一种强大的数值计算和可视化工具,是实现WLS定位算法的理想平台。在...
【描述】中的信息表明,`wls1036_generic.jar`是在WebLogic Server 11g的安装过程中使用的。WebLogic 11g是Oracle公司发布的第11个主要版本,它的版本号为10.3.x,其中x代表次要更新。这个JAR文件在解压缩后,通常...
某些WebLogic版本中的反序列化漏洞可能允许攻击者通过精心构造的输入数据,控制反序列化过程,从而执行任意代码或者获取敏感信息。 在补丁教程中,通常会包含以下步骤: 1. **评估影响**:确定当前运行的WebLogic...
weblogic_wls1031.exe
Oracle WebLogic Server(简称WLS)是Oracle公司推出的高端企业级应用服务器,是Java EE应用程序的重要运行平台。本篇文章将详细探讨WLS 12.2.1.4.0的Lite版本,即轻量级版,该版本在保持核心功能的同时,提供了更...
### Weblogic 10.3.6 (wls1036_generic.jar) 安装包概述 #### 一、Weblogic 10.3.6版本简介 Oracle WebLogic Server 是一款应用服务器,适用于开发、部署并管理企业级应用程序。它支持多种协议和服务,并且与Java ...
Edge-Preserving Decompositions for Multi-Scale Tone and Detail Manipulation,wls filter,WLS filter code
通过对WebLogic Server 9.x进行有效的内存监控和管理,特别是通过BEA JRockit及其内置的Memory Leak Detector工具,可以显著提高应用服务器的稳定性和性能。这不仅有助于及时发现并解决内存泄漏问题,还可以确保应用...
spss数据分析常用数据集:wls.sav 统计分析及模型构建中常用的数据集; 学习软件的时候,会苦于没有数据进行实操,而其实一般分析软件都会自带数据,现在介绍如何获取SPSS软件自带的数据。 纽约时报的一篇文章报道,...