Debug Struts Action Classes - eclipse

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

Related

Debug the source code in Eclipse when connected from Tomcat

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.

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)

How to call a servlet on Glassfish server in Eclipse

I am trying to call a servlet form my android application in eclipse. I have to use the Glassfish application server(the servlet is in a different Mavan project). I had a few questions:
How to start a glassfish server in Eclipse?
What URL do I pass in the HttpPost() method?
Thank you.
There is the Servers view in which you can add you GF instance. However, this is not mandatory and you can run it from the command line (asadmin).
If your GF runs locally, the URL will start with
http :// localhost/webappName/servletPath
localhost or 127.0.0.1
I'd advise you to get a training as the more you'll progress, the more questions you'll have.