Sunday, October 14, 2012
SpringOne2GX
Heading out to speak at SpringOne2GX in DC today. I'll be giving 2 talks, 'Streaming Video in Grails' (Using the formerly 'grails-video' plugin now called 'gvps'(Grails Video Pseudo Streaming Plugin). I'll go over the plugin, how ffmpeg, and basic streaming works, flowplayer and jw-flv integrations, and a little about quartz to help distribute video processing load.
The second talk is 'Clustering Grails 2 with Terracotta' which is a dive into what you need to do and how to figure a total clustering solution with Grails 2 that uses Ehcache, HTTP Session Clustering, and Quartz. I'll give examples of each, and demo a Grails 2 app that uses all of these at once at the end. Of value you will find a library compatibility matrix of what you need to add to your BuildConfig to make everything work.
There are so many great speakers and topics I'm going to have a hard time choosing what talks I will attend myself!
Friday, August 10, 2012
Learned a interesting lesson with Grails today.....
Learned a interesting lesson with Grails today.....
NEVER give plugins a name in all caps(Or more than 1 capital letter in a row). I had 2 plugins I made, called 'SPP' and 'RFCORE' which (due to JIRA wanting to name the svn repos this way) cause an interesting breakdown in Grails.
I publish these plugins to Artifactory via the release plugin in Grails, and bind them to the app in the plugins {} closure.
The other day I added my fork of Weceem (I fixed it to work on Oracle and send a pull request back to them) to the plugins{} block. Works fine via inline plugin mode with my (all caps) plugin names. Once I deploy a WAR file, suddenly Grails has no idea where my plugins are (war is made, however the plugins are missing from the war).
What threw me off was that if I uninstall the weceem plugin, my (all caps) plugins are now built into the war.
So I step through the code in the Grails PluginBuildSettings class in the method 'getSupportedPluginInfos' and find that the plugin registry has my plugins like this 'SPP-0.1-SNAPSHOT' but the maven resolution is looking for them as 'spp-0.1-SNAPSHOT' and automatically lower casing it for me. If those don't match (it is case sensitive, I personally think it should not be), Grails acts like the plugin basically doesn't exist and doesn't package it up.
Now I refactor my plugin class files from SSPGrailsPlugin to sppGrailsPlugin and it works. I'm not sure if this is a bug in Grails (2.x) or not, or it just doesn't support plugins with more than one capital letter in a row in it. If it's a bug I can patch it and submit a pull request.
Moral of the story, don't make Grails plugins with more than 1 capital letter in a row, or you will spend all day figuring out what is going wrong ;)
Monday, July 30, 2012
Wednesday, July 25, 2012
I Love GitHub!
We messed around with the new Grails plugin called 'Ajaxflows' at http://www.grails.org/plugin/ajaxflow and found a big bug stopping us from using it at all. I fork the GitHub repo, clone it, load it on my box and fix the bug. I sent a pull request to the plugin author (Jeroen Wesbeek) and within 2 hours a new version is released. That's the power of collaboration, between people who don't even know each other, and it's better than any commercial support money can buy :)
Friday, June 29, 2012
Friday, June 22, 2012
Ran into a rather nasty Grails 2.0.4 bug the other day...
After deploying my first real production Grails 2.x application, which uses 2 plugins I also wrote, I got the lovely error trying to start the war file in Tomcat 6:
SEVERE: Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Lgrails/test/mixin/services/ServiceUnitTestMixin;
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NoClassDefFoundError: Lgrails/test/mixin/services/ServiceUnitTestMixin;
at java.lang.Class.privateGetDeclaredFields(Class.java:2308)
at java.lang.Class.getDeclaredField(Class.java:1897)
... 1 more
Caused by: java.lang.ClassNotFoundException: grails.test.mixin.services.ServiceUnitTestMixin
... 3 more
There is some magic combination of plugins I think is causing this. It originates from one of my plugins, but I can't find anything wrong with it, other than Grails did not package the class (It shouldn't be looking for it AFAIK).
So here is my workaround solution, which is working for now (Add to BuildConfig.groovy):
grails.war.resources = { stagingDir, args ->
// Manually copy the grails-plugin-testing-2.0.4.jar into war due to bug in Grails 2.0.4
// For some reason grails is making the war depend on this jar from the grails distro
copy(file: "lib/grails-plugin-testing-2.0.4.jar",
tofile: "${stagingDir}/WEB-INF/lib/grails-plugin-testing-2.0.4.jar")
}
You can find this in your Grails 2.x distro, under the dist folder. I currently can't re-create it from a scratch project, it happens when I add more complex things to the mix like a maven dependency to another grails plugin coming from my artifactory server.
Wednesday, June 6, 2012
Auto nested property extraction...
I ran into the need for a Grails supported select box with 'optgroup'. I was suprised to find out Grails didn't support this, but I did find a JIRA ticket where a guy added the code but it appears it was forgotten and never included.
Here's the link with the code:
http://jira.grails.org/browse/GRAILS-3961
However I found the example:
<g:selectWithOptGroup name = "song.id" from = "${Song.list()}" optionKey = "id" optionValue = "songName" groupBy = "album" />
groupBy doesn't support a tested property I'd expect. For example, say album is a parent property domain class, and you really want it to group by the parent's property of 'album.name'. It will blow up when you do this. So I've modified this bit of code, learning from the Groovy class 'Eval'. I added this around line 40 of the MyAppTagLib.groovy file:
if (groupBy instanceof String && groupBy.indexOf(".")) {
groupKey = Eval.x(el,"x."+groupBy)
}
This will expand a dot notated nested property to give you the correct string value to sort on. Hopefully this will be merged in the Grails core soon, it seems like people expect this sort of thing these days.
Subscribe to:
Posts (Atom)