Breakpoints not working in eclipse [duplicate] - eclipse

I want to debug a webapp through Eclipse. The webapp will be running on a Tomcat 7 instance that I have configured within Eclipse, and thus everything, including Tomcat's launch will be done from within Eclipse.
Now, my question is what is the best way to debug the webapp in such a situation. Is local debugging possible, or the only solution is remote debugging.
I know how to do remote debugging, but given that everything is done from within Eclipse, I wanted to see if there is a better way of doing it.

Click on Run -> Debug Configurations.... On the left side you should have your tomcat server listed. (if not, you first have to define it in the preferences).
Configure your VM settings and whatever you need, then just click Debugin the lower right corner.
Your server should now start in debug mode, and stop on breakpoints.
From now on the server will be included in popdown menu of the Debug-Button in your toolbar.
Alternatively you can add the Servers View (Window -> Show View -> Servers), select your server and start it in debug by right-clicking

Related

How to enter debug mode in eclipse when launching tomcat from cmd

I am using apache-tomcat-8.5.24 and have the workspace in Eclipse configured and tomcat working properly.
I need though to do some debugging, but I dont know how can I enter debug mode in Eclipse with the tomcat running from cmd? I have done it several times in the past but I was always launching tomcat in debug mode from my IDE.
You would have to enable remote debugging on tomcat for which the following catalina property needs to be added in tomcat startup.sh or tomcat.start.sh or wherever you add tomcat startup properties:
CATALINA_OPTS="$CATALINA_OPTS
-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n"
Then restart tomcat.
After this is done, you need to open eclipse, and to go "Debug --> Debug Configurations -- type in the search box "remote java application", and create new, then select your module/java project which you want to debug and give the port number same as given in the above command (i.e. 8787 in the example above). Then Apply and launch.
While the other answer may solve someones problem, it didnt solve mine. Though the way i followed and solved my problem is:
First you start tomcat (all services up), and then you start the debug mode in eclipse!!!
For tomcat as i use the catalina.bat jpda run to start my tomcat i just edited it and used it as follows:
catalina.bat jpda run - agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n
For eclipse:
1)In Eclipse’s menu, select Run > Debug Configurations…
2)A new Debug Configurations window will appear
3)In the list on the left, select Remote Java Application. Don’t worry
too much about the word “remote” here. It just means that the JVM
process can either be on the local machine or another machine across
the network.
4)Select New in the context menu (you can either right click to see
the option for it, or select the icon above the list)
5)A new Remote Java Application debug configuration window will appear
6)Change the Name field to say “Tomcat (local)”, or the name of your
web application, your choice. The name you put here can be anything,
but shorter is better because the name will show up in menus.
Eclipse Run Configuration for a separate Tomcat JVM
There are at least three subtabs of configuration: Connect, Source,
and Common. Under the Connect subtab, there is a Project field. Select
the Eclipse project that represents the code you want to debug. For
instance, if you want to debug your webapp, select your webapp’s
Eclipse project here.
All of the other default settings should be fine. You should probably
look through the settings to see if you would like to change any
options, just beware of changing settings if you aren’t sure what the
effect will be. Make sure that the port number you’re setting in the
Connect subtab is the same port number you configured your Tomcat
JVM’s debug server to listen on.
Click Apply, then click Debug. At that point, your Eclipse’s debugger
will connect to your Tomcat JVM’s debug server. Next, switch to the
Eclipse Debug perspective. In Eclipse’s menu, select Window > Open
Perspective > Debug.

Netbeans php project debug breakpoints not working

On windows 10, Wamp PHP, Netbeans 8.1 and X-Debug (I believe), breakpoints don't work when selecting the debug project menu option but they do when debugging a file within the project (CakePHP).
Setting a breakpoint then selecting menu option "debug->debug project" starts a debug session, runs the project but no breakpoints work. Restarting the debugger with menu option "debug->debug file" will not run the application properly because it's the wrong place to start, but refreshing the web page stops correctly at the breakpoint.
Edit: a different test project works ok.
Thanks for any help.
If you already checked all the usual suspects: XDebug installed and configured.
Make sure that Web Root folder is selected under the project.
(if remote server used) Make sure that code on the server is identical to the one in Netbeans. (In rare case that something was edited on the server and not in netbeans)

Debug GWT application on server side

