Disable Ehcaches UpdateChecker in Grails application

I found it pretty annoying that Ehcache always reminded me that there is an update to a newer version of its framework available. After searching the web I found an interesting thread in the Terracotta forum saying that the UpdateChecker is not only looking for updates. In addition it also submits information about the applications environment to Terracotta by default. And that is not a good thing in my opinion.

Here you can see youself: http://svn.terracotta.org/svn/ehcache/trunk/core/src/main/java/net/sf/ehcache/util/UpdateChecker.java

Fortunately you can disable this behavior by adding an Ehcache configuration to your Grails application. I have tested this with a Grails 1.2.0 application which includes Ehcache 1.7.1.

Simply place an ehcache.xml file in your <app-root>/grails-app/conf folder containing your Ehcache configuration. For this post I am using the configuration that ships with Ehcache as default (ehcache-failsafe.xml) and modify it.

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="false">

    <diskStore path="java.io.tmpdir"/>

    <defaultCache
            maxElementsInMemory="10000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />

</ehcache>

With the attribute updateCheck=”false” in the root tag the haunting is gone.

XML Schema for Ehcache config can be found here: http://ehcache.org/ehcache.xsd

More Information about Ehcache configuration: http://ehcache.org/documentation/configuration.html

Posted in Grails | Tagged , | 6 Comments

Recursively remove Subversions .svn folders

To remove all the sometimes pretty annoying .svn folders here are some very helpful lines of code.

for /f "tokens=* delims=" %%i in ('dir /s /b /a:d *svn') do (
rd /s /q "%%i"
)

Just place the above lines into a file called removeSvn.cmd, place it into the polluted folder and then run it. Done.

Another resources on this topic:

Posted in Lessons Learned | Tagged | Leave a comment

Generating UML class diagrams from Grails domain model

Today I tried some Grails plugins that generate UML class diagrams from the existing domain model in an Grails application. I found the following two plugins in the offical Grails plugin repository to play with.

The application I used is a small book management app that manages a couple hundred books at my workplace.

Continue reading

Posted in Grails | Tagged | 2 Comments

Give the tomcat a bit more memory

If Tomcat needs more memory then you have to add the following line to the catalina config file.

Windows (catalina.bat)

set JAVA_OPTS=%JAVA_OPTS% -server -Xms512M -Xmx768M -XX:MaxPermSize=128m

Grails 1.2 default PermGen memory is set to 96MB. The Sun JVMs default is 64MB. (Java HotSpot VM Options)

Memory

Posted in Tomcat | Tagged , | Leave a comment

Manually install JDK 6 on Suse Linux Enterpise Edition 10 SP2

First remove older and maybe protected JDKs with yast.

yast -> Software -> Software management

Then invoke following command on console.

./jdk-6u14-linux-i586-rpm.bin

Afterwards create file /etc/profile.local and add following line.

export JAVA_HOME=/usr/java/jdk1.6.0_14

That’s it.

Posted in Linux, Suse | Tagged , , , | Leave a comment

Using storeXPath() in your Grails Webtest

Today I had to figure out how to save some content from a site during a running Webtest so that I am able to restore all changed data afterwards. Luckily Webtest provides the step storeXPath() which does the job.

But it was not that easy to realize my task due to the lack of good documentation and finding the correct xpath expression.

The following code snippet grabs the text value from a text input field with the id surname and saves it in the ant property xyz.

def testSomething() {
   webtest('Some description') {

      // saving initial value
      storeXPath(xpath: "id('surname')/@value", property: "xyz")

      // restore initial value
      setInputField(name: "surname", value: "#{xyz}")

   }
}

Pretty simple in the end, but it took a while till I got it. Maybe it helps someone.

Posted in Grails, Testing, Webtest | Tagged , , | Leave a comment