Announcement Announcement Module
Collapse
No announcement yet.
Could anyone tell me how to debug ROO please?? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Could anyone tell me how to debug ROO please??

    Hi all,

    I'm trying to debug ROO to know how MVC addons work and why my addon doesn't work, but it is very difficult without being able to debug.

    I saw several threads about this topic but any of them has been resolved yet.

  • #2
    Hi r.rodriguez,

    Debugging Roo addon is like debugging remote Java application.
    1. Get Roo source code from Roo Git repository
    2. Compile it with 'mvn clean install'
    3. Open the file '%ROO_HOME%\bootstrap\roo-dev.bat' in your favorite text editor
    4. Add the following line somewhere above the line 'rem Hop, hop, hop...'
      Code:
      set REMOTE_DEBUG=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,address=6055,suspend=n
      The number 6055 is the port debugger will connect to. You can use arbitrary free port here
    5. Insert %REMOTE_DEBUG% inside the command line that bootstraps Roo (the line below 'hop, hop, hop...'). It should look like
      Code:
      java -Djline.nobell=true %ROO_OPTS% -Droo.args="%*" -DdevelopmentMode=true -Dorg.osgi.framework.storage="%ROO_HOME%\bootstrap\target\osgi\cache" -Dfelix.auto.deploy.dir="%ROO_HOME%\bootstrap\target\osgi\bundle" -Dfelix.config.properties="file:%ROO_HOME%\bootstrap\target\osgi\conf\config.properties" %REMOTE_DEBUG% -cp "%ROO_CP%" org.springframework.roo.bootstrap.Main
    6. From Windows command prompt, start Roo shell (roo-dev.bat). Roo should boot normally, displaying an additonal message
      Listening for transport dt_socket at address: 6055
    7. Import Roo source code into STS by using File -> Import.. -> Maven -> Existing Maven Projects
    8. Open STS Debug Configurations window, and double click on Remote Java Application node to create a new debug configuration
    9. Set connection type to Standard (Socket Attach)
    10. Set host to 0.0.0.0
    11. Set port to the same port you specified earlier in REMOTE_DEBUG var
    12. Press Debug button. STS should attach successfully to the running Roo shell application
    13. Open your addon's source code in STS and set one or more breakpoints
    14. Go to Roo shell and invoke your addon command.

    That's it. Happy debugging

    Cheers,
    Ilian

    Comment


    • #3
      Thanks indeed!!

      Comment


      • #4
        roo shell hanging

        I've followed the above instructions, and if I start roo-dev.bat is an empty or otherwise not roo-enabled directory, it seems to work fine. However, if I cd to one of my projects I'm trying to work with, the roo shell hangs after entering a command.

        The pattern is:

        1. cd to project directory.
        2. roo-dev.bat. Roo shell starts and displays a roo> prompt.
        3. Activate debug in Eclipse. debug perspective shows sucessfull attach to a Remote Java Application, everything is running.
        4. Type 'help' and hit enter. Roo shell hangs, and must be killed from Windows task manager. The same thing happens if I type a partial command and hit TAB.

        Any ideas why this is hanging up?

        Comment


        • #5
          Hmm, strange...

          Could you give a bit more details about your environment (Roo/Eclipse/Java/Maven/Windows versions)? I tried the 'help command on my machine (Roo version 1.1.3.BUILD-SNAPSHOT [rev a9c2a27] and STS 2.6.0.M2) and it seemed to work fine.

          Is the hang reproducible immediately after you setup a project (with 'project --topLevelPackage xyz'), or only on more complex projects?

          Does the hang happen only when you try to debug Roo, or also during normal Roo shell usage?

          Comment


          • #6
            I'm using a freshly built Roo 1.1.2.RELEASE [rev fb33bb]. I've changed to a directory created with 1.1.1, and the hang happens immediately after pressing TAB or Enter. Even something as innocuous as help, or even typing TAB on a blank line, causes the hang.

            If I start with a new project, then it works, but after exiting Roo and restarting, the hang reappears. The hang shows up sometime after project creatio. I created another new project, exited Roo, and restarted. Things were fine in that case. The other projects have had persistence setup, dbre introspect and dbre reverse engineer performed. I haven't seen the hang in Eclipse, just when running roo-dev.bat.

            Comment


            • #7
              Just to eliminate some possibilities, could you:
              • Try with a newer 1.1.3.BUILD-SNAPSHOT build.
              • Attach with a debugger, set a breakpoint to 'help' command entry point and check whether the hang will happen after you reach this entry point or somewhere after it.
                The entry point for 'help' command is in project 'org.springframework.roo.shell.osgi', class 'SimpleParserComponent', method 'obtainHelp'.
              If you reach the breakpoint in obtainHelp() method, then you can try to debug to to find where the hang happens by stepping-in the code.

              Comment


              • #8
                Thanks for your answer Ilian.

                I tried to compile the code and it doesn't work, it hangs doing it. The last line which is shown is

                Code:
                [INFO] --- maven-gpg-plugin:1.1:sign (sign-artifacts) @org.springframework.roo.root ---
                Any ideas why is it happening?

                Comment


                • #9
                  Roo automatically signs its build outputs.

                  Have you configured your GPG key(s) as described in section section "GPG (PGP) SETUP" in readme.txt file?

                  Comment


                  • #10
                    Originally posted by Ilian Iliev View Post
                    Have you configured your GPG key(s) as described in section section "GPG (PGP) SETUP" in readme.txt file?
                    I installed it and I created a public key and a private one, isn't that enough?

                    Comment


                    • #11
                      Have you published your public key using the command "gpg --keyserver hkp://pgp.mit.edu --send-keys <your-key-id>". I'm not sure if this is absolutely necessary, but it won't hurt.

                      Is gpg executable on your path? Could you also try the other two ways to provide password of your key (as specified in readme.txt file, you can pass it as a parameter to Maven command line or in MAVEN_OPTS)?

                      Comment


                      • #12
                        Thanks Ilian.

                        Originally posted by Ilian Iliev View Post
                        Have you published your public key using the command "gpg --keyserver hkp://pgp.mit.edu --send-keys <your-key-id>"
                        I've published the key, but it doesn't work.

                        Originally posted by Ilian Iliev View Post
                        Could you also try the other two ways to provide password of your key (as specified in readme.txt file, you can pass it as a parameter to Maven command line or in MAVEN_OPTS)?
                        Which is the README.txt? I attach you the README.txt that I found in GPG folders, is that the right file?

                        Comment


                        • #13
                          No, I meant the file readme.txt that comes with Roo source code (when you checkout Roo from Git repo, this file is in the root folder).

                          Excerpt from it:
                          Finally, every time you build you will be prompted for the password of
                          your key. You have three options:

                          * Type the password in every time
                          * Include a -Dgpg.passphrase=thephrase argument when calling "mvn"
                          * Edit ~/.bashrc and add -Dgpg.passphrase=thephrase to MAVEN_OPTS

                          Comment


                          • #14
                            Thank you so much Ilian,

                            I added -Dgpg.passphrase=thephrase to MAVEN_OPTS and this step worked.

                            Then, it fails in the next step
                            [INFO] Spring Roo - OSGi Start Level Control ............. FAILURE [1.328s]
                            .
                            The error that shows:
                            [ERROR] Error building bundle org.springframework.roo:org.springframework.roo.st artlevel:bundle:1.1.3.BUILD-SNAPSHOT : Error in processing included file: D:/...../target/build-number.mf
                            Did it happen to you?

                            Comment


                            • #15
                              Seems you don't have Git executable on the path.

                              Check it by opening a new OS command console and executing 'git --version' (without quotes)

                              Comment

                              Working...
                              X