Tuesday, 29 September 2009

JBoss PermGen errors

After trimming back the grails project to its bare bones and STILL getting the permgen error and doing a few tweaks to the JBoss 4.0.4 version JVM 1.6.0_06b,. I tried the suggestion here:

http://delta-1.blogspot.com/2008/02/javalangoutofmemoryerror-permgen-space.html

This seems to have fixed it although it's only been 5 hours or so! I'll give it a couple of days but the error was happening easily with 15mins of a server restart so it's looking a bit good.

This did not happen for the same deployment to test version of JBoss 4.2.3 but one needs to mimic the live environment exactly so one cannot be sure if the same fix needs to be applied in a live environment for JBoss 4.2.3.

Hope this helps someone, anyway.

Monday, 28 September 2009

Grails - The Essential Tool

Over the past year or so I've been following the Grails programme with just a little dabble to see what it's all about.
Just recently I had the need to produce a small data maintenance app to hook up with OpenCMS. Having been more of a back-end programmer recently I decided it was time to put Grails to use or, rather, avoid a java struts process!

Trust me, Grails is a REAL breath of fresh air ... create the domain class, generate the controller and try out the scaffolding.
Hibernate is applied immediately!

After creating a few domains and building a small webapp, it was time to evaluate the generated views.
Ok, this is fine for a smart user/techie but a real user needs both user-friendliness and validation. After a bit of research, GSP tags provide the usability and static constraints adds the validation. Nice and easy!

Testing is a doddle ... grails run-app brings up the jetty server and testing is immediate. Change the code and test immediately, no need to restart the server!

Next was to apply Spring Security ... a couple of hours later the app is running with decent login controls applied.

Within a couple of days, I had an app I could put into production!

A little research again and two plugins look to be immediately useful - the export plugin and the filter pane plugin.
The export plugin exports the data list to so many data formats - csv, excel, pdf, odi, etc, etc!
The filter pane plugin generates a filter pane to apply filter selection on the list data.
Separately they are beautiful and simple to apply but a little more work was required to get them to work together but that just might be me!

My main nightmare was running into PermGen errors on deployment of the webapp to JBoss 4.0.4. Now this app ran pretty excellently before the introduction of the plugins, mind you! Suddenly, soon after interaction with the grails webapp, the dreaded PermGen error appeared in JBoss.
And I have to kill JBoss to restart it ... the clean stop doesn't work after PermGen!

Anyway, I have to deal with those issues, after all, it is Grails 1.2-M2 I am dealing with. I also wanted to put it on Jboss 5.1.0GA but there are issues with Spring 3.0.4M
When it comes to stuff like this I do try to be on the leading edge which, as we can see, is a bit dangerous.

Now I have been a big fan of the Hibernate framework and then I heard about the Spring Framework which included the option to use Hibernate!
Now the apple in the pie is that Grails includes all this good stuff. In actual fact, when you check it out Grails includes a lot of good stuff.
Absolute-ly fan-tastic!!!

I have been living and breathing Grails these past couple of weeks and it's great.
I promised myself that this is the year to step up on production and this is most certainly one of the tools to have in my armoury!

Let me say this, if you are a java developer looking to do front-end development and you need a RAD tool e.g. your struts production isn't exactly lightning fast, then you REALLY SHOULD TAKE A LOOK AT GRAILS!!!

Some research was provided from Mannings' Grails In Action book, a subscription to GroovyMag.org and of course the well documented grails.org site.