I have two eclipse instances running.
And in one I have the code base.
And in other eclipse i am running the application.
So can I debug this application in the eclipse where I have code base?
I imagine your build produces a JAR file? if so, then you can run the JAR from the console and then plug the eclipse debugger.
Check this tutorial, that is clear and with screenshots
You should be able to launch a remote debug session
1/ Specify the following option when launching the app from the first eclipse
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000
2/ Launch a Remote Java App (Run > Debug> Debug Configurations... > Remote Java Application.)
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
(if port 8000 is free) in order to debug the app from the "code base" eclipse.
See Remote Debugging with Eclipse.
You can specify the sources in the Remote Java App configuration by referencing your own code base.
Yes, you can attach the debugger to a remote JVM. See How to attach debugger to running process?
Related
I am new to play framework.I want to debug my application in eclipse.I tried with some solutions using google search.But it does not helps me.Please tell me how to debug a play application in eclipse and at production level also.For all help thanks in advance.
I am using SBT to compile and run my Scala Play application, if you are as well, this might help you.
What I do is on command line set SBT_OPTS like so:
set SBT_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9999
Then when you sbt run it will wait for a debugger to attach on socket port 9999.
I use the Scala IDE to develop and debug my application.
In after you've run sbt run you attach the Scala IDE by creating a new Remote Java Application debug configuration specifying Scala debugger (Socket Attach) and setting the port to 9999 (host should be localhost by default). Then click on debug and you should be up and debugging.
I really need to debug my code by the use of breakpoints, however this seems a complex undertaking with an OSGi container.
I have Eclipse and Felix (both the latest). My project is a raw OSGi project, I am not using PDE, just maven bundle plugin to generate the bundles and then copy them to the /bundle folder in felix, then I perform java -jar bin/felix.jar and the project runs. So no fuss here.
However I cannot debug the application that way. I've tried to read the docs (http://felix.apache.org/documentation/development/integrating-felix-with-eclipse.html) but they are outdated/broken and cant make them work...
How can I debug this? Will I have to avoid using OSGi just because debug is not supported...?
Thanks!
Have you considered using an IDE tool like bndtools to do the debugging? You can create a repository from your folder of bundles and run them using a bndrun file. This gives you a debug environment in Eclipse which sounds to be what you want. The bndtools website is here.
Bndtools also does a lot more, but it sounds as if you're happy with your existing Maven build. The tutorial runs through setting up a basic workspace, but the main thing you'll be interested in is Running a framework
Start felix with the following parameters to enable remote debugging.
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044 -jar bin/felix.jar
After you can connect via Eclipse Remote Debugging to your Felix Container.
Run
Debug Configurations
Remote Java Application
Choose as project the project/sources you want to debug
Configure port to 1044
Trigger debugger by clicking on debug
I have a Advanced Java Application(Spring+Hibernate) with Maven. Project runs without any error.
I follow below process to test the application.
Build War using below command.
C:\Dev\ProjectApp> mvn clean package -Dmaven.test.skip=true
This builds war file inside target folder(C:\Dev\ProjectApp\target).
Place Application.war inside webapps folder(C:\Apps\Apache\Jakarta\Tomcat6\webapps)
run startup.bat from Tomcat6\bin folder.
hit the application in web Browser (http://localhost:8080/).
I want to debug this application from eclipse IDE itself. While application runs in webbrowser. I want to debug using breakpoints.
What are the steps to run this application in eclipse? What are constraints involved in this?
Thanks in Advance !
To simply debug the flow of the application, you can use the eclipse as the basis.
Goto the server view and create a new tomcat server (or any server that you use for dev). Next right-click on your project --> run as --> run on server and select the server that you just created. Keep in mind that the server should have all the configurations that you need to have to run the application. If your project requires some custom settings in the application server, then tell eclipse to take control of the server installation by selecting "Use Tomcat installation". (double click on the server to configure it)
Next add debuggers and start the server from within eclipse.
Happy debugging !
Set the environment variables first
set JPDA_ADDRESS=8000
set JPDA_TRANSPORT=dt_socket
You can edit the startup.bat to have
call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
and start in the same way as above.
After this you can have your eclipse open a remote debugging session that connects to localhost:8000.
However, I would strongly recommend to use the WTP plugin in eclipse to build and start/stop the tomcat from within eclipse itself.
I have created a web app using maven in eclipse. I am using jetty for running the app.
I am able to run the app using the maven jetty plugin. But I am facing difficulty while debugging the app -
The steps that i have followed to setup debug settings are from the below link
http://www.clickonchris.com/2010/05/configuring-jetty-maven-and-eclipse-together-with-hot-deploy/
I can run the app at port 8080 and it keeps on Listening for transport dt_socket at address: 4000. For debugging i have given port 4000. But when i start the debugger in eclipse it gives me a window with following error -
"Failed to connect to remote VM. Connection refused.
Connection refused: connect"
Can some one help me out in resolving this issue for debugging the app.
Thanks!!!
Set MAVEN_OPTS using -
export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"
Then start jetty using -
mvn jetty:run
Start remote debugging from your fav IDE on port 8000
Here's a quick workaround. I was battling with this problem also and after a while I achieved a lazy solution.
I use Eclipse Indigo with m2eclipse. I created a new Run Configuration: Right-Clicked the project in Project Explorer -> Run As... -> maven build. Then I defined the necessary maven commands/goals to run the project with jetty straight from Eclipse.
Finally I just ran the newly created configuration in Debug mode and got debug working. This probably messes up something else(?) but works as a quick workaround.
As suggested by h3xstream in one of the comments, you can run using mvnDebug jetty:run.
As mentioned by Pascal Thivent in this answer, since Maven 2.0.8 one can use mvnDebug in the following way:
mvnDebug jetty:run
This will start maven in debugger mode on port 8000.
I am developing a GWT application on my Mac and now I'm supposed to test it in IE on my PC.
However, I don't want to copy the codes to PC in order to rebuild the project and finally to test it.
Nor do I want to setup the whole Apache + Tomcat server on my Mac to deploy the project so that my PC can access that web application.
Is there any way I can run my GWT application in debug mode on my Mac, and just test it out in IE on my PC? I'm using Spring + Maven + Eclipse + GWT.
In your run configuration of eclipse use -bindAddress 0.0.0.0 and this allow jetty to receive traffic from outside localhost.
In the Eclipse menu
Run > Debug Configurations...
Confirm your project is selected left under Web Applications > Project Name
Select the Arguments Tab on the right panel
Under "Program Arguments:" append the argument "-bindAddress 0.0.0.0"
From there you can debug from a remote machine in Development Mode
set -bindAddress 0.0.0.0 in (x)=Arguments tab in "Run Configuration" as stated above. when you run your application GWT will use your computer IP in launch URL. after opening the URL in your browser, click on GWT toolbox on the right of Chrome address bar which will open "GWT Developer Plugin Options". now just add your IP to the list of webserver exceptions.
See Debug GWT application in a remote browser.
for maven, you can run as
mvn gwt:run -Dgwt.bindAddress=0.0.0.0