feedburner
Enter your email address:

Delivered by FeedBurner

feedburner count
Showing posts with label Management. Show all posts
Showing posts with label Management. Show all posts

VisualVM Java Profiler Causes Profiled JVM to Crash

Labels: , , ,

VisualVM is a tool that integrates several management and monitoring tools for local and remote Java applications including a Java profiler. The VisualVM profiler enable you to analyze CPU and memory usage of local Java applications.
When attaching the VisualVM profiler to a Java application which is running on Java 6, the profiler may cause the Java application to crash. To prevent this from happening, you need to turn off class sharing for the Java application. Any Java application can be start with class sharing turned off by starting the application with the -Xshare:off argument.

libstdc++2.10-glibc2.2 on Linux Ubuntu Hardy 8.04

Labels: , , , , ,

The libstdc++2.10-glibc2.2 package is not on the Ubuntu Hardy 8.04 Linux repositories so it can't be installed using apt-get or synaptic package manager.


$ sudo apt-get install libstdc++2.10-glibc2.2
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libstdc++2.10-glibc2.2 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is only available from another source
E: Package libstdc++2.10-glibc2.2 has no installation candidate

In order to install libstdc++2.10-glibc2.2 on Ubuntu hardy 8.04 Linux, you need to download libstdc++2.10-glibc2.2_2.95.4-24_i386.deb and install it using dpkg:

wget mirrors.kernel.org/ubuntu/pool/universe/g/gcc-2.95/libstdc++2.10-glibc2.2_2.95.4-24_i386.deb
sudo dpkg --install libstdc++2.10-glibc2.2_2.95.4-24_i386.deb

libstdc++2.10-glibc2.2 contains libstdc++-libc6.2-2.so.3 which is required by Eclipse tptp agent controller, Eclipse based Java profiler.
The upgrade from Ubuntu Gutsy 7.10 Linux to Ubuntu Hardy 8.04 Linux removes the package. Because of this the Eclipse tptp Agent Controller fails to start.

$ ./ACStart.sh
Starting Agent Controller.
ACServer: error while loading shared libraries: libstdc++-libc6.2-2.so.3: cannot open shared object file: No such file or directory
ACServer failed to start.

JMX remote connection failure to Java application running on Ubuntu

Labels: , , ,

I have been trying to remote monitoring my application which was running on Ubuntu server using Jconsole and I kept on getting connection failure.
When I run the same application on my Ubuntu desktop I did managed to connect to it using Jconsole.

I wrote a small program to help me investigate the problem:


public class JmxTest {
public static void main(String[] args) {

try {
Thread.sleep(Integer.MAX_VALUE);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}

and I ran it with the following properties on my Ubuntu desktop:
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9004 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false

I have tried to connect to it using JConsole from a different machine on my network and I got the same error. I have tried to connect to the application using MX4J and I got the following exception:
java.rmi.ConnectException: Connection refused to host: 127.0.1.1; nested exception is:
java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:574)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:94)
at javax.management.remote.rmi.RMIServerImpl_Stub.newClient(Unknown Source)
at javax.management.remote.rmi.RMIConnector.getConnection(RMIConnector.java:2239)
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:271)
at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)
at org.mc4j.console.connection.JSR160ConnectionNode.connect(JSR160ConnectionNode.java:132)
at org.mc4j.console.connection.ReconnectAction.performAction(ReconnectAction.java:47)
at org.openide.util.actions.NodeAction$3.run(NodeAction.java:440)
at org.openide.util.actions.CallableSystemAction$ActionRunnable.actionPerformed(CallableSystemAction.java:247)
at org.netbeans.core.ModuleActions.invokeAction(ModuleActions.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.openide.util.actions.CallableSystemAction.invokeAction(CallableSystemAction.java:179)
at org.openide.util.actions.CallableSystemAction.access$000(CallableSystemAction.java:31)
at org.openide.util.actions.CallableSystemAction$ActionRunnable.doRun(CallableSystemAction.java:241)
at org.openide.util.actions.CallableSystemAction$2.run(CallableSystemAction.java:111)
at org.openide.util.Task.run(Task.java:136)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:330)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:686)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:520)
at java.net.Socket.connect(Socket.java:470)
at java.net.Socket.<init>(Socket.java:367)
at java.net.Socket.<init>(Socket.java:180)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:569)
[catch] ... 23 more

I have noticed the Connection refused to host: 127.0.1.1. My /etc/hosts file (where the application is running) contains a line with the entry 127.0.1.1:
127.0.0.1 localhost
127.0.1.1 ubuntu-desktop


I removed the 127.0.1.1 line and I moved the host name to the end of the first line:
127.0.0.1 localhost ubuntu-desktop

After that I tried again to connect to my application using MX4J. This time I got the same exception but instead of 127.0.1.1 I got 127.0.0.1
 java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is: java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:574)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:94)
at javax.management.remote.rmi.RMIServerImpl_Stub.newClient(Unknown Source)
at javax.management.remote.rmi.RMIConnector.getConnection(RMIConnector.java:2239)
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:271)
at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)
at org.mc4j.console.connection.JSR160ConnectionNode.connect(JSR160ConnectionNode.java:132)
at org.mc4j.console.connection.ReconnectAction.performAction(ReconnectAction.java:47)
at org.openide.util.actions.NodeAction$3.run(NodeAction.java:440)
at org.openide.util.actions.CallableSystemAction$ActionRunnable.actionPerformed(CallableSystemAction.java:247)
at org.netbeans.core.ModuleActions.invokeAction(ModuleActions.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.openide.util.actions.CallableSystemAction.invokeAction(CallableSystemAction.java:179)
at org.openide.util.actions.CallableSystemAction.access$000(CallableSystemAction.java:31)
at org.openide.util.actions.CallableSystemAction$ActionRunnable.doRun(CallableSystemAction.java:241)
at org.openide.util.actions.CallableSystemAction$2.run(CallableSystemAction.java:111)
at org.openide.util.Task.run(Task.java:136)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:330)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:686)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:520)
at java.net.Socket.connect(Socket.java:470)
at java.net.Socket.<init>(Socket.java:367)
at java.net.Socket.<init>(Socket.java:180)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:569)
[catch] ... 23 more


After that I removed the host name from the file and I tried again, this time everything worked.

I have found this Blog entry about troubleshooting connection problems in jconsole. In my case the problem was different but it might be helpful to others .

How to enable JMX on a Java Application

Labels: , ,

To enable Java with JMX Agent we need to add the following line to the application VM arguments:
-Dcom.sun.management.jmxremote

This will enable only local monitoring. To enable remote JMX connection we need to specify the port which the JMX server will listen for remote connection.
-Dcom.sun.management.jmxremote.port=9004 (or any other port number)

The JMX remote connection is secured by default. To disable the authentication or the SSL in the JMX remote connection:
-Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false

much more information about monitoring and management using JMX can be found here