10 Replies Latest reply: Jul 10, 2008 4:49 AM by 807557 RSS

    Eclipse debugging

    807557
      Hello,

      I use a trial version of Java RTS 2.1 under Linux. I tried several examples
      and it works well under Eclipse IDE.
      However, when I try to launch an example in "Eclipse debugging mode",
      a NullPointerException is thrown without any other more detailled
      information.

      Any idea ?

      Thanks in advance,
      fred.
        • 1. Re: Eclipse debugging
          807557
          I don't know what this debugging mode attempts to do - is there any way to trap the command that is used? Does it try to use JVMTI or the old JVMPI ? Java RTS does not support JVMPI.

          I can do some basic debugging under Netbeans IDE.

          David Holmes
          • 2. Re: Eclipse debugging
            807557
            I don't know if this information is usefull, but the command which is launched
            seems to be :
            java -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:[port_number] [options_class_path_and_so_on...]

            Should I try to change some options there ?

            Thanks,
            fred.
            • 3. Re: Eclipse debugging
              807557
              Can you try executing the command directly to see if you get the failure ? Though it may be that the problem doesn't arise until after something connects to the agent.

              I would have hoped that Eclipse would report the full stacktrace for the exception.

              David Holmes
              • 4. Re: Eclipse debugging
                807557
                java.lang.NullPointerException
                     at org.eclipse.jdt.internal.launching.StandardVMDebugger.getJavaVersion(StandardVMDebugger.java:452)
                     at org.eclipse.jdt.internal.launching.StandardVMDebugger.run(StandardVMDebugger.java:183)
                     at org.eclipse.jdt.launching.JavaLaunchDelegate.launch(JavaLaunchDelegate.java:101)
                • 5. Re: Eclipse debugging
                  807557
                  Oups, sorry for the last post, it was a manipulation error !

                  Finally, from an another logging mechanism, Eclipse gives this stack trace :
                  java.lang.NullPointerException
                       at org.eclipse.jdt.internal.launching.StandardVMDebugger.getJavaVersion(StandardVMDebugger.java:452)
                       at org.eclipse.jdt.internal.launching.StandardVMDebugger.run(StandardVMDebugger.java:183)
                       at org.eclipse.jdt.launching.JavaLaunchDelegate.launch(JavaLaunchDelegate.java:101)
                  [ ... ]

                  The code of getJavaVersion is the following (the last line throw the exception) :
                  /**
                       * Returns the version of the current VM in use
                       * @return the VM version
                       */
                      private double getJavaVersion() {
                          String version = null;
                          if (fVMInstance instanceof IVMInstall2) {
                              version = ((IVMInstall2)fVMInstance).getJavaVersion();
                          } else {
                              LibraryInfo libInfo = LaunchingPlugin.getLibraryInfo(fVMInstance.getInstallLocation().getAbsolutePath());
                              if (libInfo == null) {
                                  return 0D;
                              }
                              version = libInfo.getVersion();
                          }
                          int index = version.indexOf(".");
                  I do not know if this code gives you an idea...
                  Not so easy to get debug information about this execution inside the eclipse platform,
                  but should not be impossible.

                  Thanks,
                  fred.
                  • 6. Re: Eclipse debugging
                    807557
                    Fred,

                    This looks like an Eclipse bug. It all depends how that "version" string is supposed to get created.

                    David Holmes

                    Edited by: davidholmes on Mar 23, 2008 3:12 PM

                    Edited by: davidholmes on Mar 23, 2008 3:17 PM
                    • 7. Re: Eclipse debugging
                      807557
                      ..., indeed,

                      The bug occurs only with the last Eclipse version (Ganymede), but it
                      works well with the preceeding stable version (Europa).

                      Sorry for the noise...

                      Thanks,
                      Fred
                      • 8. Re: Eclipse debugging
                        807557
                        After installing Ganymede, I'm getting the exact same error, under Linux (works great in Windows XP).
                        • 9. Re: Eclipse debugging
                          807557
                          I tested the icedTea6 virtual machine on my gentoo 64-bit installation.
                          After some switching around with installed virtual machines I always get the same error.

                          Eclipse stores information about used virtual machines used for running (lauchching, debugging) your java applications in one xml file.

                          Its located in the current workspace folder and then:
                          .metadata/.plugins/org.eclipse.jdt.launching/libraryInfos.xml

                          There are tags for each used vm, even if this vm is removed from the eclipse configuration.

                          <libraryInfo home="/opt/sun-jdk-1.6.0.06" version="1.6.0_06">
                          ....
                          </libraryInfo>

                          The value stored in the attribute "version" caused problems on my machine. (But Above is a correct value)
                          I start eclipse with a workaround for the built in compiler, which puts something to the console:
                          "CompilerOracle: exclude org/eclipse/core/internal/dtree/DataTreeNode.forwardDeltaWith".

                          However this information had been inserted prior to the version string for icedtea6 entries.
                          I don't remember exactly, but looked something like
                          version="CompilerOracle: exclude org/eclipse/core/internal/dtree/DataTreeNode.forwardDeltaWith1.6.0_06"
                          which is obviously no correct verison value.

                          After deleting the "libraryInfo" entries, I was able to debug again.
                          • 10. Re: Eclipse debugging
                            807557
                            I have faced the same problem with MyEclipse IDE but what i found is this problem is not with the IDE or System.
                            This problem depends on the code that what you have written.
                            If the code is complex and if you are not catch the exceptions properly then you will get the problem.
                            The IDE will automatically catch the exceptions and raise the errors to give you the warning before executing the code.

                            Please check your code again and find the bug in your code.