I want to know how to debug the GWT application on server side. I am using eclipse and GWT default server. I run my application by right click and run as web application. I tried to use System.out.println and it didn't work.
If you use the embedded server of DevMode, then it works just like for client-side: Debug as… ⇒ Web Application then set your breakpoints (either client-side or server-side, they run in the same JVM).
When you change your server-side code, Eclipse will recompile it on-the-fly (unless you disabled it, in which case you'll have to explicitly build your project) into your WEB-INF/classes (this is what the GPE should configure), then hit the "reload" button on the DevMode view in Eclipse (the two yellow arrows). The next call from the client to server will use the new server code (without the need to reload the app in the browser).
If Eclipse proposes to hot-swap the code on change, you can say "no".
Follow the below steps to run in debug mode.
Right click on the project -> Debug As -> Web application
OR you can follow below steps also.
Click on Debug As.. as shown in toolbar of Eclipse -> Debug configuration -> Debug

Debugging Webapps in Eclipse

I want to debug a webapp through Eclipse. The webapp will be running on a Tomcat 7 instance that I have configured within Eclipse, and thus everything, including Tomcat's launch will be done from within Eclipse.
Now, my question is what is the best way to debug the webapp in such a situation. Is local debugging possible, or the only solution is remote debugging.
I know how to do remote debugging, but given that everything is done from within Eclipse, I wanted to see if there is a better way of doing it.
Click on Run -> Debug Configurations.... On the left side you should have your tomcat server listed. (if not, you first have to define it in the preferences).
Configure your VM settings and whatever you need, then just click Debugin the lower right corner.
Your server should now start in debug mode, and stop on breakpoints.
From now on the server will be included in popdown menu of the Debug-Button in your toolbar.
Alternatively you can add the Servers View (Window -> Show View -> Servers), select your server and start it in debug by right-clicking

Server configuration is missing in Eclipse

Im using Eclipse Galileo, and have configured it for Apache Tomcat . I have added Apache Tomcat 6.0 to Windows->Server->Runtime Environments, with the following settings:
Tomcat Installation Directory - C:\apache-tomcat-6.0.24\apache-tomcat-6.0.24
JRE - Workbench Default JRE (This points to C:\Program Files\Java\jre6)
Now, I create a Dynamic Web Project, and add a JSP file to it. But, when I run the project I get the following error:
The Tomcat server configuration at \Servers\Tomcat v6.0 Server at localhost-config is missing. Check the server for errors.
Any way to fix this?
Probably, you have some problems with your server's configuration.
Follow these steps to remove and create a new one, it might help you.
In Eclipse
1. Window -> Show view -> Servers (If you cannot see it, you might need to choose Others -> Server)
2. From Server view -> Delete the server which has problems.
3. Right click -> New -> Server : to create a new one
In my case, after new server was created, I get rid of this "localhost-config is missing"
I faced the same problem once. THe reason for this is that even though the server is available, the config files are missing. You can see the server at Windows -> Show view -> Servers. Their configuration files can be seen at Project Explorer -> Servers. For some reason this second mentioned config files were missing.
I simply deleted the existing server and created a new one with this the config files were also created and the problem was solved!
Similar solution is given at here by Emertana EM
java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
In Eclipse Neo
1. Window -> Show view -> Servers
2. Right click on server -> choose Properties
3. From General Tab -> Switch Location
As Yoni already mentioned, you probably deleted the project named "Servers" from your Project Explorer. If config files for the server still present on a file system, the quickest way to restore it will be Right Click in Project Explorer->Import->General->Existing Projects into Workspace, then select the root dir where Servers dir located, set checkbox near "Servers" and finally click Finish. If everything works as expected, you should see the 'Servers' project added to the Project Explorer view and your old config files will be there. Finally, save the tomcat configuration which you had open. You can startup your Tomcat server without errors now.
From project explorer ,just make sure that Servers is not closed
You need to define the server instance in the Servers view.
In the box at the right bottom, press the Servers tab and add the server there. You by the way don't necessarily need to add it through global IDE preferences. It will be automagically added when you define it in Servers view. The preference you've modified just defines default locations, not the whole server instance itself. If you for instance upgrade/move the server, you can change the physical location there.
Once defining the server in the Servers view, you need to add the newly created server instance to the project through its Server and Targeted runtime preference.
If you're not too attached to your current workspace you can create a new workspace, follow BalusC's steps for server creation, and recreate your project in the new workspace.
I got the same error after installing Eclipse Java EE IDE for Web Developers(Juno) but using the workspace of a much older Eclipse installation. When I created a new workspace I was able to get my Tomcat server running without this error.
Did you, by any chance, deleted stuff from your workspace, or moved it around?
When you create a server for the first time, either globally or through the project's "run on server" settings, Eclipse creates a project in the Servers view, as BalusC pointed out. Eclipse stores this server inside your workspace, in a project called Servers. The project needs to be open for tomcat to run.
(If you want, you can store the server settings elsewher. You can right click and open the server instance from the Servers view and configure various parameters and locations)
This happens when Eclipse shuts down incorrectly - delete the server and then re-create it again.
Remove the server from IDE and install again to it.
In my case, the server list was empty for Apache in "Run Configurations" when I opened
Run > Run Configurations
I fixed this by creating a server in the Servers Panel as in other answers:
Window -> Show view -> Servers
Right click -> New -> Server : to create a new one
this worked for me
In the Server's tab in Eclipse, Stop the Tomcat server
Right-click the server and select "Clean..."
Right-click the server again and select "Clean Tomcat Work Directory..."
In the Eclipse, select the top-level menu option, Project > Clean ...
Be sure your project is selected and click Ok
Restart Eclipse
4th Step is most important.
Go to Servers remove the existing server by clicking delete.
Click the blue link to launch the server.
Set a new runtime environment.
Close the Eclipse and launch it again.
Boom it works!