The post i wrote some time ago about configuration of session replication in tomcat can be done in a much easier way now. Instead of setting up clustering of session objects via bootjars and heavy voodoo all we have to do now is configure a session replicating valve in your tomcat using application scoped meta-inf/context file!
EhCache is an API for caching in Java and its also integrated into grails by default. The only thing is that its not the latest version so if you want to use the latest terracotta and latest ehcache you will have to integrate it and set it up yourself. Its not really a big deal but i post this tutorial just hoping that it could help someone.
Terracotta is an amazing piece of software and it comes with some really cool tools and features. To enable Tomcat 6 session replication via terracotta you need to do a few things but its relatively simple lets do it.
Grails, Tomac and Glassfish keep on crashing during deployment or reloading of your web application with out of memory permgen space errors? Seems like you are one of the millions other developers that have this problem : -)
Its all about loading too many classes. In Java classes are loaded in special memory area which can not grow above the max perm gen setting.
It may be frustrating especially if you are at the beginning of your journey with grails. Grails spring, hibernate and all the plugins depend on so many jars and classes that default memory settings are often not enough.
Grails plugins are handy but there is one feature i did not expect. When you create a plugin you can add taglibs there. Then in a tag you call render and provide plugin attribute so that render would know to search for the template in the plugin context. It looks very similarly for views in controllers. The difference is that if you place view file in the application it will override the view file of the plugin but if you place template file it will not override the plugin template.
Grails in action is an excellent book for all grails and groovy developers. It covers all main aspects of grails development and even more. In the same time it does all that within 450 pages. I liked reading the book as its written in a nice and easy English, good style and clear explanations. As other 'in action' books it does set high standard of both language and the content.
For some reason my Spring Tool Suite has a problem with grails clean target. Most of the time running clean script removes 'target/classes' folder after which i am getting errors like:
Error automatically restarting container: destination directory "/workspace/target/classes" does not exist or is not a directory
To get rid of the issue edit the file:
and add mkdir command at the end of cleanCompiledSources target
I have worked with Grails lately and i have to say it seems like it may be the technology i was looking for! I am a skeptic by nature but I am getting more and more excited about Grails. It is really a cool and deeply thought out framework for all web development needs.
Why is Grails better than Rails?
Some might say that jruby will let you do the same thing and keep it old school (ruby not groovy). To be honest, i don't like Ruby as a language that much. I have read some articles/books (just a few) and i have read some code as well. I must say it seems to me more like perl than Java. Maybe its just matter of personal taste but ruby seems little bit messy to me.
I have to admit that i did not really want to get into another language this year. Its so much effort and usually so little gain of it. But what can you do sometimes you have to ;-).
While evaluating web platform alternatives we began with JSF2/JSTL/JSP/Struts. None of them seemed suitable for our needs. None of them seemed usable either. We began to look around for much more lightweight frameworks and thats when we started looking at Grails and Spring MVC.
About the author
Hi, my name is Artur Ejsmont,
welcome to my blog. I am a passionate software engineer living in Sydney and working for Yahoo!
If you are into technology, you can order my book Web Scalability for Startup Engineers on Amazon. I would love to hear what are your thoughts so please feel free to drop me a line or leave a comment.