I am using two separate Eclipse IDE; one for Flex code and one for Java services.
I can run my Flex application by right clicking the application and debug as > flex appication, it works fine;
but at the same instance i want to debug the java side.
Is it possible ?
You would use your Java Eclipse IDE and then configure it for remote debugging "as usual". If you are running your Java service with Tomcat then you could follow these instructions:
Make sure that Tomcat is started in remote debugging mode ... and that your app is deployed.
Make sure that you have the sources for the code that you are trying to debug in your IDE. For the libraries and for Tomcat itself you can "attach" the sources to the jar files: open a class file and then click "Attach Source..." button.
If you have a servlet or something, set a breakpoint where it is sure to hit on the next request.
Go to "Run->Debug Configurations...". Click on "Remote Java Applications", then click "New". Type in the title. Note that port 8000 from the Tomcat instructions. Save and run.
Eclipse will connect to the JVM that Tomcat is running under. Wow, that was easy!
Now run your Flex application and execute the part which is calling your specific Java service code. Boom you hit the breakpoint!
Related
I have seen many online tutorial explaining how to use eclipse to do remote debug of WAR file.
But what I want to know is how to do the debug inside eclipse just as debugging a JAVA application? I have Tomcat 7 configured in my eclipse as a server. And I have tested it with a sample servlet program successfully meaning I can set breakpoint in the source code and run into it.
My WAR application is built by gradle. I have imported the gradle project into my eclipse and build it ok inside eclipse by running gradle task inside "gradle tasks view". I added the project into the server. However, when I try to use "Debug as > Debug on Server", it fails and the breakpoint is not get hit. Anyone could share the experience to debug WAR inside eclipse?
I am a IntelliJ Idea user but I have a generic advice here. What you can do is that you can run your application (war/jar etc) with debug port on and then from eclipse use remote debug (or attached to a process sort of option).
Make sure you have exact copy of the code from which you have created war/jar otherwise lines might mismatch while debugging and will be hard to make sense.
On the "Servers" view, select the right tomcat server overview, then go on the "Modules" tab.
There, you can add the war by clicking on "Add External Web Module...".
Set the war path in the "Document base", and what ever you want on the "Path" field.
Example:
Document base: "C:\eclipse-workspace\MyProject\war\myWarToDebug.war"
Path: "/myapp"
Start the server in debug mode. Access your app using the url
<yourServerHost>:<serverPort>/<pathSetInModuleTab>.
Note that when reaching the breakpoint, Eclipse may say there is no sources found. Simply go on the server debug configuration and add the project sources in the "Source" tab.
Before debug you must decompile using jd gui for open class file inside war file and save as java project.
I am trying to use NetBeans 8.0.2 on win7 to debug a java web app on a remote Linux server. The source code is developed on win7 and committed to subversion. On the Linux server I checkout the code from svn and build with maven after first doing a clean. I deploy the .war file to a glassfish server and then attach the debugger and set a breakpoint in NB. I run the web app in Firefox and the debugger stops properly at the breakpoint. Then I "step into" F7 the code but it jumps to a location that is off by about 4 lines of where it is supposed to hit. After that it starts jumping off to even stranger locations and the code I want to study never gets hit. I have made sure the source code on both wind7 and Linux are the same. Any ideas why it seems to be out of sync?
The problem turned out to be that the same but older class was located in a jar file in the glassfish startup library. That's why it didn't show up when I searched for the class name. This web app uses a custom realm and hence needed the class earlier during glassfish initialization. Man I hate inheriting difficult stuff like this with no documentation!
I have a simple Tomcat Server set up in Eclipse on a Windows 7 machine. Eclipse by default uses metadata to deploy Tomcat server instances without having to take over the Tomcat installation folder (and allowing multiple parallel servers, provided they don't try to use the same ports). In order to start my server up, I have to open Eclipse, build my project, and start the server my project is assigned to in the Servers view.
I would like to start this same server up:
Without having to open Eclipse
With a single action, preferably double-clicking a file on my desktop.
With its own console window
I've looked into making Java programs into standalones, and the most common suggestion is to package it into a runnable .jar file. This uses a Launch configuration, which doesn't really work for my case because the server has no associated Launch configuration; to run it you start a Server rather than clicking run.
Is there a built-in way in Eclipse to make the server equivalent of a runnable .jar? That is, is there a built-in way in Eclipse to package a Tomcat server to run as a stand-alone?
All of the tutorials/links/articles I have found for debugging GWT involve:
Using the Google-Eclipse plugin; and
Running GWT in Development Mode from inside Eclipse (with Eclipse as the web container)
I would like to know how to debug a GWT app while it runs from a non-Eclipse web container; specifically a full-blown Tomcat instance that is either running on the same machine (localhost:8080) or on a remote machine somewhere else.
Ideally, I'd be able to access my app normally, via browser, but as I interact with the app (clicking buttons, etc.), Eclipse would be running in Debug mode, and would hit breakpoints that I set ahead of time (before the deploy).
To my surprise, there isn't much out there on this that I could find, and certainly nothing definitive. So I was wondering if any battle-weary GWT veterans could shed some light on how I could do this.
If at all possible, I'd prefer not to install the Google-Eclipse plugin, unless that is the only option for achieving this. Thanks in advance!
I am not sure if you missed this documentation. I used to do remote debugging in my dev mode where my server is running in the VM. I can suggest you two solutions.
If you are using a version prior to GWT 2.5 you have to give the noserver argument in launch configuration providing the url for the host page in the server (Tomcat etc). I have extracted the steps from above documentation.
Configure your server however you need to; note the URL which contains the host page for your GWT application.
Arrange all your static content files (such as the host HTML page, images, CSS, etc.) on the server however you like.
Edit your development mode execution script (such as your Eclipse run configuration or the ant development build target generated by the GWT webAppCreator) and add or update the following options:
• Add the -noserver command line argument.
• Change the URL at the end of the argument list to match the URL you recorded in step #1.
Compile your application once using the ant build target. Ideally, you can use GWT's -war option to generate output files directly into your external server's static content folder. Otherwise, you'll need to copy the the GWT output folder from war/ to your external server's static content.
If you are using 2.5 or above you can use super dev mode. In super dev mode you can debug using the browser so no need of eclipse plugin. I have tried this and worked fine. However I was unable to load the java sources using source maps. Here is the documentation for superdevmode configuration.
It's really easy, just follow these steps:
Get google plugin for eclipse
The in eclipse, right click on your project and choose Debug as -> Web Application (running on external server)
Enter URL of your web app on tomcat (like
http://localhost:8080/YourApp/YourApp.html
and eclipse will give you new one - it will add stuff like ?gwt.codesvr=127.0.0.1:9997
And that's it. Just set up your breakpoints and debug!
Also take a look on this
I know this sounds like a pathetic question and I'm sure it will get ridiculed but thats the only way I know how to describe the situation.
Scenerio : I'm creating a plugin for another java application. This application that uses the compile jar (my plugin) gets placed in the applications plugin directory. Is there anyway I can go about debugging this jar (which I have to source to) in execution of an application I do not have the source to?
I'm using Eclispe Juno as my IDE.
I would say yes, if you can start the application that you plugin plugs in into :).
java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=n myapp
to start then in eclipse setup a remote-debugging session setting it up to connect to your app running in the java debug mode to the localhost on the port 4000
This linky will probably solve all your eclipse problems
http://javarevisited.blogspot.com/2011/02/how-to-setup-remote-debugging-in.html