jmx

Description for Standard MBean

青春壹個敷衍的年華 提交于 2019-12-07 06:36:51
问题 I want to make my Standard MBean verbose in JBoss jmx-console. DynamicMBean has getMBeanInfo() to do it. Method return MBeanInfo with description of MBean. But how I can to do the same thing for Standard MBean? E.g. I have following MBean interface: public interface MyMBean { String f(); } ... with following implementation: public class My implements MyMBean { public String f() { return "test"; } } What should be done to add description in such example? Thanks 回答1: For StandardMBeans there is

JMX authentication

余生颓废 提交于 2019-12-07 05:28:17
问题 $ cd $JAVA_HOME/jre/lib/management $ cp jmxremote.password.template jmxremote.password $ chmod u=rw jmxremote.password $ vi jmxremote.password Set a password for "monitorRole" and "controlRole": monitorRole 12monitor controlRole 55control After then when I run JMX server on my machine I got following error. # java -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.m agement.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.ssl=false -D java.rmi.server.host=47.168.96.31 com.example

Requesting a stack trace for a Java ThreadInfo?

时光总嘲笑我的痴心妄想 提交于 2019-12-07 05:25:41
问题 I have an application that calls getStackTrace() on a java.lang.management.ThreadInfo object, but the StackTraceElement array produced by the invocation is zero length. Inspecting the Javadoc shows this (emphasis mine): public StackTraceElement[] getStackTrace() Returns the stack trace of the thread associated with this ThreadInfo. If no stack trace was requested for this thread info, this method will return a zero-length array . If the returned array is of non-zero length then the first

tomcat自动远程部署

时光总嘲笑我的痴心妄想 提交于 2019-12-07 02:51:07
#tomcat远程部署 ##需要的工具 maven svn/git ##tomcat的配置 1.修改tomcat内容找到./conf/tomcat-users.xml 新增以下内容 <role rolename="manager-gui"/> <role rolename="manager-script"/> <role rolename="manager-jmx"/> <role rolename="manager-status"/> <user username="tomcat" password="tomcat" roles="manager-gui,manager-script,manager-jmx,manager-status"/> 2.重新启动tomcat ./bin/startup.sh ##maven配置 1.修改setting.xml 参考 maven远程发布jar 2.加载tomcat7-maven-plugin插件 <build> <plugins> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <url>http://172.16

Will ThreadMXBean#getThreadAllocatedBytes return size of allocated memory or objects?

最后都变了- 提交于 2019-12-07 02:26:25
I want to employ com.sun.management.ThreadMXBean to do something like this: long before = threadMxBean.getThreadAllocatedBytes(currentThreadId); seriousBusiness(); // some calls here long after = threadMxBean.getThreadAllocatedBytes(currentThreadId); long allocDiff = after - before; // use for stats or whatever The question is, what does this method actually return: amount of new memory allocated at the moment of method invocation or the size of allocated objects ? To be clear on what difference I mean: 1) Say I allocated a huge array in my seriousBusiness() call, so a new memory region was

Web app deployment in Tomcat

萝らか妹 提交于 2019-12-07 02:02:54
问题 Does Tomcat use a different Java Virtual Machine (JVM) for each web application running in its container, or does all web applications in Tomcat run under the same JVM? So for a specific example: if a web application under webapps, enables JMX programmatically (via System properties) does this mean that JMX is enabled for all web applications running in the container? I believe this is the case, but would like to confirm. This question came up from my problem in this thread: question on

反序列化漏洞

↘锁芯ラ 提交于 2019-12-07 01:22:44
Weblogic反序列化漏洞 Java 提供了一种对象序列化的机制,该机制中,一个对象可以被表示为一个字节序列,该字节序列包括该对象的数据、有关对象的类型的信息和存储在对象中数据的类型。 将序列化对象写入文件之后,可以从文件中读取出来,并且对它进行反序列化,也就是说,对象的类型信息、对象的数据,还有对象中的数据类型可以用来在内存中新建对象。 整个过程都是 Java 虚拟机(JVM)独立的,也就是说,在一个平台上序列化的对象可以在另一个完全不同的平台上反序列化该对象。 漏洞描述: 序列化指的是把对象转换成字节流,便于保存在内存、文件、数据库中;而反序列化则是其逆过程,由字节流还原成对象。Java中ObjectOutputStream类的writeObject()方法可以实现序列化,ObjectInputStream类的readObject()方法用于反序列化。 序列化:将java的对象转换为字节序列的过程叫做序列化 反序列化:将字节对象转换为Java的对象的过程叫做反序列化 通常情况下,序列化有两种用途:, 1)把对象的字节序列永久的保存在硬盘中 2)在网络上传输对象的字节序列 由于WebLogic采用黑名单的方式过滤危险的反序列化类,所以只要找到不在黑名单范围内的反序列化类就可以绕过过滤,执行系统命令。这次的漏洞就是利用了这一点,通过 JRMP(Java Remote

How to query the number of active sessions with JBoss Wildfly?

我的梦境 提交于 2019-12-06 14:57:51
We used to query the active session count by using the following code up to JBoss 7: ObjectName name = new ObjectName(jboss.web:type=Manager,path=/MyWebApp,host=default-host); MBeanServer jboss = MBeanServerLocator.locateJBoss(); this.sessions = new Long((Integer) jboss.getAttribute(name, "activeSessions")); That no longer works with JBoss Wildfly. I can't really find the proper documentation to access the same information with the current version of JBoss AS. I've come across some links like http://blog.akquinet.de/2014/09/15/monitoring-the-jboss-eap-wildfly-application-server-with-the

Tomcat Thread Monitoring Mbeans Description

情到浓时终转凉″ 提交于 2019-12-06 11:48:49
In thread related Mbeans of Tomcat I see under Catalina.ThreadPool. there are different attributes viz. maxThreads, currentThreadCount, currentThreadsBusy etc. So, where can I get the description of these Mbean attributes, what each of these attribute is indicating, I need to include this in my monitoring automation code, Which will provide the Thread utilization stats. also possible I would like to see the Source code, where can I get it? When I see the Mbean class name (through jconsole) it shows as org.apache.tomcat.util.modeler.BaseModelMBean, but when I go through the source code of

tomcat 7.0 jmx远程调试

核能气质少年 提交于 2019-12-06 11:01:43
一、tomcat开启jmx 启动脚本中添加 CATALINA_OPTS="-Djava.rmi.server.hostname=本机IP -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=端口 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false " 添加后重启tomcat 因为开启jmx后会随机开启其它随机端口号 如需从其它机器远程调试 需将tomcat所在服务器的防火墙关掉。 二、下载jmxterm 地址 http://sourceforge.net/projects/cyclops-group/files/jmxterm/ 运行jmxterm java -jar jmxterm-1.0-alpha-4-uber.jar 打开后效果如下 java -jar jmxterm-1.0-alpha-4-uber.jar Welcome to JMX terminal. Type "help" for available commands. $> 三、使用jmxterm 1,创建连接 $>open localhost:45219 #Connection to localhost