sabato 28 febbraio 2009

Using NetBeans Profiler with a Grails App

I had some problems finding out resources about how to use the NetBeans profiler with a Grails app.
NetBeans doesn't know how to attach the profiler to a Grails application, so you have to configure the Attach Mode: here is how to configure NetBeans 6.5.
- Deploy the war in the application server as usual (Tomcat for example)
- From the NetBeans menu choose: Profile > Attach Profiler...
- Click on the Attach Mode link
- Select J2EE Web app as Target Type and the application server type where the application is deployed
- Select Local as attach method and Direct as attach invocation
- Click next > next and choose auto integration
- Insert your application server install directory and your target jdk
- In the next page click the Perform button (NetBeans will change the startup script of the application server)
- Follow the instruction in the next page to start your application server (or let NetBeans start it for you)
- Click Finish and in the Profiler window click Attach

Now the profiler is attached to your application in your Application Server

Jug - Groovy Testing Techniques

Last week I made a second presentation about Groovy to the JUG Milano. It was not a continuation of the Grails tutorial I started last time ( which will be continued with a more 'hands on approach'), but was an introduction of the techniques that Groovy provides for testing Groovy and Java code. You can find the slide on Slideshare

mercoledì 18 febbraio 2009

Lesson learned: HtmlUnit and https

While developing my free-time project with HtmlUnit I found a strange behaviour when connecting to an 'https' site. The problem was a strange cpu usage, nearly 100% after the end of the method (actually, it lasted until the end of the thread where the scraping was made...).
The problem was due to an incorrect release of Javascript resources after the use by HtmlUnit and was resolved simply adding these 2 statements at the end of the method, disabling Javascript support and closing all connections:


webClient.setJavaScriptEnabled(false)
webClient.closeAllWindows()


Well, this makes sense, and maybe they should be added at the end of every method where HtmlUnit is used...

giovedì 12 febbraio 2009

Grails and Wired.com: another success story

Another success story about the adoption of Grails for big sites was announced by SpringSource: the 'Products Review' section of the Wired.com site was entirely developed using Grails. That's another win for Grails after his adoption for the site of the UK broadcaster Sky