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.
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.
Hi r.rodriguez,
Debugging Roo addon is like debugging remote Java application.
- Get Roo source code from Roo Git repository
- Compile it with 'mvn clean install'
- Open the file '%ROO_HOME%\bootstrap\roo-dev.bat' in your favorite text editor
- Add the following line somewhere above the line 'rem Hop, hop, hop...'
The number 6055 is the port debugger will connect to. You can use arbitrary free port hereCode:set REMOTE_DEBUG=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,address=6055,suspend=n- 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- 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- Import Roo source code into STS by using File -> Import.. -> Maven -> Existing Maven Projects
- Open STS Debug Configurations window, and double click on Remote Java Application node to create a new debug configuration
- Set connection type to Standard (Socket Attach)
- Set host to 0.0.0.0
- Set port to the same port you specified earlier in REMOTE_DEBUG var
- Press Debug button. STS should attach successfully to the running Roo shell application
- Open your addon's source code in STS and set one or more breakpoints
- Go to Roo shell and invoke your addon command.
That's it. Happy debugging
Cheers,
Ilian
Thanks indeed!!
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?
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?
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.
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.