Skip to content

1.x branch - error if hibernate is also configured to use ehcache. Invalid character ':' in value part of property #41

@tircnf

Description

@tircnf

A lot of ifs here.
If you are stuck using grails 2.5.6 and hibernate 3.
and if you configure your dataSource to use ehcache

cache.region.factory_class = 'grails.plugin.cache.ehcache.hibernate.BeanEhcacheRegionFactory' // hib3 + ehcache

and if you have installed cache-ehcache

compile ':cache-ehcache:1.0.5'
runtime (":hibernate:3.6.10.18") {
    exclude 'ehcache-core'
}

You get the following error trying to start an application.

javax.management.MalformedObjectNameException: Invalid character ':' in value part of property

It is caused by code added in 2014 that allows setting a cacheManagerName.

CacheEhcacheGrailsPlugin.groovy

// customizable name for the cache manager
String ehcacheCacheManagerName = ehcacheConfig?.cacheManagerName

the ?. notation doesn't work well with these config objects, and the name is always set to
[:]

which ends up being illegal somewhere else way down the stack.
javax.management.MalformedObjectNameException: Invalid character ':' in value part of property

I think the code was added based on this blog post:
https://technology.first8.nl/fix-cachemanager-with-same-name-grails-cache-ehcache/

The problem is now that cacheManagerName becomes a REQUIRED property to be set in the config object.

Hopefully no one else in the world is stuck on grails 2.5.6 with hibernate 3 (because of compass), but if they are, maybe a google search will end up here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions