xdebug/netbeans won't stop at any breakpoint other than in Joomla index.php - netbeans

I'm a newbie with IDEs, I used Eclipse so far but more like an fancy text editor. I now switched to Netbeans and set it up for Joomla extension development, for which I followed the steps in various tutorials.
Everything works great except debugging. I set up xdebug and it works if I have breakpoints in the Joomla index.php file, but breakpoints in the php files of my component (for example in on e of the model functions) were just ignored.
My setup:
Joomla 2.5
Netbeans 7.4
XAMPP 3.1
xdebug

In both eclipse and netbeans, a prerequisite for debugging is that the project is built.
"Building" doesn't do anything real: php code is not compiled. But it allows the IDE to build a dependency tree, validate the code, allow code completion and follow execution flow from one class to the next.
To build, in eclipse either right click on the project or choose Project/Build from the menu. I have set Build automatically so the resources stay in sync while I work:

I encountered with the same problem, but solution is rather tricky. Actually netbeans stops on breakpoints but no all lines are eligible for breaking. When you put breakpoint wait a little, if beside green square there appears black arrow pointing down then it is OK, otherwise try some other line.

Related

Debugger source line synchronization not working in IntelliJ IDEA Scala plugin

I'm running IntelliJ IDEA 12.1.3 on Windows 8 with the Scala plugin 0.7.264. Scala is installed in C:\Apps\Scala\scala-2.10.1, and that directory is in my PATH. The Scala docs are in C:\Apps\Scala\scala-2.10.1\doc\scala-devel-docs\api. These are manual installs from the .zip files.
Everything seems to work fine except for two things:
First, if the "Run compile server (in external build mode)" settings is enabled (as it is by default), I get this error:
Turning off that setting fixes that for now, but there is another problem. I can run my code in the debugger and see values change in the debugger panel as I single step through the code, but it doesn't synchronize the source file view as I step through.
Normally I'd expect to see the current line being executed turn green, and the green highlight would follow along as I hit F10 or F11 to step through, but it doesn't. I can set breakpoints on source lines and let it run, and it stops at each breakpoint as expected. It just doesn't highlight the source line in green when it gets there.
Similarly, if a source file is not open (either my source code or a library file), and I step into that code, it appears to single-step correctly but does not open the source file at all.
Everything else works fine, like the autocompletes and Shift+F1 to view the Scala docs for the name the cursor is on.
The really odd thing is I had full debugging working briefly. At first I'd installed Scala from the .msi file, so it installed Scala into C:\Program Files (x86)\scala. When I set up IntelliJ to use that Scala installation I did get the green highlight on source lines as I stepped through the code.
The only problem with that setup was that IntelliJ complained about the missing doc\scala-devel-docs\api directory when I'd setup a Scala project, because the .msi installation uses a different subdirectory for the API docs. It was easy enough to fix that up manually in the Global Liraries settings, but I figured I'd try the .zip installation so I could use a directory layout more like what IntelliJ was expecting.
I should have left well enough alone! I even tried going back to that arrangement and still didn't get source line synchronization working again.
At one point I also tried letting IntelliJ do the Scala installation, but that also gave the same results: everything working except source line synchronization in the debugger.
There must be some obvious thing I got wrong, but I'm not sure what it could be. Does anyone have any ideas?
Here's a screenshot from a debug session:
The program is stopped on line 3, as indicated by the values assigned to x and y but not yet to z, and the <init>():3, Main$$anon$1 in the Frames panel. So line 3 should be highlighted in green but isn't.
Here are the relevant settings dialogs:
The above is with "Run compile server" on; as mentioned I ended up turning that setting off. The field values are the defaults, including the -server -Xss1m -XX:MaxPermSize=256m JVM parameters.
I am using the same version of IDEA and the Scala plugin (however on OS X and JDK 6), and I do not have this problem. Does this occur with any of your projects or only a specific one?
Assuming that the OS shouldn't be responsible, the difference is that I use sbt to build my projects. So if you are willing to set up a build.sbt and installing the SBT plugin for IDEA, this might be worth a try.
Although the fancy new compile server should in theory be as fast and smooth as sbt, I find it very pleasant to work with the sbt plugin. You can install it from Settings -> IDE Settings -> Plugins. Next step I also highly recommend is to use the sbt-idea plugin, which is like the complementary to the IDEA SBT plugin—this will allow you to generate the full IDEA project files from sbt (you can have as little as a single scalaVersion entry in build.sbt if you don't need to manage dependencies, so you don't need to learn much of sbt in the first place).
The final step then is to go into your Run/Debug configuration, and change in the "Before launch" section from "Make" to "SBT".
Finally you might get better support for your problem through the JetBrains online forum.

Play Framework + Eclipse: undefined method for ReverseApplication

I'm having a little trouble (more like an annoyance, really) when using the Play Framework with Eclipse.
I'm following this tutorial to get started with Play. In a certain moment in the tutorial, it asks us to type in this code:
public static Result index() {
return redirect(routes.Application.tasks());
}
This works as expected when running the application. The problem is that Eclipse doesn't like it. It says:
The method tasks() is undefined for the type ReverseApplication
While underlining tasks with the dashed red line. Is there a reason for this to happen? I've tried cleaning and compiling the project (through the Play terminal) and refreshing the project in Eclipse, but to no avail.
Is there something I can do about it?
I'm using Eclipse Juno, build 20120606-2254
Thank you so much!
Since the views are Scala code, they are compiled by the Scala compiler (ie your Play console through sbt). So Eclipse cannot compile and find these.
So, your best option is to configure Eclipse so that it automatically refresh the workspace and make sure that the folder "target/scala-2.9.1/classes_managed" is in your build path (it should be done by the "eclipsify" command).
If it does not work after all these steps, try "clean", "compile" and "eclipsify" (for Play 2.0.x) or "eclipse" (for Play 2.1.x) and refresh your projet.
Close and open your project in Eclipse. This worked for me (Eclipse Juno).
None of the previous suggestions worked for me, but when I did a refresh on the target folder, the red underlining on my view references went away.
The Play command used to be called "eclipsify". It is now called "eclipse".
Generally, I do the following and it works pretty well with Eclipse
-at the start of the day, start the play console in your project dir and do 'clean' and 'run'
-open a web browser point to the app (localhost:9000)
-launch eclipse
-make code changes...
-Play will rebuild the app whenever code changes occur. So refreshing the app in
the browser.
-back in eclipse, Refresh the project to reload the files that play rebuild just made.
I know it has been a year since #nico_ekito's answer but just wanted to add this.
Adding /target/scala-2.10/classes_managed and ensuring that Eclipse automatically refreshes the workspace fixed it for me. Thanks #nico_ekito
Using Eclipse Kepler, play framework 2.2.2

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.

Compiling in Eclipse/STS produces no output

I'm a Visual Studio .NET developer who's trying to switch to Eclipse/SpringSource Tool Suite, so I get stuck on probably simple problems. Please bear with me.
I'm working on a Spring MVC project associated with an Apache Tomcat server. If I right-click the server and choose Start (alternatively Package Explorer->right-click project->Run As->Run on Server), my project is compiled and started. Compiler output is shown in Console window. Fine.
But if I simply want to compile the project without running it, I try selecting Project->Build All, Project->Build Project, or Project->Build Working Set. Nothing happens, no screen output, nothing -- despite having non-compiling code.
I expected to see the compiler errors on screen, preferably with the errors highlighted in the code. For what it's worth, I have deselected Project->Build Automatically. Anybody knows what I should do?
Eclipse and STS use incremental compilation. So, every time a file is saved, it is automatically compiled (as well as all files dependent on it). When you deselect Build Automatically, then yes, you will need to explicitly build, but this will still be an incremental build (ie- only the changed files and dependencies).
See here for a bit of a discussion on how incremental building works in Eclipse: http://www.eclipse.org/articles/Article-Builders/builders.html

Debug Maven project in Eclipse with third party sources

I am currently developing a maven project in eclipse. The m2eclipse plugin works beautifully. It even works out of the box with debugging.
But when I am debugging open source third party libarries. It seems maven could automatically pull the source code down, but the eclipse debugger cannot resolve the currently execution point to the correct source file location.
I am sure the source code is downloaded because I can look at it and set break point. And the break point works.
But eclipse shows the source code and the currently execution point in too different windows. An example would be "TransformerImpl.class" tab window shows the source code, but the current execution point in shown in another tab window with header "Transformer.transform(Source,boolean)Line:642". This windows shows no source code.
I am felling there is some simple configuration that I am missing that could make this work. Then it will be really beautiful.
I think it is a bug introduced in one of the last m2eclipse versions. So, the workaround is to click on "Edit Source Attachment" button in the editor opened for a missing class and manually attach the source jar from the Maven local repository where it is downloaded by m2eclipse.
You should actually report this issue to m2eclipse, so developers can fix it in the future versions.