Debug servlets with eclipse (running resin) - java

I am using eclipse (Java EE edition) to write Java servlets and I would like to utilize the debugging functionality. However, I was reading the tutorial to set this up and when I got to the stage the choose a "Server Runtime Environment", I got stuck. I am using Resin, which does not appear to be in the list of available server runtimes. Is there any way to get around this? Is the debugging unusable with Resin?

You will need to run your server in a remote debug mode:
http://wiki.caucho.com/IDE#Remote_Debugging
After that connect your eclipse to the server by choosing debug configuration -> new remote java application (in which you will need to insert the address and the port of the server.
This concept is valid to pretty much all type of servers.

Related

How do I debug a Java application deployed in a cluster environment using IntelliJ IDEA?

Each time when I need to debug a Java application deployed in a cluster environment, I'm in big trouble.
Company's environments (Test, Acceptance, etc.) usually is cluster environments with multiply servers and in front of the cluster, there is a proxy server that forwards the requests (HTTP) to one of the servers in the cluster. If you have no access to the individual servers and you are not allowed to lunch the app from one particular server then you must use the endpoint that comes from the proxy.
As I know one IntelliJ can open only one remote debug connection. That means if the request goes to another server in the cluster (where my debugger is not attached) then I can not see anything in my debug window. Maybe next time.
If you are lucky you can stop all servers in the cluster except one, what you are debugging. But to stop servers is also not easy, especially in Acceptance environments.
According to my colleagues, I can debug multiply servers with one Eclipse instance, but I really do not want to use Eclipse.
Okay, I guess that I can copy the whole source code to a different folder, open the code with a new IntelliJ instance, and from there I can connect to the 2nd server in the cluster. But this is a painful hack.
Is there any normal way how to debug the cluster environment with multiple servers with IntelliJ?
You can open as many number of debug sessions as many remote JVM are running on remote ends (on corresponding ip address and tcp port) by creating multiply Run Configurations and launch them:
For example to connect with the above host and port, the remove JVM must be started with
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
if you use JDK version 8 or less, and the
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
if you use JDK version 9 or newer.

Debugging Apache Spark clustered application from Eclipse

I am trying to debug Spark application running on eclipse in clustered/distributed environment but not able to succeed.
Application is java based and I am running it through Eclipse. Configurations to spark for Master/worker is provided through Java only.
Though I can debug the code on driver side but as the code flow moves in Spark(i.e call to .map(..)), the debugger doesn't stop. Because that code is running in Workers JVM.
Is there anyway I can achieve this ?
I have tried giving following configurations in Tomcat through Eclipse :
-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=7761,suspend=n
and setting respective port in Debug->remote java application.
But after these settings I get the error: Failed to connect to remote VM. Connection Refused
If anybody has any solution to this, please help.
I was facing the same issue while configuring the spark debugging on remote master. But after that I've installed the spark on my Ubuntu machine then it worked fine. If you really want to debug, my suggestions are
1- configure spark on your testing machine then you can easily debug applications.
2- use IntelliJ IDEA, I've used it for for debugging if I've to use remote spark.
EDITED:
If you are going to use IntelliJ IDEA then you can easily configure remote debugging as explained here. Debugging Apache Spark Jobs

How do I build, deploy and debug standalone java app on remote machine?

How do I build, deploy and debug standalone java app on remote machine with IDEA ?
I have remote machine with certain hardware device connected to it. I want to develop standalone Java app on my PC, build it locally but the app should be deployed and running on remote machine accessible via SSH. Thus I'll be using Java remote debug.
I've googled extensively but couldn't understand if it's possible to achieve in IDEA (even though IDEA allows to do so for java servlet containers). I tried "Remote SSH External Tools" plugin. I'm not sure what to specify in following dialog (which seems to have bug)
What options do I have ?
If the machine is only reachable via SSH you need to do two things:
Configure your java application for remote debugging
Connect to the application via SSH
This tutorial should get you going: Remote Debug of a Java App Using SSH Tunneling

tomcat server instance debugging in the eclipse

I have the following configuration in the eclipse
Created a tomcat 7.0 server instance from the servers view.
Created a sample web application and deployed in the server through maven-tomcat-plugin and tested it in the browser ( started the server by right
clicking the server from the server view and selected start )
Tried to configure the remote debugging settings in the created server instance using JPDA options,i added the env variables in the server setting.
i could not connect the debugger to the server when i start the server from the eclipse as like previously.
But it connected seamlessly when i start the directly from the installation directory using the command prompt as like
catlina.bat jpda start
After that i tried this I started the server instance by ( started the server by right clicking the server from the server view and selected DEBUG mode)
I got the Break points in the code and even Hot Code replacement
working!!!
Can anyone explain the following?
What goes wrong when i tried jpda options for the remote debugging with the created server instance in the eclipse?
How the debug option and Hot Code replacement works with the server instance?Is this remote debugging or something else?Can you explain on this one?
the eclipse tomcat plugin spawns a separate JVM while running, you can confirm that in the windows task list, using ps in unix like systems or using visualVM.
That VM is launched in debug mode with the JPDA parameters set by the plugin itself, and that is how the debugging mechanism works, it's based on the JVM functionality. You can confirm which jpda parameters are used by using visual VM, that comes with the JDK.
I don't think you can override the JPDA parameters that the eclipse plugin setted for you, that's why in point 1) it did not work. For 2) it works via remote debugging made transparent by automatic setting the parameters and connecting the remote debugger once the server starts.

NativeProcess API Java Debugging?

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…

Categories

Resources