I want to connect to JVM running on remote CentOS 6 server using VisualVM installed on server. I connect to server using ssh with X forwarding:
ssh -X <user#ip>
My ~/.bashrc exports these variables to run VisualVM:
export JAVA_HOME=/usr/local/jdk1.8.0_102/
export PATH="$JAVA_HOME/bin:$PATH"
Then I run VisualVM locating on remote server:
/usr/local/visualvm_138/bin/visualvm
It invokes without errors, but there is no application view appeared (which should appear at application start). Also, there is no Applications sub-item inside Window menu item. I already ran VisualVM successfully using this way about month ago. How to make this window appeared?
Try to delete VisualVM userdir and cache and than restart VisualVM. Userdir is at ~/.visualvm/1.3.8 and cache is at ~/.cache/visualvm/1.3.8
Related
All,
I have a remote server that I recently enabled VNC for using vnc4server and Chicken for mac as the client.
The purpose for doing so was to enable running Java's Jconsole to monitor an executable jar file that is running my server logic.
However, after logging into my server using VNC, I keep getting an error when I try to use Jconsole on vnc.
It states connection failed do you want to try again. Now I am logged in as the same user that started the process.
Is there something I am missing when using jconsole in VNC? Also can I monitor my executable jar file remotely using Jconsole on my local machine?
These are the options I am including to run the jar file: java -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9005 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.remote.ssl=false -Djava.rmi.server.hostname=ipaddress -jar path
Thanks
These JVM options fixed things. Fix found here: You need to pass to the VM: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false
https://forums.oracle.com/thread/1177644
This does not seem like an VNC issue- either the ports are not open, they are being blocked b a firewall, or there is some kind of permission/authentication issue with the app itself related to monitoring it.
In order to eliminate VNC as the cause (and use localhost in a local connection on jconsole), do "ssh -X REMOTHOST -n jconsole" and see. This will also eliminate the overhead of running the full X server and VNC.
Also on linux you can find out what process holds a port open by doing:
netstat -ap | grep PORT_NUMBER on the remote host you want to run on.
Colin
I am trying to run psservice.exe and plink.exe from servlet using runtime exec. It will be used for starting or stopping services on remote computer running windows and unix aix.
I have set system variables so that i am able to run them from command prompt. These commands are running perfectly from command prompt and java program
I am using below code in Servlets for remote windows machine
Runtime.getRuntime().exec(serverPropLoader.getServerProperties("psservice \\\\172.xx.xx.xx -u username -p password stop MySQL"));
I am using below code in Servlets for remote unix aix 5.3 machine
Runtime.getRuntime().exec(serverPropLoader.getServerProperties("PLINK.exe -ssh -pw "password" username#172.xx.xx.xx /home/mysql/stopservice.sh"));
Below are my observations :
If i run above statement from Eclipse (ver 3.4.2) using Tomcat6 it runs perfectly fine, but if export my web app as WAR and deploy it in Tomcat6 mannually it dosen't run. ( i have tried deploying it in mine and other system)
I have tried puting these command in Batch file and calling it from servlet but no success. From Batch file "net" and "sc" command are working but i am not able to run pservice and plink command. also "sc" command is working for local processes only.
After execution of servlet i am able to see psservice.exe and plink.exe in windows task manager but required services on local and remote system is not starting / stopping
The problem here is, you need to add admin previladges for the tomcat user.
Because this Apache Tomcat Monitor program requires permission to interact with system services, it cannot be executed as a standard user.
Do following tasks, you will be fine
Locate the tomcat7w.exe program in Windows Explorer (the default directory is C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin).
Right-click the name of this file and select the Properties context menu item.
The tomcat7w Properties dialog displays.
Select the Compatibility tab and click either the "Show settings for all users" button or the "Change settings for all users" button at the bottom of the dialog.
A new tomcat7w.exe Properties dialog displays with a single tab entitled Compatibility for all users.
At the bottom of this dialog, in the Privilege Level group box, select the Run this program as an administrator.
The Apache Tomcat Monitor executable will now execute with the required privileges when run from a standard user account.
for more information pls refer
https://supportcontent.ca.com/cadocs/0/CA%20Automation%20Point%20Base%2011%204-ENU/Bookshelf_Files/HTML/AP--RelNotes/index.htm?toc.htm?2009998.html
I'm using netbeans 6.1.
I've got the following in my java run time settings:
-agentlib:jdwp=transport=dt_shmem,address=jdbconn,server=y,suspend=n
and the following in the attach dialog in netbeans:
Debugger: JPDA Debugger
Connector: Shared Memory Attach (Attaches by shared memory to other VMs)
Transport: dt_shmem
Name: jdbconn
I got the above settings from the FaqDebuggingAppletRemotely page on the netbeans Wiki.
The applet is in an aspx page (the applet, whcih is signed, is a method of communicating via the client browser to a legacy platform, I'm a C# developer really). I've managed to get the security warning to display which gives me a chance to attach to the applet but whenever I try to attach I see:
Attaching to jdbconn
shmemBase_attach failed: The system cannot find the file specified
in the output window in netbeans.
Any help gratefully received!
I would bet anything (almost anything ... maybe a few dollars at least, or a cookie) that the JVM installation your applets are running on is NOT the same as the default JVM installation that is installed on your system.
To find the JVM installation that your browser and applets are using in Windows 7:
1) Close all applications that use the JVM (especially the browser).
2) Open the windows task manager (CTRL+ALT+DELETE->Task Manager), and click on the processes tab.
3) Make sure there are not any java*.exe processes running.
4) Open your browser and go to the applets page, and start the applet up again.
5) Now go back to the Task Manager->Processes tab and look for the java*.exe that is now running (it will most likely be "java.exe *32" literally, as in it will literally have an asteriks in the name of the process. If you don't see that one, then just use whichever one IS running).
6) Right click on that process, and in the context menu select "Open File Location". This should bring you to the "bin" folder location of the installed JVM that your browser is using to run your applets! Are you surprised that it is not the same as what you thought it would be?
To find the task on linux or other systems:
I've only ever had this problem on Windows, but here's how you do it anyhow.
Open a shell, and type the following
ps -e | grep java
And make a note of the pid(s).
Now that you know which JVM your applets are using:
We need to open the Java Console for that partivular installation (as opposed to the default installation we tried to modify before).
To open the Console of the JVM installation that your applets are using, and set the runtime parameters:
1)Open a command prompt (shell or whatever) in the bin folder of the JVM installation. (In windows 7, from the explorer, you can shift+right-click on the bin folder, and select "Open Command Prompt Here").
2) Run the following command to open the console:
javaws -viewer
This also ends up opening the "Java Cache Viewer" window, which we do not need. Close that window, but keep the "Java Control Panel" window open.
3) You can now go to the Java tab, click on view, and modify the runtime parameters just as you did before:
-agentlib:jdwp=transport=dt_shmem,address=jdbconn,server=y,suspend=n
4) Click "OK", and then click "Apply" in the main java console window to apply and save all the changes you made.
5) WAIT! There is one last thing that I suggest you do; clear out the java WebStart cache to make sure your applets download fresh using the new parameters:
javaws -uninstall
Be sure and run this in the bin directory of the JVM installation that your applets are using, since this might not be the same bin directory that is pointed to by your Path (or PATH) system environment variable.
Now start up your applet from your browser, and create another shared memory connection inside your NetBeans IDE! Setup break points in the correct source code you are debugging ("source" tab in NetBeans), and start using your applet. You should now see that Netbeans is breaking on your break points!
At least, I hope so...
When you debug with the shared memory option (transport=dt_shmem), you're using Windows internal shared memory objects to communicate between the debugger and the jvm.
This means that if you're:
a. Not debugging from the same physical machine as your jvm, or
b. Not working on a Windows OS,
You can not debug in this mode.
I'm not sure what would happen if you ran a Window on a VM on a Linux station...Might work and might not.
If both of the above are fine, it would require a deeper investigation to find out the problem, but in the mean time, you could attach with a plain socket.
In the Java run time parameters specify:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=y
This tells your jvm to run in debug mode, load the jdwp library, wait for connection to attach in port 8000, and suspend execution until such a connection arrives.
In your IDE set the remote debugger accordingly. I don't know Netbeans, but it would be something like Connector = socket connector, address=8000.
When you start your web page, the applet will freeze loading until you connect, and of course you can't connect until it has reached the listening stage.
Good luck!
I am running GlassFish 3.0.1 as a windows service under Windows Server 2003 with Java 1.6 u 20, and am generally happy.
I would like to be able to use VisualVM on this JVM and used Unable to use JConsole with Tomcat running as windows service as a starting point, but starting with
PsTools\PsExec.exe -i -s "C:\Program Files\Java\jdk1.6.0_20\bin\jvisualvm.exe"
results in a jvisualvm.exe and a nbexec.exe process showing up in Task Manager with SYSTEM as the user but I do not see any GUI from the program as I do when I run it manually as myself. I am logged in with Remote Desktop from Windows 7 in case that makes any difference.
Other interesting points:
at 10:55 /interactive cmd.exe
reports a new job has been added, but does not open a CMD window at 10.55.
The description of how to register VisualVM as a service reports the service to start but no GUI shows up. http://blogs.oracle.com/nbprofiler/entry/monitoring_java_processes_running_as
Have anybody gotten this to run under Windows Server 2003?
The way I'm able to get this to work is to make sure that you remote desktop to the server's "console" session.
Simply put, when you open mstsc.exe append the text " /admin" to the computer name you are trying to connect to. For instance, if you were trying to connect to a server called "FOO", then in the Computer name text box in mstsc.exe, you would enter "FOO /admin".
After connecting and logging in to the server, you can execute your PsExec command. You should then see Visual VM with the GlassFish process you are trying to connect to.
For more info about connecting to the console session with remote desktop in Windows, have a look at the "How to Connect to the Console" section http://support.microsoft.com/kb/278845.
Also, for those looking for PsExec.exe, you can get it from the PsTools package from Microsoft at technet.microsoft.com/en-us/sysinternals/bb897553.aspx.
I am trying to profile CPU usage using TPTP.
Application to profile run on Linux RH AS5. I installed and configured Agent Controller like described here
I ran the java application using the command
java '-agentlib:JPIBootLoader=JPIAgent:server=standalone,file=log.trcxml;CGProf' MyApp
The monitoring station is All-In-one TPTP version 4.6.2. I followed the stepes described here
on Eclipse - on the "Profile Configuration" I choose a new configuration for "Attach to Agent", set the host to my remote linux machine where MyApp is running, test connection succeed and when I get to the "Agents" tab, I see "Pending...", a background process "Feching children for host" is running and can't find anything which makes it impossible to profile.
Any idea?
You have to run the Agent Controller on the java application in server mode. Currently your command runs it 'headless' and writes it to a log file. The website you linked has a list of the various options for the server parameter.
java '-agentlib:JPIBootLoader=JPIAgent:server=enabled;CGProf' MyApp