Announcement Announcement Module
No announcement yet.
Eclipse Groovy :Debug Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Eclipse Groovy :Debug

    I have installed STS 2.5.0.M3. Installed Groovy/Grails support. Everything went smoothly. Though I can start my app from STS, not able to debug. It does not stop at breakpoints. Went thro' several posts esp. 'Step Filtering' etc. Nothing worked. Help please...


  • #2
    How did you start your app? It sounds like you did not start your app in debug mode.

    The preferred way of starting your app in debug mode is selecting your project, right-click and choosing debug as -> Grails command (run-app).


    • #3
      I did start in Debud mode. Exactly the way you mentioned. However, it does not stop at break points.


      • #4
        I am going to need a little more information, then.

        What are the file and line number that you set the breakpoint(s) at? (It would be helpful to attach something.)

        Can you create a simple groovy script in your grails app, set a breakpoint, and debug that? Does it stop at the breakpoint?

        Can you create a java file in your grails app, ensure that it is called from your grails app somehow, and set a breakpoint in it. Does the debugger stop there?

        Also, would be very helpful to get a copy of your grails app (but I'm guessing this is unlikely).


        • #5
          First of all, thanks for your response.
          My app has tons of java code. Debugger stops at break points set in Java code but not in groovy. FYI, this is an existing project(grails ver.1.1) imported into STS. Wondering if it is version of grails because I created a sample project in STS yesterday and it does stop at groovy break points. While existing does not. Anything to do with version?


          • #6
            It's possible that the problem has something to do with using Grails 1.1. We have not tested on anything less than 1.2. The main problem might be that Grails 1.x is based on the Groovy 1.6 compiler, but Groovy-Eclipse ships with the 1.7 compiler.

            I would recommend doing the steps to switch to using the 1.6 compiler and seeing if that works for you. See the instructions here (note that this changes the compiler setting for the entire workspace):


            But, really, the best thing to do would be to upgrade to a more recent version of grails.


            • #7
              Switching to Groovy compiler 1.6 did not help. I moved back to default 1.7. Removing some jars helped me to start app in debug mode. Good news is that I am able to stop at break-points. Bad news is my Springsecurity Acegi ldap authentication fails. Wondering if plugins is causing the problem. Debugging thro' some of the plugin groovy classes did not help. I am attaching the stack trace. Appreciate your response.


              • #8
                There's nothing I can really see in this stack trace that let's me know what is going on. This is a runtime stack trace and doesn't have anything to do with STS, so it seems.

                What jars did you remove from your classpath? Grails tooling should be taking care of your classpath so that you shouldn't be touching it.


                • #9
                  Jars I removed were under myapp/lib. Some of the classes in these jars were conflicting with that under jdk. e.g Qname. Removed jars are jax-qname.jar,jdmkrt.jar,jaxrpc.jar. Anyway, I am clueless of ldap authentication failure. It all works fine with Grails 1.1 with acegi-0.5.1. Fails with Grails 1.3.4 with acegi-0.5.3.


                  • #10
                    So, it is debuggable under 1.1? Earlier you mentioned that it was not.

                    What are you trying to do? Are you trying to get your project debuggable under 1.3.4, or would you prefer to keep your project at the 1.1 level?


                    • #11
                      Good news is I am able to debug under 1.3.4. I upgraded my app to 1.3.4.

                      FYI, I am using ldap authentication using Acegi plugin 0.5.3. After clicking 'Login', it throws a Nullpointer exception. After debugging, I found out that authenticateService is null. Hence, exception is thrown from loadUserByUsername() method of GrailsDaoImpl groovy. Commenting out this line --- if ( lm) --- makes everything work fine though I have some UI related issues. Though this is a work around for now, it needs a proper fix. I could not figure out, what is causing this object authenticateService to null. Appreciate your response.

                      btw, note: STS prompts you to upgrade to latest version of plugins if you are using older versions. e.g datasources-0.3 instead of datasources-0.5. If you say 'N' for upgrade, it fails to start the app. This is annoying.


                      • #12
                        Originally posted by madhuris View Post
                        btw, note: STS prompts you to upgrade to latest version of plugins if you are using older versions. e.g datasources-0.3 instead of datasources-0.5. If you say 'N' for upgrade, it fails to start the app. This is annoying.
                        I believe that this is the behavior that you would see when you run from the command line. The older version of the plugin is likely not compatible with the newer version of Grails.

                        If you do not see this behavior when you run from outside STS, please post here and describe your situation in detail (because the behavior running a grails command inside of STS and outside should be identical).