Debugging Apache Spark clustered application from Eclipse - java

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

Related

Remote debugging - Java

I am currently with a batch process that breaks into production, which is in a weblogic. This process can only be executed on a machine that is configured to run automatically.
My question is if a remote debugging can be done from my machine?
I really would not recommend remotely debugging a machine which is on production. However, if you must, you will need to do three things:
Startup the application with remote debugging turned ON on a port 80 or any other port of your choice by adding the following line to your java -jar command.
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=80
For example,
sudo java agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=80 -jar original-example-service-local.war
This port needs to be accessible from your machine, you will need to open this port from your security group in AWS or however you are managing this instance. This step is very important.
Add the configuration in your IDE to do remotely connect to the application. You can find many guides on this online.
For IntelliJ --> https://docs.alfresco.com/5.2/tasks/sdk-debug-intellij.html
For Eclipse --> https://docs.alfresco.com/5.2/tasks/sdk-debug-eclipse.html
Hope this helps.

Debug code on one machine, run JBoss on another

Is it possible to setup JBoss server on one machine (PC) and then connect to it from another machine (laptop) ? I want to be able to run/deploy my application on the server on the PC and through Intellij on the laptop debug my code using that JBoss instance on the PC. I'm running a domain version of JBoss. Right now I have both the server and client running on the same machine. I'm not sure how to get around doing it, thanks for any help.
Yes it is possible to remote debug your application.
If you look at the first lines in the startup script standalone.[sh|bat], you'll see that debug agent can be enabled with the --debug command switch.
Switching this debug option will enable the JPDA and will listen on port 8787 by default.
This can also be achieved using JAVA_OPTS (look at the end of standalone.conf[.bat])
Once you started WildFly, you'll need to add a remote debug configuration in IntelliJ using the IP and port of your server. Here is the official documentation.
For remote deployment, you should have a look at the jboss-cli.
In Eclipse you can connect as follows, I'm sure Intellij must have something similar as well:
Run-> Debug Configuration->Remote Java Application. Here you can define the Host and Port of the application server, irrespective of it's location, be it local or any remote location.

Profiler tab not coming in visualvm for remote jmx connection

Am trying to profile a remote tomcat appln which is my staging env. But I am unable to get the profiler tab. Tried googling but I couldnt find the exact issue here.
Both my remote and local jdk versions are same. Both are java 8. Am using visualvm 1.3.8
Profiling of remote application is not supported, please use 'Sampler' tab instead.

debugging mpi java

How does one debug mpijava code. Ideally, I would want to debug it on the same machine with eclipse with a master and a client running and attached to the same eclipse. Though these might be two processes but since eclipse can debug multiple running threads, may be that is possible ?
Run server with options:
-Xdebug -Xrunjdwp:transport=dt_socket,address=8998,server=y
Then run eclipse and connect to 8998 port. See How To Debug a Remote Java Application for details.

Debug servlets with eclipse (running resin)

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.

Categories

Resources