Debug the source code in Eclipse when connected from Tomcat - eclipse

I have a tomcat server running a web application say, "A" which runs in port 8080.
I have another tomcat server started inside eclipse, say "B" which runs in port 8181.
Now, in a particular point, A is calling some service in B. I would like to debug the "B" service which runs in eclipse.
I have tried lot of options, like enabling jpda port in tomcat and enabling debugger in eclipse, but i didn't get the expected result.
Could any one help me to achieve this?
Suresh.

Related

Aws backend code debugging

I deployed my backend code(used framework is drop-wizard) in the form of jar file on AWS(Amazon Web service) server. I want to know is it possible to debug that jar file(jar file deployed on the AWS server) using eclipse on my local pc?? If yes than please display the way of how to do it??
Looking for a good response
Thanks
First, you need to start your application with remote debugging
enabled. With dropwizard, you are typically starting the application
on a server with:
java -jar myapp-0.0.1-SNAPSHOT.jar
Change this to:
java -Xdebug -agentlib:jdwp=transport=dt_socket,address=9999,server=y,suspend=n -jar myapp-0.0.1-SNAPSHOT.jar
This sets up Java to listen for remote debugging sessions on port
9999. Make sure you choose a port that's not blocked by firewalls or
your AWS security configuration.
Next, you have to configure Eclipse to connect to the remote
application for debugging. In Eclipse, right click on the project and
select Debug, Debug Configuration. Create a new configuration of
Remote Java Application. Set the host to your AWS server and the port
to 9999, as above.
Now you should be able to set a breakpoint in your code and start a
debug session on the remote server.

Start Websphere Liberty in Debug mode and connect via Eclipse

I am searching for a way to start the Websphere Liberty profile in debug mode from the command line? I want to be able to start Liberty, so that it is listening for debug connections on a specific port. Then I would like to connect to Liberty from Eclipse, so that I can step through and debug the server code running in Liberty.
I've tried integrating Liberty into Eclipse and using the Eclipse 'Servers' view. This works great and I can start and stop Liberty using debug mode. Unfortunately, this method does not satisfy my use case because the build process uses tools external to Eclipse.
Essentially, I need a way to do this via the command line.
I tried creating a jvm.options file for Liberty and starting it, but I still can't connect to the port I specified. I'm sure I'm doing something wrong, but thus far I haven't figured it out.
This page has some info on jvm.options
The Administering the Liberty profile from the command prompt page describes how to do this:
[bin]$ export WLP_DEBUG_ADDRESS=7778
[bin]$ ./server debug
Listening for transport dt_socket at address: 7778
You can then connect from Eclipse using Remote Debugging.

Remote Tomcat Server Configuration hangs the server startup when parameter suspend=y used

It would be great if someone can help me on this:
I configured a tomcat server for doing remote debugging using eclipse:
I used the gui for tomcat7
If I run tomcat with the command
-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n it works fine but
If I put suspend=y in the above command tomcat sert hangs in starting state and does not stop at all even after 2-3 hours.
When using suspend=y, the JVM remains suspended until a debug client connects.
To connect to the suspended Tomcat instance, you can create a new Eclipse Debug Configuration via Run->Debug Configurations. Then choose Remote Java Application. On the configuration panel, specify the host and port e.g. 8000 to connect. Finally, press Debug. This will attempt to connect to your suspended Tomcat instance. Once, the connection is made you can step through the code. (Of course, you must load that code into the Eclipse workspace)

Debug Struts Action Classes

My application runs on a remote server.
I use tomcat to deploy the web based part of my application.
The flow is Action classes calls the remote classes using RMI.
I am using Eclipse and When I browse a page, am able to debug the remote java classess, But I need to debug Action classes also as it also contains more logic.
How will I do it, Please help, Thanks in advance.
Regards,
Sridevi
Either launch Tomcat in debug mode from Eclipse, or launch tomcat with remote debug options, and attach a remote debug session from Eclipse to this tomcat server (in a similar way as you're probably doing for the remote RMI server).
See http://wiki.apache.org/tomcat/HowTo#How_do_I_debug_a_Tomcat_application.3F for how to start tomcat in remote debug mode:
set JPDA_ADDRESS=1044
set JPDA_TRANSPORT=dt_socket
catalina jpda start

Tomcat in Eclipse remains starting/synchronized but is actually running

I'm having the following problem with Eclipse 3.7 and Tomcat 7.0.8: I've added my Tomcat with a deployment descriptor in my Eclipse. I've enabled "Use Tomcat installation" in the server settings and tried to start it. The Console in Eclipse says "Server started up in 70s", I can access my application, but the servers state remains "Starting/Synchronized". As a result sooner or later the configured timeout is triggered and I'm getting an error.
Why is Eclipse not recognizing that the server was started successfully?
I've also tried to reinstall Eclipse and Tomcat - no positive changes.
Also adding a clean, fresh downloaded Tomcat results in the same "error".
Any suggestions?
Richard
Try changing the HTTP port from the server configuration screen. For example if you previously had 8080, try changing it to 8090. This should automatically update the new port number to server.xml.
I started running into the same problem after I had been modifying the server port directly in server.xml. Changing the ports back to what they had been did not seem to solve the problem. It looked like the server pluging and actual configuration got somehow out of sync.