I have EC2 instance hosting Tomcat application. It has JVM installed within.
I am trying to monitor VisualGC from my workstation.
In all those application instances we are able to establish the JMX connections in the visual vm tool, but for the plugin - Visual gc, for all the instances it says "Not supported for this JVM"
we are able to connect to the instance by adding a JMX connection
when I try to add jstatd connection, it displays "not supported for this JVM".
I have also created a policy file as suggested by other other solutions in the internet- 'jstatd.all.policy' and tried starting jstatd like below.
Command used -
./jstatd -J-Djava.security.policy=jstatd.all.policy
I made sure at that time jstatd was running in the instance, and we were able to get the stats in the instance in the command line, but We are somehow unable to get those stats displayed in the tool, the instance and visual gc plugin of the visual vm tool aren't connecting each other. Interestingly, we can see other monitor graphs.
Any reason out there why I am unble to view it?
I have already tried this command as well and this was it - sudo ./jstatd -J-Djava.security.policy=/tmp/jstatd.all.policy -J-Djava.rmi.server.hostname=<host ip> -J-Djava.rmi.server.logCalls=true &
but it did not solved the issue
Hope your security policy file (tools.policy) missing permission for tools.jar
grant codebase “file:/usr/lib/jvm/java-8-openjdk-amd64/lib/tools.jar” {
permission java.security.AllPermission;
};
Once added the above permission run jstatd,
sudo jstatd -J-Djava.security.policy=/tmp/tools.policy -J-Djava.rmi.server.hostname=10.101.32.110 -p 7198
Replace the JDK folder, hostname & port based on your env.
Related
enter image description here
I want to build and remote debug an SOA based CDI java application running on a Linux VM from Windows desktop using IntelliJ Idea. What is the most efficient way to do this so that it relieves me from manually transferring (sftp) the application, set up for remote debugging, etc?
I don't want to exit my IDE but would like to debug the application on a remote machine by modifying the app repeatedly. I would like to see the results in the IDE console window/web browser as applicable.
I used the remote debugging option in Intellij IDE, In run/debug configuration option I used Listen to remote JVM and start the debug in IntellijIDE.
I then run the following command in VM Linux:
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 com.intel.podm.rest.RequestValidationFilter
In Intellij IDE the command line arguments are dynamically updating to
-agentlib:jdwp=transport=dt_socket,server=n,address=DESKTOP-52V2CBR:5005,suspend=y,onthrow=,onuncaught=
This is fixed by opening SSH on Linux and remote debug in Intellij,and port number changes in standalone.sh script as project is based on wildfly server builded in gradle build environment.
Step 1: open a remote debug
step 2: ssh targetMachine#10.10.10.10 –L 8888:127.0.0.1:8787
If your application is in different machine try to create SSH tunnel for example:
ssh targetMachine#10.10.10.10 –L 8888:127.0.0.1:8787
Where targetMachine#10.10.10.10 is target user and address.
8888 is the local port where is IDE
8787 is debbuger port in the targetMachine (you can check that port in standalone.sh script)
I wanted to monitor the JVM of wildfly running as service with jvisualvm/visualvm but I fail to do this. I tried the following things:
setting the %TMP% and %TEMP% to C:\Windows\Temp (wildfly console
tells me this for java.io.tmpdir)
running a console with sysinternals
pstools as system account: psexec -i -s cmd.exe and started visualvm
from within this new console (checked that the temp folders are
correctly set).
In both cases under local applications the process of wildfly was listed but visualvm only told me "not supported for this jvm".
As soon as I run wildfly from the cli, visualvm has no problems and shows me everything. There is only the jdk from oracle installed (with the corresponding jre).
How can I monitor the process of wildfly running as service (local system account)? Why is it not working with the solutions above?
Thanks a lot (for reading)
Thank you Salah
With your hint (local JMX connection) I've managed to make it work by using the following command for visualvm (no change of TMP/TEMP variables in cmd):
visualvm.exe -cp:a "<path-to-wildfly>\bin\client\jboss-client.jar"
and adding the path to the jmx console (don't forget to set the username/pw for the admin gui)
service:jmx:http-remoting-jmx://localhost:9990
SUSE SLES11 SP3 x86_64 on a test machine here. I'm trying to install Oracle Weblogic 10.3.5 with generic installer but I always run in this well-known situation:
"Occasionally, the Oracle WebLogic Server or Oracle HTTP Server installation process hangs on the Specify Security Updates screen (5 of 9) in the NextGen Oracle Universal Installer (OUI). When this occurs, all of the buttons at the bottom of the OUI screen are disabled and inaccessible and the links to go back in the left-hand pane are similarly inactive."
Oracle docs suggest this woraround: "When this situation occurs, you must forcibly exit the installer by pressing CTRL-C in the xterm where you initially launched the installer. You can then restart and walk through the installation normally." Unfortunately this happens again and again.
I tried with java 1.6 and 1.7 but no luck.
Any suggestion?
TIA - Cristian
I had the exact same problem and found that when it was stuck at the “Specify Security Updates Screen”, the installer was trying to access lb-ccr.oracle.com:https (141.146.54.49:443). The fix was to temporarily configure the following firewall rule:
iptables -I OUTPUT -d 141.146.54.49 -j REJECT --reject-with icmp-host-unreachable
After configuring this and restarting the installer, at the same step, I was asked about a proxy to connect to the Internet but also gave me the option the continue installer without subscribing. Guess what I did next? :)
When the installer finishes, delete the rule from iptables using:
iptables -D OUTPUT -d 141.146.54.49 -j REJECT --reject-with icmp-host-unreachable
Another option would be to use a silent install using and XML file with installation options.
If I start a java process in a cygwin console, and then launch visualVm, the later cannot see the former.
If I start the same process in a Dos console visualvm sees it fine. I am in jdk1.6.0_25. This happens both in win7 32b, and in win7 64b with a 64b jvm.
Anyone can think of an explanation/workaround?
I fixed the problem by running VisualVM from within Cygwin. If you prefer not to profile using a remote JMX connection, you can run both VisualVM and your Java program using Cygwin:
Open the Cygwin Console window, navigate to visual_vm.exe and run that file from within the Cygwin environment.
I had the same problem. The vm was not shown automatically but I was able to connect via "Add JMX Connection", using hostname and jmx.remote.port...
On VisualVM go to File -> Add JMX Connection
localhost:3333
Add vm parameter at startup e.g.:
-Dcom.sun.management.jmxremote.port=3333
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
VisualVM can automatically detect local applications running under the same user. So one explanation can be that cygwin process is running under the different user. Make sure that both VisualVM and monitored application is running under JDK 6 update 25. JDK 6 update 25 has a fix for the following JDK bug #6938627, which can affect your case.
The opposite approach to #seanhodges answer is to launch the application to debug with a modified environment, pointing it back to your Windows User Temp directory
For example if you normally do:
./gradlew run
And say your TEMP directory on Windows (according to your User environment variables) is:
T:\Temp
You can do one of these instead:
TMP=T:\\Temp ./gradlew run
TMP=/cygdrive/t/Temp ./gradlew run
(they both seem to work)
I am attempting to have Tomcat, which is currently running as a service on a Windows 2003 box, dump heap on an OutOfMemoryError.
(Tomcat is running Hudson, which is reporting a heap space problem at the tail end of my build. Running the build manually produces no such error. The Hudson guys need a heap dump to get started.)
As instructed elsewhere, I've told the Apache Service Monitor to configure the JVM it uses to run Tomcat to dump heap when an OutOfMemoryError is encountered by adding the following to the JVM options:
-XX:+HeapDumpOnOutOfMemoryError
Then I run the build again. Sure enough, it reports there was a heap error. I scan the entire disk looking for the default java_pid123.hprof file (where obviously 123 is replaced by the PID of the JVM). No .hprof files exist anywhere.
I am caught in a catch 22: I need the heap dump for the Hudson guys to fix their memory leak, but I can't get the heap dump if I run Hudson under Tomcat.
Is there some special way, when Tomcat is running as a Windows service, to get a heap dump from it on an OutOfMemoryError?
The other thing I've tried is to tell it, on the Startup and Shutdown tabs, to use the "Java" option instead of the "jvm" option. I believe this should tell the Service Manager to attempt to start Tomcat with a Java executable command instead of launching the jvm.dll directly. When I do this, the service won't start.
Surely someone else has had a similar problem?
After finally putting this one to bed, I wanted to answer this for others who might have the same problem.
First, if you install Tomcat on Windows, do not use the .exe installer, even though it is promoted by Apache. It will not let you run Tomcat as anything other than the system account, no matter what you do. It appears that the system account does not have privileges to write .hprof files in the current directory, and no amount of Windows security tweaking appears to make this problem go away.
OK, so you've installed Tomcat from the .zip distribution. Install it as a service using the service.bat script. Make sure it is set to run as a specific user that you created specifically for this purpose. Make sure as well that the folder you want Tomcat to write to in the event of a heap dump is writable by that user.
Edit the service.bat file to include the -XX:+HeapDumpOnOutOfMemoryError and the -XX:HeapDumpPath=C:\whatever options in the correct place (where you can put JVM options). That should do the trick.
Have you tried -XX:HeapDumpPath option?
http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp
I found the following link, which describes how to configure the tomcat service (includes setting the java parameters). Not sure if it applies to the version you are running.
http://tomcat.apache.org/tomcat-5.5-doc/windows-service-howto.html
When java process running as window service you can generate the heapdump using below steps,
Run the command console as Administrator
version of JDK (for jmap command) and JRE (Java app run environment) should be same.
Get the PID no of running window process for that java application from task manager
Execute below command
jmap -dump:file=d:\heapdump\myHeapDump.hprof -F #PID_No#
If got any exception with JDK/JRE 7 try the same with JDK/JRE 8
Actually I faced some issue in jmap with JDK 7, but when i moved to JDK 8, I were able to successfully generate the heap dump using same command
The .hprof files are dumped in the current directory. Exactly what that means for a windows service is anyone's guess, assuming it means anything.
I suggest posting a new question (on http://superuser.com) asking what "current directory" means for a windows service.
From 20 Tips for Using Tomcat in Production
Add the following to your JAVA_OPTS in catalina.sh (or catalina.bat for Windows): -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/j2ee/heapdumps
if you have installed tomcat with .exe you can configure tomcat service to use account other than local system account and you can assign that user rights on directory "c:\whatever" where you are creating your dump file. one thing here to remember tomcat service don't run with account having administrative privileges. so create a simple user in windows(member of user group) and set tomcat services to user this account. and give that user rights on "c:\whatever" directory. This resolves the user directory rights issue but you have to configure tomcat for Memory dumps errors.