Netbeans php project debug breakpoints not working - netbeans

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)

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.

Breakpoints not working in eclipse [duplicate]

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

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

Zend Debugger Eclipse Startup Error: eclipse.php.debug.core was unable to load class debug.core.model.PHPConditionalBreakpoint

I work on Mac OSX Lion and ever since I've installed the Zend Debugger and gotten it to be able to debug php web applications, I often encounter this Eclipse startup error:
Error creation extension for extension-point
org.eclipse.php.internal.debug.daemon.communication Plug-in
org.eclipse.php.debug.core was unable to load class
org.eclipse.php.internal.debug.core.zend.communication.DebuggerCommunicationDaemon.
An error occurred while automatically activating bundle
org.eclipse.php.debug.core (258).
The error log contains the following stack trace:
org.eclipse.debug.core.DebugException: Plug-in org.eclipse.php.debug.core was unable to load class org.eclipse.php.internal.debug.core.model.PHPConditionalBreakpoint.
at org.eclipse.debug.internal.core.BreakpointManager.createBreakpoint(BreakpointManager.java:554
at org.eclipse.debug.internal.core.BreakpointManager.loadBreakpoints(BreakpointManager.java:264
at org.eclipse.debug.internal.core.BreakpointManager.initializeBreakpoints(BreakpointManager.java:449)
at org.eclipse.debug.internal.core.BreakpointManager.getBreakpoints0(BreakpointManager.java:418) at org.eclipse.debug.internal.core.BreakpointManager.start(BreakpointManager.java:408)
at org.eclipse.debug.core.DebugPlugin.start(DebugPlugin.java:682)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
... Omitted for brevity ...
This error often goes away when I just restart eclipse a few times. I've googled for solutions and tried reinstalling eclipse a couple of times. This error only seems to occur if I have both ADT (Android Development Tools) and PDT (PHP Development Tools) + Zend Debugger installed.
Please let me know if you have information about how to solve this problem. On a related note, I never really got the PDT + Zend debugger to work (as in debug) PHP apps on Windows.
I have seen this error a few times, even in the Zend Eclipse PHP version. It only seems to happen when two things are true:
1) The "breakpoints" view is visible on eclipse start (that is, you can see where breakpoints would be listed)
and
2) The file open and active in the editor is NOT a PHP file
For example, I got this repeatably with a CSS file open in the editor on the debug perspective with the breakpoints tab active.
To get around it: Start eclipse and ignore the bug about loading the plugin (for now). Make a PHP file the active document in the editor, and change from the debug perspective to the PHP perspective. Close eclipse and restart. On restart, the error should be gone and debugging should be active again.
I can't guarantee this is the solution everytime, but I can reliably replicate this failure (and solution) with the breakpoint/non-PHP conditions described above.
I had a similar issue (yours came up top of Google when I pasted my error message) after a few similar and different errors I decided to check my Eclipse workspace settings after an alternative workspace of mine worked and debugged fine.
It turns out my PHP executable pathway was empty (after having previously set it), so I added it back in. No problems so far.
(i.e. here...) Eclipse -> Window -> Preferences -> PHP -> PHP Executables -> Add/replace/reselect here.
UPDATE:
sometimes the simplest thing is to select 'Skip all breakpoints' under the 'Breakpoints' view (which opens in debug perspective). Then restart Eclipse. I have had similar error messages since first answering and that usually does the job (of course you can deselect 'Skip all breakpoints' after that from the same place.
This is a workaround instead of a solution, but so far, it's going good:
I downloaded and installed Eclipse for PHP Developers(aka Zend Eclipse PDT) version 3.0.2 from Zend website and I'm now able to debug Wordpress and Joomla, both pretty complicated projects as far as PHP goes.
I will update if I experience a problem.
I am using Eclipse Indigo on Ubuntu 12.04 and I received this error after installing Java 7. My PDT settings which used to work stop working. My solution was to uninstall PDT and reinstall it. I am not sure if this is relevant to your question but it might solve the issue.
Help -> About eclipse platform
click "Installation details" button
click php development tools (PDT) sdk feature
click uninstall
follow prompts
reinstall pdt in the normal way
My previous debug launches were deleted but my old project was left untouched. I re-ran a debug from Run -> Debug Configurations.
I've only ever gotten this after closing down an Eclipse php project that I've enabled various breakpoints in.
My workaround is once the project opens and I get the error message I select skip all breakpoints, close the project and re-open it. I then deselect the skip breakpoints and start working. The error, at least in my case happens randomly and for no other reason than I closed the project with breakpoints enabled.
Wish I had a more technical solution or fix but I decided my time was better spent working on actual work than chasing this deeper.
The problem happened when I closed Eclipse while a project was still running in debug mode.
I did more or less the same as #rahvin_t to fix it.
Run > Skip all breakpoint. Close Eclipse, start eclipse and I could start the project again.
there are a few errors that happen on start-up similar to this one. They seem to occur when there are 'unusual' files open in the editor (e.g. css or javascript)
What usually works for me:
Close all your files in Eclipse (Ctrl+Shift+W)
Restart Eclipse.

Eclipse "Waiting for virtual machine to exit"

I'm working on a blackberry project using eclipse and bb-ant tools. I've created a build.xml file to perform the build. Everytime I try to run an Ant build, eclipse pops up the progress dialog and it hangs stating "Waiting for virtual machine to exit."
I downloaded an open source Blackberry project that has an ant build and it is showing the same behavior.
Does anyone have any suggestions?
Edit:
I used the command line to build my xml file and it built fine. However, when I tried from Eclipse it still hangs.
I've tried both the standard eclipse plugin directory and the path I downloaded ant to.
You could check if your ANT_HOME settings are correct (see also this blog post).
"Window > Preference > Ant > Runtime": "Ant Home Entries".
if the jars files are from a plugin directory (beside the default 'org.apache.ant_1.7.1.v20090120-1145' one) and not an independent ant installation, that might explain the problem.
Try clicking the "Ant Home" button on the right side and setting up ant home such as "C:\path\to\apache-ant-1.7.0"
There are similar bugs to this kind of situation (bug 173419, ticket 91).
It is worth checking the JVM used for the project.
It can also occurs when a ant task is poorly implemented.
You had the problem because the java version ant tries to run with is incorrect.
By default, eclipse will try to run the ant build with the java version it uses to compile the java files (Blackberry JRE), which won't work! You need to change the jre version by choosing "Run As... > Ant build". Before clicking run, go to the JRE tab, choose "Separate JRE:" and change "Blackberry JRE " to a standard java JRE. Press the run button and everything should work correctly.
I hit this problem also. Although I never used the same solution, you pointed me in the same direction.
I was using a ant file as a builder in my project, and I disabled the Allocate Console build option. This is when I hit the 'Waiting for virtual machine to exit'.
So I simply enabled the Launch in background option and it worked.