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…
Related
I am attempting to debug a remote Java application in a Linux environment with an argument. However, I can only find the option to define an argument when debugging a [local] Java application. The argument I am trying to define is java -Dsun.awt.disablegrab=true to avoid having the system hang when I debug in event handlers. Given the nature of this application, I cannot launch it locally; I can only debug it as a remote Java application and define the host as localhost. Is there a way to launch debug for a remote Java application with the aforementioned argument?
Thanks to everyone in advance!
In order to allow opening the port for remote debugging, the application (or its server)'s launch will be parametrized with Java command-line arguments already, e.g. something in the lines of:
-Djava.compiler=NONE -Xdebug -Xnoagent
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=[your desired port]
I would simply add your desired parameter to the list, when you launch the process in debug mode.
Where to find the launch configuration will depend on the type of application you're running.
Since you likely already know the port to connect to, you may want to grep it in your configuration files, in the targeted machine (i.e. in your local machine, in this specific case) - that might give you an idea what resource you need to make changes to.
Clarification
The idea here is that your local Eclipse is not launching the application when remote-debugging, it only connects to a socket of your own definition, with an open port to connect to your target machine.
Therefore, it it up to your application's launch configuration (i.e. how the java process is parametrized when launching your application) to define the socket for remote debugging if so required, and any launch parameters you may want.
I am new to play framework. I have an existing play application. I am supposed to understand it and make enhancements. So I am running the application on my windows 7 machine. It runs fine. On using debug(activator -jvm-debug), the jvm starts listening on default port 9999. Till this point everything is fine. When I start debugging it as a remote java application from my eclipse, the process listening on the port 9999 gets terminated. I have been monitoring the activity on Windows Resource Monitor. I have no clue where to check for the issue. Any help will be greatly appreciated
Thank you
The common things that you can check for a generic situation like
Message: “Failed to connect to remote VM. Connection Refused”
1) Have you setup the remote VM to accept connections?
java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=10000,suspend=n yourServer
2) Is there a firewall in the way? Are you specifying the correct host / port?
I am working on some machine learning for chemical modelling in python. I need to run a java app (from command line through python subprocess.call) and a python webserver. Is this possible on AWS EC2?
I currently have this setup running on my mac but I am curious on how to set it up on aws.
Thanks in advance!
Since you're just making a command line call to the Java app, the path of least resistance would just be to make that call from another server using ssh. You can easily adapt the command you've been using with subprocess.call to use ssh -- more or less, subprocess.call(['ssh', '{user}#{server}', command]) (although have fun figuring out the quotation marks). As an aside on those lines, I usually find using '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' stabilizes scripted SSH calls in my environment.
The more involved thing will be setting up the environments to properly run the components you need. You'll need to set up ssh configs so that your django app can ssh over and set up -- probably with private key verification. Then, you'll need to make sure that your EC2 security groups are set up to allow the ssh access to your java server on port 22, where sshd listens by default.
None of this is that hairy, but all the same, it might be stabler to just wrap your Java service in a HTTP server that your Django app can hit. Anyway, hope this is helpful.
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.
VisualVM/VisualGC provides quite a lot of useful GC-related metrics in real-time, but I want a command-line tool that can connect to a remote application via jstatd and record in CSV or XML ideally exactly the same metrics as VisualGC provides. It shouldn't be a problem to write my own, but from the first look I cannot find what protocol visualvm/jstatd use.
As I understand VisualGC is not open source: https://stackoverflow.com/questions/11096466/where-is-the-source-code-repository-for-visualgc, but are there any alternative open source tools? Are there any clues how about the protocol used?
I managed to connect to jstatd via RMI (default port 1099, JStatRemoteHost is the rmi-name), can attach to a particular VM - but http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/sun/jvmstat/monitor/remote/RemoteVm.java#RemoteVm is rather a very low-level interface with jstatd.
I've checked out the VisualVM source code from https://svn.java.net/svn/visualvm~svn/trunk
and just started looking at the 5mb codebase, however it doesn't use neither RemoteHost nor RemoteVm RMI-classes.
Thanks.
First I looked at the source code of VisualVM (~5mb), created a command-line tool that registers JvmstatModelProvider on JvmstatModelFactory, gets an Application, creates JvmJvmstatModel and extracts all MonitoredValues - it connects to a remote application via jstatd and prints changed values in format timeMillis,name,value
1369270235646,sun.gc.generation.2.space.0.capacity,16777216
1369270236666,sun.os.hrt.ticks,2511500491
1369270237581,sun.gc.generation.0.space.0.used,641408
1369270237582,sun.os.hrt.ticks,2512502544
One hour later I found the right command-line tool for my task https://code.google.com/p/hatter-source-code/wiki/hotstat, that doesn't use jstatd - but fine, I can still run it remotely via ssh.