How to debug WAR inside eclipse, NOT remote debug? - java

My originally question has been marked as duplicate as this question and asked to ask a new one. So here I repeat, I am not looking for a remote debug solution. What I am asking is how to debug WAR inside eclipse just as a JAVA application. Following is my original question.
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?

Related

tomcat eclipse java spring not possible for debugging

Since two days it is not possible to debug my application, normally I use tomcat 8.0.27 for my project. When I use 8.0.39 it also does not work for the same project. I cleaned it, cleaned working space, delete it, installed it again and still it does not work.
When I try it with another project in another workspace, it works well ...
screen print error message tomcat eclipse

How do I find out why Eclipse is stuck in an endless build cycle?

I've got Eclipse building a Maven project that I just imported. I have Build Automatically checked and Eclipse is constantly building. It builds and waits a few seconds and builds again without me making any changes. I noticed that this only happens when the server is running so I'll include some info on the setup here:
Have a local install of Tomcat.
Eclipse is set up to start Tomcat but points the Tomcat executables to a directory of its own making (Server Location is set to "Use workspace metadata").
Eclipse is set to "Automatically publish when resources change".
As far as I know, Eclipse (or Eclipse's embedded Maven) is building everything into the target directory at the root of my project. Is it possible that Eclipse doesn't realize that the target directory is not supposed to be scanned for changes?
There are zero references checked under the project properties -> Project References.
I'm at a loss as to what this might be. If there are other settings that someone would like me to confirm, please let me know.
This seems to be the same problem but none of the answers seem to apply to me. I'm not sure what the original poster's comment that "added annotation processing to my project which interfere the build process" means.
Does your code generate something in src/main/java or src/main/resources ?
Only then, eclipse scanner can interpret this as 'source change' and then build and deploy continuously.
Any change in 'src' should trigger build
Any change in 'target' should trigger deploy.
If your code is generating data in target (logging for e.g) you would see tomcat deploy happening continuously

Creating and debugging app with springmvc and eclipse with internal server

I currently have a sprimgmvc app that uses maven. I am currently using mvn:package to build war and deploy it to tomcat to develop and this is getting very cumbersome. I dont have the eclipse configured to automatically build and deploy to tomcat for that matter?
Can anyone please provide me steps that I need to take so that if I make any changes in my project I can just hit save and run and it will deploy to the tomcat OR a way in which I dont use tomcat but use maybe jetty or something else to build and test my app?
Thank you
download STS > Import your project as maven project to the new workspace > mvn install (only once to download all your dependencies) > run AS > Server > baam!
For any other eclipse version pretty much the same but you need to open the server window and configure tomcat , basically open the server tab > new > select your tomcat installation path and then .. just run it on the server. You can even modify code while running your app.
I was able to make this work using some helpers from: Running Tomcat from within Eclipse always gives me 404 (but index.html works) and following these steps:
I suspected that there was something wrong with the initial set up in eclipse. So, I closed the project in eclipse using: Right Click project > Close Project
Then I deleted any files related with eclipse from the folder. These were: .settings, .project, .classpath
I then Re-imported the project as maven project.
I used Window > Show view > server view
In the server view I created a new server and pointed it to XAMPP > tomcat since I already had tomcat.
Right click on the project > Run As > Run on Server.
It should run properly at that point in the browser as well
Make sure to check Right Click Project > Properties > Deployment Assembly - There should be Maven Dependencies added to the project and the deploy path for that should be "WEB-INF/lib"
here is a my way to debug and run maven web project with eclipse. though code is not hot deployed but it works fine for me.
Steps are as follows
open command prompt and go to your project directory. Lets say it is /opt/myhome/myproj
run mvnDebug tomcat:run command, make sure you have mvn and mvnDebug at system path
A message will be appeared like one mentioned in screenshot attached below, this states that maven is waiting for remote connection.
Now we need to Remotely connect to maven from IDE. To do that
Right click on the project and select "DebugAs" ---> "Debug configuration"
Add an new entry under Remote Java application with highlighted details and then select Debug button.
switch back to your terminal and you will get a screen like one displayed below
your web app is ready to debug, put a break point and call it and your IDE will switch to debug perspective
We are done with it. now if you make some changes in your code. you need to stop it from terminal with Ctrl-C and re-execute mvnDebug tomcat:run and then Remote Debug from IDE.
As i mentioned in starting code is not hot deployable as in local debug mode but it is pretty much better approach than rebuilding war and deploy it to external tomcat instance.
I hope this targets your query

Play! Framework Eclipse Debug Source Not Found

I have been trying to debug and look through the internals of Play! Frameworks Controller class. If I place break points on the Controller.class, the debugger stops at the break point but throws a "Source Not Found"
I have added play.jar and the project is in path. Even added a Java Classpath called "Play_Home" which points to the Play framework.
Update
I been able to always debug my code (your solutions don't help me). When I plan a breakpoint on Play's internal classes like Controller, the debugger stops and says "Source not found"
(This answer is almost a straight copy of my own answer to another question that touches the same topic. I assume the problem in your case will be solved by running the eclipsify command, as another user has already mentioned.)
Create the configuration files for Eclipse by running play eclipsify YourProject command. (See Play framework documentation for more information.)
You should now have a folder named eclipse in your project. In it, you should see commands Connect JDPA to YourProject.launch, YourProject.launch and Test YourProject.launch.
Right-click on the YourProject.launch and choose Run As --> YourProject from the pop-up menu. That will start your application. When the application is running, right-click on the Connect JDPA to YourProject.launch, and choose Debug As --> Connect JDPA to YourProject.launch from the pop-up menu. That will start a debug session on your application.

hot-replace debugging with maven on jboss

I'm currently using jboss/maven/eclipse to debug a web app. I've enabled remote debugging in the jboss run.conf file and then use mvn war:inplace to compile and with that I can successfully add a breakpoint and step through code.
However I remember a while back using Tomcat I was able to hotswap or hot-replace a java class by making changes, saving it and then having the debugger re-enter the method. I'm thinking there has to be a way to do this but don't know how.
You can try JBoss Tools Eclipse plugin, or if all else fails, JRebel (however, its not free).

Categories

Resources