I have an application which I can run locally via Putty. This lets me view and track activity on that application. I use the command below to execute the application:
java -jar my_server.jar
I would like to view the console of my application running on remote server. How would I do this?
Any pointers/help would be appropriated.
This question does not relate to either java or jconsole.
This is about terminal facilities. Putty is used to perform SSH connection. If the remote server is Unix like system you can use command screen to perform what you want. Take a look on Unix shell reference to learn how to use screen.
Related
I have a java program in a weird condition where it has stopped running a certain thread.
I would like to connect to it using JMX, but I didn't provide the JMX arguments.
I could restart but then I would loss the information of the current condition.
I know that on Windows it can connect with jconsole on localhost without parameters, but my java app is running on a Linux server.
So any ideas on how to still be able to connect even without jmx parameters?
JConsole works on linux also. If the linux server have xhost or some remote displaying capability, I would just run jconsole on the linux server.
If you didn't enable JMX when the java program was started, you would not be able to connect remotely via JMX.
I found out that there is an option to dump the threads:
kill 3
Used it and found the reason.
Thank you.
When I want to access the database, there is an architecture through which I need to tunnel my connection. So, when I have to use a GUI tool like MySQL Workbench, i have to open three Putty sessions.
I am trying to do the same using Java. So I am using Runtime exec to run plink. This is working fine, I am able to establish the connection and send some unix commands to it and retrieve the output.
I want to run jdbc on top of it. Is it possible. Since, the putty sessions are running in the background, do the port forwarding rules apply to the jdbc I will be running?
Yes it will run if you set up the tunnels correct.
Is it possible to run command line on a remote machine (not on the server machine where the application is hosted).
I understand Runtime.getRuntime().exec(".."); will try to run the script on the server machine. Is my understanding correct and is there a way to achieve what I need?
Runtime.getRuntime().exec launches a process on the local machine, not a remote one. Wether that process represents a command line interface or not will be determined by the executable that's run, and the underlying platform.
In order to invoke processes on remote machines you need to:
Invoke a remoting type command, like rsh or ssh
Utilize a remoting third party library, like Jsch
i'm trying to execute a shell script from a j2ee application (made with flash builder 3, spring, apache cxf) et get the result of its execution in my flex interface.
the problem is my application is on a windows 7 station and i don't know how i can execute the script on a distant unix server & get back the result.
i know that ssh apis can help but i've no idea how to get back the result.
any help will be welcome.
thanx
If you have ssh installed on your windows machine, you should be able to execute a command like
ssh user#remote_host ipconfig
This will execute ipconfig on the remote_host as user "user". You will need to do a bit of research into ssh so that you can make it so you can log in without using a password, but google will help with that.
Alternatively you could look in to a java implementation of ssh - jssh for example, although I confess that I have no experience of using that package.
To execute program from windows to unix you really need ssh or telnet.
SSH is more secure. You can do this without running external process. Use one of available pure java SSH libraries (e.g. javassh.org).
See examples. If you use this library your task is trivial. Just call appropriate API.
About the only reasonable and reasonably secure answer I could come up with is to configure ssh on both machines.
*nix boxes usually have ssh server installed by default.
Putty terminal emulation for windows comes with neat ssh client command line utility called plink which can execute shell commands on a remote unix box in a secure manner.
What is your way to debug Java side when nativeProcess.standardInput.write method is invoked by Flex side? I know that it is possible but don't know how?
To be able to attach your Eclipse debugger to a running Java process you need to start that process with the following Java options…
-Xdebug -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=n
Once you have done this and have restarted the server, you can use your Eclipse to attach to the running process. From Eclipse go to the Debug manager and create a new Remote Java Application configuration for the process you want to connect to. Set the port number to 8001, the same as that of the options. You will also need to enter the hostname for the machine running the Java process. That is pretty much it…