jmx

Efficient way of getting thread CPU time using JMX

我的未来我决定 提交于 2019-12-18 13:34:39
问题 I'm currently getting the total thread CPU time using JMX in the following manner: private long calculateTotalThreadCpuTime(ThreadMXBean thread) { long totalTime = 0l; for (ThreadInfo threadInfo : thread.dumpAllThreads(false, false)) totalTime += thread.getThreadCpuTime(threadInfo.getThreadId()); return totalTime; } As the ThreadMXBean is actually a remote proxy, performance is dreadful , in the order of magnitude of seconds for this actual method call. Is there a faster way of doing this?

configure JMX for ActiveMQ for remoting access

孤街浪徒 提交于 2019-12-18 11:31:50
问题 Anyone can give the detailed steps on how to enable JMX (can be access remotely) on a newly installed 5.5.0 version? 回答1: In your activemq.xml file, you need make sure useJmx is true on your broker element: <broker xmlns="http://activemq.org/config/1.0" brokerName="localhost" useJmx="true"> and ensure that you have a management context <managementContext> <managementContext createConnector="true" connectorPort="1099"/> </managementContext> From there it is just a matter of making sure you can

How to find the default JMX port number?

三世轮回 提交于 2019-12-18 10:02:07
问题 I am running a Java application on Java 6 VM on a remote Windows XP, on which I can run jvisualvm.exe to connect to the running application automatically. Now I need to connect that application from my local computer, but I don't know the JMX port number of the remote computer. Where can I find it? Or, must I restart that application with some VM parameters to specify the port number? After reading the question How to find the JMX port in a server, I executed the command on the remote

Why does JMX connection to Amazon EC2 fail?

非 Y 不嫁゛ 提交于 2019-12-18 06:17:29
问题 I set up JMX on one of services running on Amazon EC2 instance but it doesn't work properly. I'm using VisualVM to connect and after short period of pending it fails with timeout. Looks like it fails because of missing response data or lags. I checked that JMX port is enabled in security group and also tried with different port with no JMX enabled and also with port not enabled in security group settings and both fails immediately, so it looks different. My EC2 instance and desktop both have

Getting server address and application name

和自甴很熟 提交于 2019-12-18 04:13:20
问题 Environment: NetBeans 6.9.1, GlassFish 3.1 I have a Java Web Application. How to get the server address and the application name dynamically? The '2in1' solution would be the best for me: http://localhost:8080/AppName/ . Is there a practical way to get that information? Let's say the value of AppName will be fixed, so I only need the host address. Is it possible to retrieve it via JMX? Any other ways? 回答1: The HttpServletRequest object will give you what you need: HttpServletRequest

Accessing a remote MBean server

青春壹個敷衍的年華 提交于 2019-12-17 23:48:04
问题 I am running a client/server application using JBoss. How can I connect to the server JVM's MBeanServer? I want to use the MemoryMX MBean to track the memory consumption. I can connect to the JBoss MBeanServer using JNDI lookup but the java.lang.MemoryMX MBean is not registered with the JBoss MBeanServer. EDIT: The requirement is for programmatic access to the memory usage from the client. 回答1: Unlike the JBoss server's MBeanServer, the JVM's MBean server doesn't allow remote monitoring by

JConsole over ssh local port forwarding

落爺英雄遲暮 提交于 2019-12-17 08:03:07
问题 I'd like to be able to remotely connect to a Java service that has JMX exposed, however it is blocked by a firewall. I have tried to use ssh local port forwarding, however the connection fails. Looking at wireshark, it appears that when you try to connect with jconsole, it wants to connect via some ephemeral ports after connecting to port 9999, which are blocked by the firewall. Is there any way to make jconsole only connect through 9999 or use a proxy? Is this article still the best solution

Remote JMX connection

ε祈祈猫儿з 提交于 2019-12-17 06:59:12
问题 I'm trying to open a JMX connection to java application running on a remote machine. The application JVM is configured with the following options: com.sun.management.jmxremote com.sun.management.jmxremote.port=1088 com.sun.management.jmxremote.authenticate=false com.sun.management.jmxremote.ssl=false I'm able to connect using localhost:1088 using jconsole or jvisualvm. But I'm not able to connect using xxx.xxx.xxx.xxx:1088 from a remote machine. There is no firewall between the servers, or on

java-如何使JMX简单

点点圈 提交于 2019-12-14 06:10:43
我需要在30种不同的类中向JMX公开大约60种操作.用DynamicMBean制作它有点烦人.我正在寻找一种快速而优雅的方法. 我知道 Spring 具有注释的好方法,但是我在这个项目中没有使用spring. 最佳答案 请看一下我的 SimpleJmx Java package ,它旨在通过使用注释的JMX轻松发布bean.它还具有客户端代码. 快速代码示例: // you can also use the platform mbean server JmxServer jmxServer = new JmxServer(8000); jmxServer.start(); // register our lookupCache object defined below jmxServer.register(lookupCache); ... jmxServer.stop(); 这是定义bean的方法. @JmxResource(domainName = "j256", description = "Lookup cache") public class LookupCache { @JmxAttributeField(description = "Number of hits in the cache") private int hitCount; ...

RMI ClassNotFoundException

六眼飞鱼酱① 提交于 2019-12-14 03:13:10
问题 I have problem with rmiregistry. I'm getting below error: Cannot bind to URL [rmi://........]: javax.naming.NamingException [Root exception is java.rmi.UnexpectedException: undeclared checked exception; nested exception is: java.lang.ClassNotFoundException: Could not find class (javax.management.remote.rmi.RMIServerImpl_Stub) at codebase ()] I checked, class exist in the classpath. I used java 1.6 on linux. I started rmiregistry 6667 . Has anyone met with this error? 回答1: class exist in the