How in the world do you upgrade to cache-ehcache > 1.0.0

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

How in the world do you upgrade to cache-ehcache > 1.0.0

longwa
So every time a new version of hibernate4 or ehcache comes out, I try to upgrade and every time it fails with "

Another unnamed CacheManager already exists in the same VM". I exclude ehcache-core from the hibernate4 dependency but it never works for anything but ehcache-1.0.0

We've been hopelessly stuck on 1.0.0 for like 2 years now.

Can someone please post the magic recipe for using cache-1.1.8 and ehcache-1.0.5 and hibernate4-4.3.8.1?

-Aaron

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How in the world do you upgrade to cache-ehcache > 1.0.0

Lari Hotari-3
Hi, 

Do the instructions in https://github.com/grails/grails-core/releases/v2.4.5 help at all?
//    cache.region.factory_class = 'org.hibernate.cache.SingletonEhCacheRegionFactory' // Hibernate 3
    cache.region.factory_class = 'org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory' // Hibernate 4
I'm currently in the middle of releasing Grails 2.4.5 and Grails 2.5.0.

Lari



On 24 Mar 2015, at 22:42, Aaron <[hidden email]> wrote:

So every time a new version of hibernate4 or ehcache comes out, I try to upgrade and every time it fails with "

Another unnamed CacheManager already exists in the same VM". I exclude ehcache-core from the hibernate4 dependency but it never works for anything but ehcache-1.0.0

We've been hopelessly stuck on 1.0.0 for like 2 years now.

Can someone please post the magic recipe for using cache-1.1.8 and ehcache-1.0.5 and hibernate4-4.3.8.1?

-Aaron


--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/9D957D6D-FD19-4ABE-A298-2E422273E875%40hotari.net.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How in the world do you upgrade to cache-ehcache > 1.0.0

longwa
Lari
Let me try to the SingletonEhCacheRegionFactory and see if that fixes it.

For awhile, I know Craig Andrews was pushing for some naming fix in either datastore or the hibernate plugin (something about ehcache-core, can't recall) and I'm not sure where that ended up.

Looking forward to trying out 2.5.0 once it's ready.

Rgds,
Aaron

On Tuesday, March 24, 2015 at 10:46:37 PM UTC-4, Lari Hotari wrote:
Hi, 

Do the instructions in <a href="https://github.com/grails/grails-core/releases/v2.4.5" target="_blank" rel="nofollow" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fgrails%2Fgrails-core%2Freleases%2Fv2.4.5\46sa\75D\46sntz\0751\46usg\75AFQjCNE021_bw6P91umDWFCWZSiGjiJ4YA';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fgrails%2Fgrails-core%2Freleases%2Fv2.4.5\46sa\75D\46sntz\0751\46usg\75AFQjCNE021_bw6P91umDWFCWZSiGjiJ4YA';return true;">https://github.com/grails/grails-core/releases/v2.4.5 help at all?
//    cache.region.factory_class = 'org.hibernate.cache.SingletonEhCacheRegionFactory' // Hibernate 3
    cache.region.factory_class = 'org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory' // Hibernate 4
I'm currently in the middle of releasing Grails 2.4.5 and Grails 2.5.0.

Lari



On 24 Mar 2015, at 22:42, Aaron <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="lyAe74vctoYJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">lon...@...> wrote:

So every time a new version of hibernate4 or ehcache comes out, I try to upgrade and every time it fails with "

Another unnamed CacheManager already exists in the same VM". I exclude ehcache-core from the hibernate4 dependency but it never works for anything but ehcache-1.0.0

We've been hopelessly stuck on 1.0.0 for like 2 years now.

Can someone please post the magic recipe for using cache-1.1.8 and ehcache-1.0.5 and hibernate4-4.3.8.1?

-Aaron


--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="lyAe74vctoYJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">grails-dev-discuss+unsubscribe@....
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="lyAe74vctoYJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">grails-de...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;" onclick="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;">https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/e1a98736-0b87-4c82-bd75-968498b99dae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How in the world do you upgrade to cache-ehcache > 1.0.0

longwa
Switching to the Singleton factory seems to fix the problems (we do have multiple DS). I was able to upgrade to ehcache plugin 1.0.5 and the latest hibernate (without excluding anything).

Thanks a bunch.

On Tuesday, March 24, 2015 at 11:15:55 PM UTC-4, Aaron wrote:
Lari
Let me try to the SingletonEhCacheRegionFactory and see if that fixes it.

For awhile, I know Craig Andrews was pushing for some naming fix in either datastore or the hibernate plugin (something about ehcache-core, can't recall) and I'm not sure where that ended up.

Looking forward to trying out 2.5.0 once it's ready.

Rgds,
Aaron

On Tuesday, March 24, 2015 at 10:46:37 PM UTC-4, Lari Hotari wrote:
Hi, 

Do the instructions in <a href="https://github.com/grails/grails-core/releases/v2.4.5" rel="nofollow" target="_blank" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fgrails%2Fgrails-core%2Freleases%2Fv2.4.5\46sa\75D\46sntz\0751\46usg\75AFQjCNE021_bw6P91umDWFCWZSiGjiJ4YA';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fgrails%2Fgrails-core%2Freleases%2Fv2.4.5\46sa\75D\46sntz\0751\46usg\75AFQjCNE021_bw6P91umDWFCWZSiGjiJ4YA';return true;">https://github.com/grails/grails-core/releases/v2.4.5 help at all?
//    cache.region.factory_class = 'org.hibernate.cache.SingletonEhCacheRegionFactory' // Hibernate 3
    cache.region.factory_class = 'org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory' // Hibernate 4
I'm currently in the middle of releasing Grails 2.4.5 and Grails 2.5.0.

Lari



On 24 Mar 2015, at 22:42, Aaron <[hidden email]> wrote:

So every time a new version of hibernate4 or ehcache comes out, I try to upgrade and every time it fails with "

Another unnamed CacheManager already exists in the same VM". I exclude ehcache-core from the hibernate4 dependency but it never works for anything but ehcache-1.0.0

We've been hopelessly stuck on 1.0.0 for like 2 years now.

Can someone please post the magic recipe for using cache-1.1.8 and ehcache-1.0.5 and hibernate4-4.3.8.1?

-Aaron


--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-discuss+[hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;" onclick="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;">https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/05e5264a-b63c-4362-87f7-11be37c13306%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How in the world do you upgrade to cache-ehcache > 1.0.0

Ronny Løvtangen
Upgrading cache-ehcache plugin has been a bit of a pain the latest releases. This is my list of workarounds to get cache:1.1.8 and cache-ehcache:1.0.5 working in Grails 2.4.4:



1) Exclude ehcache-core dependency of hibernate, workaround for https://jira.grails.org/browse/GPCACHEEHCACHE-10:

BuildConfig.groovy:

runtime ":hibernate4:4.3.6.1", { // or ":hibernate:3.6.10.18"
    excludes 'ehcache-core'
}



2) Revert back to using DefaultKeyGenerator so that @CachePut and @CacheEvict works. Was broken by http://jira.grails.org/browse/GPCACHE-21:

resources.groovy:

import org.springframework.cache.interceptor.DefaultKeyGenerator
beans = {
    defaultKeyGenerator(DefaultKeyGenerator)
}

Config.groovy:

grails.cache.keyGenerator = "defaultKeyGenerator"



3) For some reason, if cached object is at least two levels deep, maxElementsInMemory must be set to a value to avoid error:
WARN net.sf.ehcache.pool.sizeof.ObjectGraphWalker - The configured limit of 1,000 object references was reached while attempting to calculate the size of the object graph. Severe performance degradation could occur if the sizing operation continues. This can be avoided by setting the CacheManger or Cache <sizeOfPolicy> elements maxDepthExceededBehavior to "abort" or adding stop points with @IgnoreSizeOf annotations. If performance degradation is NOT an issue at the configured limit, raise the limit value using the CacheManager or Cache <sizeOfPolicy> elements maxDepth attribute. For more information, see the Ehcache configuration documentation.

Config.groovy:

grails.cache.config = {
   ...
   cache {
       ...
        maxElementsInMemory 1000
   }
}



I have one application that I haven't been able to upgrade yet. It does have multiple datasources, so I will have a look at switching to the Singleton factory.


Best Regards,
Ronny Løvtangen


On 25 Mar 2015, at 05:29, Aaron <[hidden email]> wrote:

Switching to the Singleton factory seems to fix the problems (we do have multiple DS). I was able to upgrade to ehcache plugin 1.0.5 and the latest hibernate (without excluding anything).

Thanks a bunch.

On Tuesday, March 24, 2015 at 11:15:55 PM UTC-4, Aaron wrote:
Lari
Let me try to the SingletonEhCacheRegionFactory and see if that fixes it.

For awhile, I know Craig Andrews was pushing for some naming fix in either datastore or the hibernate plugin (something about ehcache-core, can't recall) and I'm not sure where that ended up.

Looking forward to trying out 2.5.0 once it's ready.

Rgds,
Aaron

On Tuesday, March 24, 2015 at 10:46:37 PM UTC-4, Lari Hotari wrote:
Hi, 

Do the instructions in https://github.com/grails/grails-core/releases/v2.4.5 help at all?
//    cache.region.factory_class = 'org.hibernate.cache.SingletonEhCacheRegionFactory' // Hibernate 3
    cache.region.factory_class = 'org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory' // Hibernate 4
I'm currently in the middle of releasing Grails 2.4.5 and Grails 2.5.0.

Lari



On 24 Mar 2015, at 22:42, Aaron <[hidden email]> wrote:

So every time a new version of hibernate4 or ehcache comes out, I try to upgrade and every time it fails with "

Another unnamed CacheManager already exists in the same VM". I exclude ehcache-core from the hibernate4 dependency but it never works for anything but ehcache-1.0.0

We've been hopelessly stuck on 1.0.0 for like 2 years now.

Can someone please post the magic recipe for using cache-1.1.8 and ehcache-1.0.5 and hibernate4-4.3.8.1?

-Aaron


-- 
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-discuss+[hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/05e5264a-b63c-4362-87f7-11be37c13306%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/F7FF6FE5-4311-491D-A6FD-48EBF9A409D3%40lovtangen.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How in the world do you upgrade to cache-ehcache > 1.0.0

Ronny Løvtangen
Workaround 1 was needed because hibernate plugin and cache-ehcache plugin used different maven coordinates for ehcache dependency:

+--- org.grails.plugins:cache-ehcache:1.0.5
|    \--- net.sf.ehcache:ehcache:2.9.0

+--- org.grails.plugins:hibernate4:4.3.6.1
|    \--- net.sf.ehcache:ehcache-core:2.4.8 

So you ended up with both in the final war.

Now that hibernate plugin uses the same coordinates (net.sf.ehcache:ehcache, not net.sf.ehcache:ehcache-core), this exclusion won't be needed anymore, and it shouldn't be there so that version can be automatically resolved by aether.


Ronny

On 25 Mar 2015, at 08:59, Ronny Løvtangen <[hidden email]> wrote:

Upgrading cache-ehcache plugin has been a bit of a pain the latest releases. This is my list of workarounds to get cache:1.1.8 and cache-ehcache:1.0.5 working in Grails 2.4.4:



1) Exclude ehcache-core dependency of hibernate, workaround for https://jira.grails.org/browse/GPCACHEEHCACHE-10:

BuildConfig.groovy:

runtime ":hibernate4:4.3.6.1", { // or ":hibernate:3.6.10.18"
    excludes 'ehcache-core'
}



2) Revert back to using DefaultKeyGenerator so that @CachePut and @CacheEvict works. Was broken by http://jira.grails.org/browse/GPCACHE-21:

resources.groovy:

import org.springframework.cache.interceptor.DefaultKeyGenerator
beans = {
    defaultKeyGenerator(DefaultKeyGenerator)
}

Config.groovy:

grails.cache.keyGenerator = "defaultKeyGenerator"



3) For some reason, if cached object is at least two levels deep, maxElementsInMemory must be set to a value to avoid error:
WARN net.sf.ehcache.pool.sizeof.ObjectGraphWalker - The configured limit of 1,000 object references was reached while attempting to calculate the size of the object graph. Severe performance degradation could occur if the sizing operation continues. This can be avoided by setting the CacheManger or Cache <sizeOfPolicy> elements maxDepthExceededBehavior to "abort" or adding stop points with @IgnoreSizeOf annotations. If performance degradation is NOT an issue at the configured limit, raise the limit value using the CacheManager or Cache <sizeOfPolicy> elements maxDepth attribute. For more information, see the Ehcache configuration documentation.

Config.groovy:

grails.cache.config = {
   ...
   cache {
       ...
        maxElementsInMemory 1000
   }
}



I have one application that I haven't been able to upgrade yet. It does have multiple datasources, so I will have a look at switching to the Singleton factory.


Best Regards,
Ronny Løvtangen


On 25 Mar 2015, at 05:29, Aaron <[hidden email]> wrote:

Switching to the Singleton factory seems to fix the problems (we do have multiple DS). I was able to upgrade to ehcache plugin 1.0.5 and the latest hibernate (without excluding anything).

Thanks a bunch.

On Tuesday, March 24, 2015 at 11:15:55 PM UTC-4, Aaron wrote:
Lari
Let me try to the SingletonEhCacheRegionFactory and see if that fixes it.

For awhile, I know Craig Andrews was pushing for some naming fix in either datastore or the hibernate plugin (something about ehcache-core, can't recall) and I'm not sure where that ended up.

Looking forward to trying out 2.5.0 once it's ready.

Rgds,
Aaron

On Tuesday, March 24, 2015 at 10:46:37 PM UTC-4, Lari Hotari wrote:
Hi, 

Do the instructions in https://github.com/grails/grails-core/releases/v2.4.5 help at all?
//    cache.region.factory_class = 'org.hibernate.cache.SingletonEhCacheRegionFactory' // Hibernate 3
    cache.region.factory_class = 'org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory' // Hibernate 4
I'm currently in the middle of releasing Grails 2.4.5 and Grails 2.5.0.

Lari



On 24 Mar 2015, at 22:42, Aaron <[hidden email]> wrote:

So every time a new version of hibernate4 or ehcache comes out, I try to upgrade and every time it fails with "

Another unnamed CacheManager already exists in the same VM". I exclude ehcache-core from the hibernate4 dependency but it never works for anything but ehcache-1.0.0

We've been hopelessly stuck on 1.0.0 for like 2 years now.

Can someone please post the magic recipe for using cache-1.1.8 and ehcache-1.0.5 and hibernate4-4.3.8.1?

-Aaron


-- 
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-discuss+[hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/05e5264a-b63c-4362-87f7-11be37c13306%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/F7FF6FE5-4311-491D-A6FD-48EBF9A409D3%40lovtangen.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/AF695640-7251-4F5A-94C4-B8E214B2B04C%40lovtangen.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How in the world do you upgrade to cache-ehcache > 1.0.0

longwa
Ronny,
Thanks, that's very useful information. It's a shame that such a core plugin has been in such a bad state for so long. I appreciate the heads up on the key generator.

Lari,
With the SingletonFactory my app is running, but dbm-gorm-diff is still trying to create another factory giving the:

| Error Error executing script DbmGormDiff: net.sf.ehcache.CacheException: Another CacheManager with same name 'grails-cache-ehcache' already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following:

1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary

2. Shutdown the earlier cacheManager before creating new one with same name.

The source of the existing CacheManager is: InputStreamConfigurationSource [stream=java.io.ByteArrayInputStream@b9f0d73] (Use --stacktrace to see the full trace)


On Wednesday, March 25, 2015 at 4:38:05 AM UTC-4, Ronny Løvtangen wrote:
Workaround 1 was needed because hibernate plugin and cache-ehcache plugin used different maven coordinates for ehcache dependency:

+--- org.grails.plugins:cache-ehcache:1.0.5
|    \--- net.sf.ehcache:ehcache:2.9.0

+--- org.grails.plugins:hibernate4:4.3.6.1
|    \--- net.sf.ehcache:ehcache-core:2.4.8 

So you ended up with both in the final war.

Now that hibernate plugin uses the same coordinates (net.sf.ehcache:ehcache, not net.sf.ehcache:ehcache-core), this exclusion won't be needed anymore, and it shouldn't be there so that version can be automatically resolved by aether.


Ronny

On 25 Mar 2015, at 08:59, Ronny Løvtangen <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="xiTsRR50c5YJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">ro...@...> wrote:

Upgrading cache-ehcache plugin has been a bit of a pain the latest releases. This is my list of workarounds to get cache:1.1.8 and cache-ehcache:1.0.5 working in Grails 2.4.4:



1) Exclude ehcache-core dependency of hibernate, workaround for <a href="https://jira.grails.org/browse/GPCACHEEHCACHE-10:" target="_blank" rel="nofollow" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fjira.grails.org%2Fbrowse%2FGPCACHEEHCACHE-10%3A\46sa\75D\46sntz\0751\46usg\75AFQjCNHsvxE5X3jRC-QUXGG0GiUXnHum0g';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fjira.grails.org%2Fbrowse%2FGPCACHEEHCACHE-10%3A\46sa\75D\46sntz\0751\46usg\75AFQjCNHsvxE5X3jRC-QUXGG0GiUXnHum0g';return true;">https://jira.grails.org/browse/GPCACHEEHCACHE-10:

BuildConfig.groovy:

runtime ":hibernate4:4.3.6.1", { // or ":hibernate:3.6.10.18"
    excludes 'ehcache-core'
}



2) Revert back to using DefaultKeyGenerator so that @CachePut and @CacheEvict works. Was broken by <a href="http://jira.grails.org/browse/GPCACHE-21:" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fjira.grails.org%2Fbrowse%2FGPCACHE-21%3A\46sa\75D\46sntz\0751\46usg\75AFQjCNHxIaaIwOsRkqVLRtyWMajl6Vm5ng';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fjira.grails.org%2Fbrowse%2FGPCACHE-21%3A\46sa\75D\46sntz\0751\46usg\75AFQjCNHxIaaIwOsRkqVLRtyWMajl6Vm5ng';return true;">http://jira.grails.org/browse/GPCACHE-21:

resources.groovy:

import org.springframework.cache.interceptor.DefaultKeyGenerator
beans = {
    defaultKeyGenerator(DefaultKeyGenerator)
}

Config.groovy:

grails.cache.keyGenerator = "defaultKeyGenerator"



3) For some reason, if cached object is at least two levels deep, maxElementsInMemory must be set to a value to avoid error:
WARN net.sf.ehcache.pool.sizeof.ObjectGraphWalker - The configured limit of 1,000 object references was reached while attempting to calculate the size of the object graph. Severe performance degradation could occur if the sizing operation continues. This can be avoided by setting the CacheManger or Cache <sizeOfPolicy> elements maxDepthExceededBehavior to "abort" or adding stop points with @IgnoreSizeOf annotations. If performance degradation is NOT an issue at the configured limit, raise the limit value using the CacheManager or Cache <sizeOfPolicy> elements maxDepth attribute. For more information, see the Ehcache configuration documentation.

Config.groovy:

grails.cache.config = {
   ...
   cache {
       ...
        maxElementsInMemory 1000
   }
}



I have one application that I haven't been able to upgrade yet. It does have multiple datasources, so I will have a look at switching to the Singleton factory.


Best Regards,
Ronny Løvtangen


On 25 Mar 2015, at 05:29, Aaron <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="xiTsRR50c5YJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">lon...@...> wrote:

Switching to the Singleton factory seems to fix the problems (we do have multiple DS). I was able to upgrade to ehcache plugin 1.0.5 and the latest hibernate (without excluding anything).

Thanks a bunch.

On Tuesday, March 24, 2015 at 11:15:55 PM UTC-4, Aaron wrote:
Lari
Let me try to the SingletonEhCacheRegionFactory and see if that fixes it.

For awhile, I know Craig Andrews was pushing for some naming fix in either datastore or the hibernate plugin (something about ehcache-core, can't recall) and I'm not sure where that ended up.

Looking forward to trying out 2.5.0 once it's ready.

Rgds,
Aaron

On Tuesday, March 24, 2015 at 10:46:37 PM UTC-4, Lari Hotari wrote:
Hi, 

Do the instructions in <a href="https://github.com/grails/grails-core/releases/v2.4.5" rel="nofollow" target="_blank" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fgrails%2Fgrails-core%2Freleases%2Fv2.4.5\46sa\75D\46sntz\0751\46usg\75AFQjCNE021_bw6P91umDWFCWZSiGjiJ4YA';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fgrails%2Fgrails-core%2Freleases%2Fv2.4.5\46sa\75D\46sntz\0751\46usg\75AFQjCNE021_bw6P91umDWFCWZSiGjiJ4YA';return true;">https://github.com/grails/grails-core/releases/v2.4.5 help at all?
//    cache.region.factory_class = 'org.hibernate.cache.SingletonEhCacheRegionFactory' // Hibernate 3
    cache.region.factory_class = 'org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory' // Hibernate 4
I'm currently in the middle of releasing Grails 2.4.5 and Grails 2.5.0.

Lari



On 24 Mar 2015, at 22:42, Aaron <[hidden email]> wrote:

So every time a new version of hibernate4 or ehcache comes out, I try to upgrade and every time it fails with "

Another unnamed CacheManager already exists in the same VM". I exclude ehcache-core from the hibernate4 dependency but it never works for anything but ehcache-1.0.0

We've been hopelessly stuck on 1.0.0 for like 2 years now.

Can someone please post the magic recipe for using cache-1.1.8 and ehcache-1.0.5 and hibernate4-4.3.8.1?

-Aaron


-- 
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-discuss+[hidden email].
To post to this group, send email to grails-de...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;" onclick="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;">https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank" gdf-obfuscated-mailto="xiTsRR50c5YJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">grails-dev-discuss+unsubscribe@....
To post to this group, send email to <a href="javascript:" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank" gdf-obfuscated-mailto="xiTsRR50c5YJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">grails-de...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/grails-dev-discuss/05e5264a-b63c-4362-87f7-11be37c13306%40googlegroups.com?utm_medium=email&amp;utm_source=footer" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/05e5264a-b63c-4362-87f7-11be37c13306%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;" onclick="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/05e5264a-b63c-4362-87f7-11be37c13306%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;">https://groups.google.com/d/msgid/grails-dev-discuss/05e5264a-b63c-4362-87f7-11be37c13306%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="xiTsRR50c5YJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">grails-dev-discuss+unsubscribe@....
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="xiTsRR50c5YJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">grails-de...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/grails-dev-discuss/F7FF6FE5-4311-491D-A6FD-48EBF9A409D3%40lovtangen.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/F7FF6FE5-4311-491D-A6FD-48EBF9A409D3%40lovtangen.com?utm_medium\75email\46utm_source\75footer';return true;" onclick="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/F7FF6FE5-4311-491D-A6FD-48EBF9A409D3%40lovtangen.com?utm_medium\75email\46utm_source\75footer';return true;">https://groups.google.com/d/msgid/grails-dev-discuss/F7FF6FE5-4311-491D-A6FD-48EBF9A409D3%40lovtangen.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/3e2ea030-0bec-47ed-b9a4-e1dc8341d01b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How in the world do you upgrade to cache-ehcache > 1.0.0

Lari Hotari-3

There is a similar problem in ehcache config with spring-security-core plugin. The jira is https://jira.grails.org/browse/GRAILS-12120 .
spring-security-core is using EhCacheManagerFactoryBean[1] to configure ehcache and there is "shared" and cacheManagerName properties in that bean that can be set in Config.groovy.

beans {
   cacheManager {
      shared = true
  }
}


beans {
   cacheManager {
      cacheManagerName = 'springSecurityCacheManager'
  }
}


I wonder if something like this helps for the dbm-gorm-diff problem:
beans {
   ehcacheCacheManager {
      shared = true
  }
}


Lari

[1] https://github.com/lhotari/spring-framework/blob/4.1.x/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheManagerFactoryBean.java




On Wednesday, March 25, 2015 at 1:12:29 PM UTC-4, Aaron wrote:
Ronny,
Thanks, that's very useful information. It's a shame that such a core plugin has been in such a bad state for so long. I appreciate the heads up on the key generator.

Lari,
With the SingletonFactory my app is running, but dbm-gorm-diff is still trying to create another factory giving the:

| Error Error executing script DbmGormDiff: net.sf.ehcache.CacheException: Another CacheManager with same name 'grails-cache-ehcache' already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following:

1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary

2. Shutdown the earlier cacheManager before creating new one with same name.

The source of the existing CacheManager is: InputStreamConfigurationSource [stream=java.io.ByteArrayInputStream@b9f0d73] (Use --stacktrace to see the full trace)


On Wednesday, March 25, 2015 at 4:38:05 AM UTC-4, Ronny Løvtangen wrote:
Workaround 1 was needed because hibernate plugin and cache-ehcache plugin used different maven coordinates for ehcache dependency:

+--- org.grails.plugins:cache-ehcache:1.0.5
|    \--- net.sf.ehcache:ehcache:2.9.0

+--- org.grails.plugins:hibernate4:4.3.6.1
|    \--- net.sf.ehcache:ehcache-core:2.4.8 

So you ended up with both in the final war.

Now that hibernate plugin uses the same coordinates (net.sf.ehcache:ehcache, not net.sf.ehcache:ehcache-core), this exclusion won't be needed anymore, and it shouldn't be there so that version can be automatically resolved by aether.


Ronny

On 25 Mar 2015, at 08:59, Ronny Løvtangen <[hidden email]> wrote:

Upgrading cache-ehcache plugin has been a bit of a pain the latest releases. This is my list of workarounds to get cache:1.1.8 and cache-ehcache:1.0.5 working in Grails 2.4.4:



1) Exclude ehcache-core dependency of hibernate, workaround for <a href="https://jira.grails.org/browse/GPCACHEEHCACHE-10:" rel="nofollow" target="_blank" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fjira.grails.org%2Fbrowse%2FGPCACHEEHCACHE-10%3A\46sa\75D\46sntz\0751\46usg\75AFQjCNHsvxE5X3jRC-QUXGG0GiUXnHum0g';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fjira.grails.org%2Fbrowse%2FGPCACHEEHCACHE-10%3A\46sa\75D\46sntz\0751\46usg\75AFQjCNHsvxE5X3jRC-QUXGG0GiUXnHum0g';return true;">https://jira.grails.org/browse/GPCACHEEHCACHE-10:

BuildConfig.groovy:

runtime ":hibernate4:4.3.6.1", { // or ":hibernate:3.6.10.18"
    excludes 'ehcache-core'
}



2) Revert back to using DefaultKeyGenerator so that @CachePut and @CacheEvict works. Was broken by <a href="http://jira.grails.org/browse/GPCACHE-21:" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fjira.grails.org%2Fbrowse%2FGPCACHE-21%3A\46sa\75D\46sntz\0751\46usg\75AFQjCNHxIaaIwOsRkqVLRtyWMajl6Vm5ng';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fjira.grails.org%2Fbrowse%2FGPCACHE-21%3A\46sa\75D\46sntz\0751\46usg\75AFQjCNHxIaaIwOsRkqVLRtyWMajl6Vm5ng';return true;">http://jira.grails.org/browse/GPCACHE-21:

resources.groovy:

import org.springframework.cache.interceptor.DefaultKeyGenerator
beans = {
    defaultKeyGenerator(DefaultKeyGenerator)
}

Config.groovy:

grails.cache.keyGenerator = "defaultKeyGenerator"



3) For some reason, if cached object is at least two levels deep, maxElementsInMemory must be set to a value to avoid error:
WARN net.sf.ehcache.pool.sizeof.ObjectGraphWalker - The configured limit of 1,000 object references was reached while attempting to calculate the size of the object graph. Severe performance degradation could occur if the sizing operation continues. This can be avoided by setting the CacheManger or Cache <sizeOfPolicy> elements maxDepthExceededBehavior to "abort" or adding stop points with @IgnoreSizeOf annotations. If performance degradation is NOT an issue at the configured limit, raise the limit value using the CacheManager or Cache <sizeOfPolicy> elements maxDepth attribute. For more information, see the Ehcache configuration documentation.

Config.groovy:

grails.cache.config = {
   ...
   cache {
       ...
        maxElementsInMemory 1000
   }
}



I have one application that I haven't been able to upgrade yet. It does have multiple datasources, so I will have a look at switching to the Singleton factory.


Best Regards,
Ronny Løvtangen


On 25 Mar 2015, at 05:29, Aaron <[hidden email]> wrote:

Switching to the Singleton factory seems to fix the problems (we do have multiple DS). I was able to upgrade to ehcache plugin 1.0.5 and the latest hibernate (without excluding anything).

Thanks a bunch.

On Tuesday, March 24, 2015 at 11:15:55 PM UTC-4, Aaron wrote:
Lari
Let me try to the SingletonEhCacheRegionFactory and see if that fixes it.

For awhile, I know Craig Andrews was pushing for some naming fix in either datastore or the hibernate plugin (something about ehcache-core, can't recall) and I'm not sure where that ended up.

Looking forward to trying out 2.5.0 once it's ready.

Rgds,
Aaron

On Tuesday, March 24, 2015 at 10:46:37 PM UTC-4, Lari Hotari wrote:
Hi, 

Do the instructions in <a href="https://github.com/grails/grails-core/releases/v2.4.5" rel="nofollow" target="_blank" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fgrails%2Fgrails-core%2Freleases%2Fv2.4.5\46sa\75D\46sntz\0751\46usg\75AFQjCNE021_bw6P91umDWFCWZSiGjiJ4YA';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fgrails%2Fgrails-core%2Freleases%2Fv2.4.5\46sa\75D\46sntz\0751\46usg\75AFQjCNE021_bw6P91umDWFCWZSiGjiJ4YA';return true;">https://github.com/grails/grails-core/releases/v2.4.5 help at all?
//    cache.region.factory_class = 'org.hibernate.cache.SingletonEhCacheRegionFactory' // Hibernate 3
    cache.region.factory_class = 'org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory' // Hibernate 4
I'm currently in the middle of releasing Grails 2.4.5 and Grails 2.5.0.

Lari



On 24 Mar 2015, at 22:42, Aaron <[hidden email]> wrote:

So every time a new version of hibernate4 or ehcache comes out, I try to upgrade and every time it fails with "

Another unnamed CacheManager already exists in the same VM". I exclude ehcache-core from the hibernate4 dependency but it never works for anything but ehcache-1.0.0

We've been hopelessly stuck on 1.0.0 for like 2 years now.

Can someone please post the magic recipe for using cache-1.1.8 and ehcache-1.0.5 and hibernate4-4.3.8.1?

-Aaron


-- 
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-discuss+[hidden email].
To post to this group, send email to grails-de...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;" onclick="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;">https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-discuss+[hidden email].
To post to this group, send email to grails-de...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/grails-dev-discuss/05e5264a-b63c-4362-87f7-11be37c13306%40googlegroups.com?utm_medium=email&amp;utm_source=footer" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/05e5264a-b63c-4362-87f7-11be37c13306%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;" onclick="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/05e5264a-b63c-4362-87f7-11be37c13306%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;">https://groups.google.com/d/msgid/grails-dev-discuss/05e5264a-b63c-4362-87f7-11be37c13306%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-discuss+[hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/grails-dev-discuss/F7FF6FE5-4311-491D-A6FD-48EBF9A409D3%40lovtangen.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/F7FF6FE5-4311-491D-A6FD-48EBF9A409D3%40lovtangen.com?utm_medium\75email\46utm_source\75footer';return true;" onclick="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/F7FF6FE5-4311-491D-A6FD-48EBF9A409D3%40lovtangen.com?utm_medium\75email\46utm_source\75footer';return true;">https://groups.google.com/d/msgid/grails-dev-discuss/F7FF6FE5-4311-491D-A6FD-48EBF9A409D3%40lovtangen.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/3953fca3-e63c-40d6-801a-0d08903f2a8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How in the world do you upgrade to cache-ehcache > 1.0.0

longwa
Yeah, looks like the same problem.

Running with:
ehcacheCacheManager { 
    shared
= true
}

Results in:
| Error Error executing script DbmGormDiff: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ehcacheCacheManager': Unable to determine target bean definition for FactoryBeans of type grails.plugin.cache.ehcache.GrailsEhCacheManagerFactoryBean (Use --stacktrace to see the full trace)

Using:

cacheManager {
    shared
= true
}

Gives the same error as before:

| Error Error executing script DbmGormDiff: net.sf.ehcache.CacheException: Another CacheManager with same name 'grails-cache-ehcache' already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following:

1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary

2. Shutdown the earlier cacheManager before creating new one with same name.

The source of the existing CacheManager is: InputStreamConfigurationSource [stream=java.io.ByteArrayInputStream@220540af] (Use --stacktrace to see the full trace)





On Thursday, March 26, 2015 at 3:04:50 PM UTC-4, Lari Hotari wrote:

There is a similar problem in ehcache config with spring-security-core plugin. The jira is <a href="https://jira.grails.org/browse/GRAILS-12120" target="_blank" rel="nofollow" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fjira.grails.org%2Fbrowse%2FGRAILS-12120\46sa\75D\46sntz\0751\46usg\75AFQjCNHhFhplTBu4-RZzXxehz42in9AbJQ';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fjira.grails.org%2Fbrowse%2FGRAILS-12120\46sa\75D\46sntz\0751\46usg\75AFQjCNHhFhplTBu4-RZzXxehz42in9AbJQ';return true;">https://jira.grails.org/browse/GRAILS-12120 .
spring-security-core is using EhCacheManagerFactoryBean[1] to configure ehcache and there is "shared" and cacheManagerName properties in that bean that can be set in Config.groovy.

beans {
   cacheManager {
      shared = true
  }
}


beans {
   cacheManager {
      cacheManagerName = 'springSecurityCacheManager'
  }
}


I wonder if something like this helps for the dbm-gorm-diff problem:
beans {
   ehcacheCacheManager {
      shared = true
  }
}


Lari

[1] <a href="https://github.com/lhotari/spring-framework/blob/4.1.x/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheManagerFactoryBean.java" target="_blank" rel="nofollow" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Flhotari%2Fspring-framework%2Fblob%2F4.1.x%2Fspring-context-support%2Fsrc%2Fmain%2Fjava%2Forg%2Fspringframework%2Fcache%2Fehcache%2FEhCacheManagerFactoryBean.java\46sa\75D\46sntz\0751\46usg\75AFQjCNFS0tiYNrTwochWUiaz1v9u9QL2yA';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Flhotari%2Fspring-framework%2Fblob%2F4.1.x%2Fspring-context-support%2Fsrc%2Fmain%2Fjava%2Forg%2Fspringframework%2Fcache%2Fehcache%2FEhCacheManagerFactoryBean.java\46sa\75D\46sntz\0751\46usg\75AFQjCNFS0tiYNrTwochWUiaz1v9u9QL2yA';return true;">https://github.com/lhotari/spring-framework/blob/4.1.x/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheManagerFactoryBean.java




On Wednesday, March 25, 2015 at 1:12:29 PM UTC-4, Aaron wrote:
Ronny,
Thanks, that's very useful information. It's a shame that such a core plugin has been in such a bad state for so long. I appreciate the heads up on the key generator.

Lari,
With the SingletonFactory my app is running, but dbm-gorm-diff is still trying to create another factory giving the:

| Error Error executing script DbmGormDiff: net.sf.ehcache.CacheException: Another CacheManager with same name 'grails-cache-ehcache' already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following:

1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary

2. Shutdown the earlier cacheManager before creating new one with same name.

The source of the existing CacheManager is: InputStreamConfigurationSource [stream=java.io.ByteArrayInputStream@b9f0d73] (Use --stacktrace to see the full trace)


On Wednesday, March 25, 2015 at 4:38:05 AM UTC-4, Ronny Løvtangen wrote:
Workaround 1 was needed because hibernate plugin and cache-ehcache plugin used different maven coordinates for ehcache dependency:

+--- org.grails.plugins:cache-ehcache:1.0.5
|    \--- net.sf.ehcache:ehcache:2.9.0

+--- org.grails.plugins:hibernate4:4.3.6.1
|    \--- net.sf.ehcache:ehcache-core:2.4.8 

So you ended up with both in the final war.

Now that hibernate plugin uses the same coordinates (net.sf.ehcache:ehcache, not net.sf.ehcache:ehcache-core), this exclusion won't be needed anymore, and it shouldn't be there so that version can be automatically resolved by aether.


Ronny

On 25 Mar 2015, at 08:59, Ronny Løvtangen <[hidden email]> wrote:

Upgrading cache-ehcache plugin has been a bit of a pain the latest releases. This is my list of workarounds to get cache:1.1.8 and cache-ehcache:1.0.5 working in Grails 2.4.4:



1) Exclude ehcache-core dependency of hibernate, workaround for <a href="https://jira.grails.org/browse/GPCACHEEHCACHE-10:" rel="nofollow" target="_blank" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fjira.grails.org%2Fbrowse%2FGPCACHEEHCACHE-10%3A\46sa\75D\46sntz\0751\46usg\75AFQjCNHsvxE5X3jRC-QUXGG0GiUXnHum0g';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fjira.grails.org%2Fbrowse%2FGPCACHEEHCACHE-10%3A\46sa\75D\46sntz\0751\46usg\75AFQjCNHsvxE5X3jRC-QUXGG0GiUXnHum0g';return true;">https://jira.grails.org/browse/GPCACHEEHCACHE-10:

BuildConfig.groovy:

runtime ":hibernate4:4.3.6.1", { // or ":hibernate:3.6.10.18"
    excludes 'ehcache-core'
}



2) Revert back to using DefaultKeyGenerator so that @CachePut and @CacheEvict works. Was broken by <a href="http://jira.grails.org/browse/GPCACHE-21:" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fjira.grails.org%2Fbrowse%2FGPCACHE-21%3A\46sa\75D\46sntz\0751\46usg\75AFQjCNHxIaaIwOsRkqVLRtyWMajl6Vm5ng';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fjira.grails.org%2Fbrowse%2FGPCACHE-21%3A\46sa\75D\46sntz\0751\46usg\75AFQjCNHxIaaIwOsRkqVLRtyWMajl6Vm5ng';return true;">http://jira.grails.org/browse/GPCACHE-21:

resources.groovy:

import org.springframework.cache.interceptor.DefaultKeyGenerator
beans = {
    defaultKeyGenerator(DefaultKeyGenerator)
}

Config.groovy:

grails.cache.keyGenerator = "defaultKeyGenerator"



3) For some reason, if cached object is at least two levels deep, maxElementsInMemory must be set to a value to avoid error:
WARN net.sf.ehcache.pool.sizeof.ObjectGraphWalker - The configured limit of 1,000 object references was reached while attempting to calculate the size of the object graph. Severe performance degradation could occur if the sizing operation continues. This can be avoided by setting the CacheManger or Cache <sizeOfPolicy> elements maxDepthExceededBehavior to "abort" or adding stop points with @IgnoreSizeOf annotations. If performance degradation is NOT an issue at the configured limit, raise the limit value using the CacheManager or Cache <sizeOfPolicy> elements maxDepth attribute. For more information, see the Ehcache configuration documentation.

Config.groovy:

grails.cache.config = {
   ...
   cache {
       ...
        maxElementsInMemory 1000
   }
}



I have one application that I haven't been able to upgrade yet. It does have multiple datasources, so I will have a look at switching to the Singleton factory.


Best Regards,
Ronny Løvtangen


On 25 Mar 2015, at 05:29, Aaron <[hidden email]> wrote:

Switching to the Singleton factory seems to fix the problems (we do have multiple DS). I was able to upgrade to ehcache plugin 1.0.5 and the latest hibernate (without excluding anything).

Thanks a bunch.

On Tuesday, March 24, 2015 at 11:15:55 PM UTC-4, Aaron wrote:
Lari
Let me try to the SingletonEhCacheRegionFactory and see if that fixes it.

For awhile, I know Craig Andrews was pushing for some naming fix in either datastore or the hibernate plugin (something about ehcache-core, can't recall) and I'm not sure where that ended up.

Looking forward to trying out 2.5.0 once it's ready.

Rgds,
Aaron

On Tuesday, March 24, 2015 at 10:46:37 PM UTC-4, Lari Hotari wrote:
Hi, 

Do the instructions in <a href="https://github.com/grails/grails-core/releases/v2.4.5" rel="nofollow" target="_blank" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fgrails%2Fgrails-core%2Freleases%2Fv2.4.5\46sa\75D\46sntz\0751\46usg\75AFQjCNE021_bw6P91umDWFCWZSiGjiJ4YA';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fgrails%2Fgrails-core%2Freleases%2Fv2.4.5\46sa\75D\46sntz\0751\46usg\75AFQjCNE021_bw6P91umDWFCWZSiGjiJ4YA';return true;">https://github.com/grails/grails-core/releases/v2.4.5 help at all?
//    cache.region.factory_class = 'org.hibernate.cache.SingletonEhCacheRegionFactory' // Hibernate 3
    cache.region.factory_class = 'org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory' // Hibernate 4
I'm currently in the middle of releasing Grails 2.4.5 and Grails 2.5.0.

Lari



On 24 Mar 2015, at 22:42, Aaron <[hidden email]> wrote:

So every time a new version of hibernate4 or ehcache comes out, I try to upgrade and every time it fails with "

Another unnamed CacheManager already exists in the same VM". I exclude ehcache-core from the hibernate4 dependency but it never works for anything but ehcache-1.0.0

We've been hopelessly stuck on 1.0.0 for like 2 years now.

Can someone please post the magic recipe for using cache-1.1.8 and ehcache-1.0.5 and hibernate4-4.3.8.1?

-Aaron


-- 
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-discuss+[hidden email].
To post to this group, send email to grails-de...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;" onclick="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;">https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-discuss+[hidden email].
To post to this group, send email to grails-de...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/grails-dev-discuss/05e5264a-b63c-4362-87f7-11be37c13306%40googlegroups.com?utm_medium=email&amp;utm_source=footer" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/05e5264a-b63c-4362-87f7-11be37c13306%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;" onclick="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/05e5264a-b63c-4362-87f7-11be37c13306%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;">https://groups.google.com/d/msgid/grails-dev-discuss/05e5264a-b63c-4362-87f7-11be37c13306%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-discuss+[hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/grails-dev-discuss/F7FF6FE5-4311-491D-A6FD-48EBF9A409D3%40lovtangen.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/F7FF6FE5-4311-491D-A6FD-48EBF9A409D3%40lovtangen.com?utm_medium\75email\46utm_source\75footer';return true;" onclick="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/F7FF6FE5-4311-491D-A6FD-48EBF9A409D3%40lovtangen.com?utm_medium\75email\46utm_source\75footer';return true;">https://groups.google.com/d/msgid/grails-dev-discuss/F7FF6FE5-4311-491D-A6FD-48EBF9A409D3%40lovtangen.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/ff35c483-7727-4089-9dbe-0689ab1235c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How in the world do you upgrade to cache-ehcache > 1.0.0

Lari Hotari-3
In reply to this post by Ronny Løvtangen
I upgraded grails-website to use Grails 2.5.0 and ran into some problems (https://github.com/grails-samples/grails-website/issues/65) with the upgraded version of ehcache (2.9.0).
 
The ehcache sizeof calculation (http://ehcache.org/documentation/2.8/configuration/cache-size#sizing-of-cached-entries) was causing problems and I'm now testing a solution to disable the sizeof calculation.
https://github.com/grails-samples/grails-website/commit/6cb7b934
Sizeof calculation didn't exist in the previous version (2.4.8). 
The problem that it causes in grails-website is NoClassDefFoundError when certain objects are put into the cache.

I found out that there is a separate module that allows better customization of the sizeof calculation. 

http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22sizeof%22
https://github.com/ehcache/sizeof#ehcache-sizeofengine

I also found out about https://github.com/noamt/ehcache-sizeofengine-groovy that is a groovy specific module for ehcache sizeof calculation written by Noam Tenne. 

It looks like this is the beef of the module:
https://github.com/noamt/ehcache-sizeofengine-groovy/blob/d19426d33adba6e3513beaf8d2a13bb403bebff2/src/main/java/net/sf/ehcache/sizeofengine/groovy/GroovyFilterConfigurator.java#L9

Perhaps it's just easier to disable the sizeof calculation all together since that feature didn't exist in ehcache 2.4.8 at all. I'll soon find out if the solution I made for grails-website works properly.

-Lari


On Wednesday, March 25, 2015 at 3:59:07 AM UTC-4, Ronny Løvtangen wrote:
Upgrading cache-ehcache plugin has been a bit of a pain the latest releases. This is my list of workarounds to get cache:1.1.8 and cache-ehcache:1.0.5 working in Grails 2.4.4:



1) Exclude ehcache-core dependency of hibernate, workaround for <a href="https://jira.grails.org/browse/GPCACHEEHCACHE-10:" target="_blank" rel="nofollow" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fjira.grails.org%2Fbrowse%2FGPCACHEEHCACHE-10%3A\46sa\75D\46sntz\0751\46usg\75AFQjCNHsvxE5X3jRC-QUXGG0GiUXnHum0g';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fjira.grails.org%2Fbrowse%2FGPCACHEEHCACHE-10%3A\46sa\75D\46sntz\0751\46usg\75AFQjCNHsvxE5X3jRC-QUXGG0GiUXnHum0g';return true;">https://jira.grails.org/browse/GPCACHEEHCACHE-10:

BuildConfig.groovy:

runtime ":hibernate4:4.3.6.1", { // or ":hibernate:3.6.10.18"
    excludes 'ehcache-core'
}



2) Revert back to using DefaultKeyGenerator so that @CachePut and @CacheEvict works. Was broken by <a href="http://jira.grails.org/browse/GPCACHE-21:" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fjira.grails.org%2Fbrowse%2FGPCACHE-21%3A\46sa\75D\46sntz\0751\46usg\75AFQjCNHxIaaIwOsRkqVLRtyWMajl6Vm5ng';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fjira.grails.org%2Fbrowse%2FGPCACHE-21%3A\46sa\75D\46sntz\0751\46usg\75AFQjCNHxIaaIwOsRkqVLRtyWMajl6Vm5ng';return true;">http://jira.grails.org/browse/GPCACHE-21:

resources.groovy:

import org.springframework.cache.interceptor.DefaultKeyGenerator
beans = {
    defaultKeyGenerator(DefaultKeyGenerator)
}

Config.groovy:

grails.cache.keyGenerator = "defaultKeyGenerator"



3) For some reason, if cached object is at least two levels deep, maxElementsInMemory must be set to a value to avoid error:
WARN net.sf.ehcache.pool.sizeof.ObjectGraphWalker - The configured limit of 1,000 object references was reached while attempting to calculate the size of the object graph. Severe performance degradation could occur if the sizing operation continues. This can be avoided by setting the CacheManger or Cache <sizeOfPolicy> elements maxDepthExceededBehavior to "abort" or adding stop points with @IgnoreSizeOf annotations. If performance degradation is NOT an issue at the configured limit, raise the limit value using the CacheManager or Cache <sizeOfPolicy> elements maxDepth attribute. For more information, see the Ehcache configuration documentation.

Config.groovy:

grails.cache.config = {
   ...
   cache {
       ...
        maxElementsInMemory 1000
   }
}



I have one application that I haven't been able to upgrade yet. It does have multiple datasources, so I will have a look at switching to the Singleton factory.


Best Regards,
Ronny Løvtangen


On 25 Mar 2015, at 05:29, Aaron wrote:

Switching to the Singleton factory seems to fix the problems (we do have multiple DS). I was able to upgrade to ehcache plugin 1.0.5 and the latest hibernate (without excluding anything).

Thanks a bunch.

On Tuesday, March 24, 2015 at 11:15:55 PM UTC-4, Aaron wrote:
Lari
Let me try to the SingletonEhCacheRegionFactory and see if that fixes it.

For awhile, I know Craig Andrews was pushing for some naming fix in either datastore or the hibernate plugin (something about ehcache-core, can't recall) and I'm not sure where that ended up.

Looking forward to trying out 2.5.0 once it's ready.

Rgds,
Aaron

On Tuesday, March 24, 2015 at 10:46:37 PM UTC-4, Lari Hotari wrote:
Hi, 

Do the instructions in <a href="https://github.com/grails/grails-core/releases/v2.4.5" rel="nofollow" target="_blank" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fgrails%2Fgrails-core%2Freleases%2Fv2.4.5\46sa\75D\46sntz\0751\46usg\75AFQjCNE021_bw6P91umDWFCWZSiGjiJ4YA';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fgrails%2Fgrails-core%2Freleases%2Fv2.4.5\46sa\75D\46sntz\0751\46usg\75AFQjCNE021_bw6P91umDWFCWZSiGjiJ4YA';return true;">https://github.com/grails/grails-core/releases/v2.4.5 help at all?
//    cache.region.factory_class = 'org.hibernate.cache.SingletonEhCacheRegionFactory' // Hibernate 3
    cache.region.factory_class = 'org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory' // Hibernate 4
I'm currently in the middle of releasing Grails 2.4.5 and Grails 2.5.0.

Lari



On 24 Mar 2015, at 22:42, Aaron wrote:

So every time a new version of hibernate4 or ehcache comes out, I try to upgrade and every time it fails with "

Another unnamed CacheManager already exists in the same VM". I exclude ehcache-core from the hibernate4 dependency but it never works for anything but ehcache-1.0.0

We've been hopelessly stuck on 1.0.0 for like 2 years now.

Can someone please post the magic recipe for using cache-1.1.8 and ehcache-1.0.5 and hibernate4-4.3.8.1?

-Aaron


-- 
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-discuss+[hidden email].
To post to this group, send email to grails-de...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;" onclick="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;">https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/grails-dev-discuss/05e5264a-b63c-4362-87f7-11be37c13306%40googlegroups.com?utm_medium=email&amp;utm_source=footer" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/05e5264a-b63c-4362-87f7-11be37c13306%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;" onclick="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/05e5264a-b63c-4362-87f7-11be37c13306%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;">https://groups.google.com/d/msgid/grails-dev-discuss/05e5264a-b63c-4362-87f7-11be37c13306%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/0e428a6c-33cd-49c1-ac83-017897387bd0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How in the world do you upgrade to cache-ehcache > 1.0.0

Sebastian Ortiz Vasquez
In reply to this post by Lari Hotari-3

Hi,

I am having the same error described in https://jira.grails.org/browse/GRAILS-12120?focusedCommentId=83958&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-83958 with grails 2.5.0

Had to revert to 2.4.4 until this is resolved. Thanks


On Thursday, March 26, 2015 at 2:04:50 PM UTC-5, Lari Hotari wrote:

There is a similar problem in ehcache config with spring-security-core plugin. The jira is <a href="https://jira.grails.org/browse/GRAILS-12120" target="_blank" rel="nofollow" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fjira.grails.org%2Fbrowse%2FGRAILS-12120\46sa\75D\46sntz\0751\46usg\75AFQjCNHhFhplTBu4-RZzXxehz42in9AbJQ';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fjira.grails.org%2Fbrowse%2FGRAILS-12120\46sa\75D\46sntz\0751\46usg\75AFQjCNHhFhplTBu4-RZzXxehz42in9AbJQ';return true;">https://jira.grails.org/browse/GRAILS-12120 .
spring-security-core is using EhCacheManagerFactoryBean[1] to configure ehcache and there is "shared" and cacheManagerName properties in that bean that can be set in Config.groovy.

beans {
   cacheManager {
      shared = true
  }
}


beans {
   cacheManager {
      cacheManagerName = 'springSecurityCacheManager'
  }
}


I wonder if something like this helps for the dbm-gorm-diff problem:
beans {
   ehcacheCacheManager {
      shared = true
  }
}


Lari

[1] <a href="https://github.com/lhotari/spring-framework/blob/4.1.x/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheManagerFactoryBean.java" target="_blank" rel="nofollow" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Flhotari%2Fspring-framework%2Fblob%2F4.1.x%2Fspring-context-support%2Fsrc%2Fmain%2Fjava%2Forg%2Fspringframework%2Fcache%2Fehcache%2FEhCacheManagerFactoryBean.java\46sa\75D\46sntz\0751\46usg\75AFQjCNFS0tiYNrTwochWUiaz1v9u9QL2yA';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Flhotari%2Fspring-framework%2Fblob%2F4.1.x%2Fspring-context-support%2Fsrc%2Fmain%2Fjava%2Forg%2Fspringframework%2Fcache%2Fehcache%2FEhCacheManagerFactoryBean.java\46sa\75D\46sntz\0751\46usg\75AFQjCNFS0tiYNrTwochWUiaz1v9u9QL2yA';return true;">https://github.com/lhotari/spring-framework/blob/4.1.x/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheManagerFactoryBean.java




On Wednesday, March 25, 2015 at 1:12:29 PM UTC-4, Aaron wrote:
Ronny,
Thanks, that's very useful information. It's a shame that such a core plugin has been in such a bad state for so long. I appreciate the heads up on the key generator.

Lari,
With the SingletonFactory my app is running, but dbm-gorm-diff is still trying to create another factory giving the:

| Error Error executing script DbmGormDiff: net.sf.ehcache.CacheException: Another CacheManager with same name 'grails-cache-ehcache' already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following:

1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary

2. Shutdown the earlier cacheManager before creating new one with same name.

The source of the existing CacheManager is: InputStreamConfigurationSource [stream=java.io.ByteArrayInputStream@b9f0d73] (Use --stacktrace to see the full trace)


On Wednesday, March 25, 2015 at 4:38:05 AM UTC-4, Ronny Løvtangen wrote:
Workaround 1 was needed because hibernate plugin and cache-ehcache plugin used different maven coordinates for ehcache dependency:

+--- org.grails.plugins:cache-ehcache:1.0.5
|    \--- net.sf.ehcache:ehcache:2.9.0

+--- org.grails.plugins:hibernate4:4.3.6.1
|    \--- net.sf.ehcache:ehcache-core:2.4.8 

So you ended up with both in the final war.

Now that hibernate plugin uses the same coordinates (net.sf.ehcache:ehcache, not net.sf.ehcache:ehcache-core), this exclusion won't be needed anymore, and it shouldn't be there so that version can be automatically resolved by aether.


Ronny

On 25 Mar 2015, at 08:59, Ronny Løvtangen <[hidden email]> wrote:

Upgrading cache-ehcache plugin has been a bit of a pain the latest releases. This is my list of workarounds to get cache:1.1.8 and cache-ehcache:1.0.5 working in Grails 2.4.4:



1) Exclude ehcache-core dependency of hibernate, workaround for <a href="https://jira.grails.org/browse/GPCACHEEHCACHE-10:" rel="nofollow" target="_blank" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fjira.grails.org%2Fbrowse%2FGPCACHEEHCACHE-10%3A\46sa\75D\46sntz\0751\46usg\75AFQjCNHsvxE5X3jRC-QUXGG0GiUXnHum0g';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fjira.grails.org%2Fbrowse%2FGPCACHEEHCACHE-10%3A\46sa\75D\46sntz\0751\46usg\75AFQjCNHsvxE5X3jRC-QUXGG0GiUXnHum0g';return true;">https://jira.grails.org/browse/GPCACHEEHCACHE-10:

BuildConfig.groovy:

runtime ":hibernate4:4.3.6.1", { // or ":hibernate:3.6.10.18"
    excludes 'ehcache-core'
}



2) Revert back to using DefaultKeyGenerator so that @CachePut and @CacheEvict works. Was broken by <a href="http://jira.grails.org/browse/GPCACHE-21:" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fjira.grails.org%2Fbrowse%2FGPCACHE-21%3A\46sa\75D\46sntz\0751\46usg\75AFQjCNHxIaaIwOsRkqVLRtyWMajl6Vm5ng';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fjira.grails.org%2Fbrowse%2FGPCACHE-21%3A\46sa\75D\46sntz\0751\46usg\75AFQjCNHxIaaIwOsRkqVLRtyWMajl6Vm5ng';return true;">http://jira.grails.org/browse/GPCACHE-21:

resources.groovy:

import org.springframework.cache.interceptor.DefaultKeyGenerator
beans = {
    defaultKeyGenerator(DefaultKeyGenerator)
}

Config.groovy:

grails.cache.keyGenerator = "defaultKeyGenerator"



3) For some reason, if cached object is at least two levels deep, maxElementsInMemory must be set to a value to avoid error:
WARN net.sf.ehcache.pool.sizeof.ObjectGraphWalker - The configured limit of 1,000 object references was reached while attempting to calculate the size of the object graph. Severe performance degradation could occur if the sizing operation continues. This can be avoided by setting the CacheManger or Cache <sizeOfPolicy> elements maxDepthExceededBehavior to "abort" or adding stop points with @IgnoreSizeOf annotations. If performance degradation is NOT an issue at the configured limit, raise the limit value using the CacheManager or Cache <sizeOfPolicy> elements maxDepth attribute. For more information, see the Ehcache configuration documentation.

Config.groovy:

grails.cache.config = {
   ...
   cache {
       ...
        maxElementsInMemory 1000
   }
}



I have one application that I haven't been able to upgrade yet. It does have multiple datasources, so I will have a look at switching to the Singleton factory.


Best Regards,
Ronny Løvtangen


On 25 Mar 2015, at 05:29, Aaron <[hidden email]> wrote:

Switching to the Singleton factory seems to fix the problems (we do have multiple DS). I was able to upgrade to ehcache plugin 1.0.5 and the latest hibernate (without excluding anything).

Thanks a bunch.

On Tuesday, March 24, 2015 at 11:15:55 PM UTC-4, Aaron wrote:
Lari
Let me try to the SingletonEhCacheRegionFactory and see if that fixes it.

For awhile, I know Craig Andrews was pushing for some naming fix in either datastore or the hibernate plugin (something about ehcache-core, can't recall) and I'm not sure where that ended up.

Looking forward to trying out 2.5.0 once it's ready.

Rgds,
Aaron

On Tuesday, March 24, 2015 at 10:46:37 PM UTC-4, Lari Hotari wrote:
Hi, 

Do the instructions in <a href="https://github.com/grails/grails-core/releases/v2.4.5" rel="nofollow" target="_blank" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fgrails%2Fgrails-core%2Freleases%2Fv2.4.5\46sa\75D\46sntz\0751\46usg\75AFQjCNE021_bw6P91umDWFCWZSiGjiJ4YA';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fgrails%2Fgrails-core%2Freleases%2Fv2.4.5\46sa\75D\46sntz\0751\46usg\75AFQjCNE021_bw6P91umDWFCWZSiGjiJ4YA';return true;">https://github.com/grails/grails-core/releases/v2.4.5 help at all?
//    cache.region.factory_class = 'org.hibernate.cache.SingletonEhCacheRegionFactory' // Hibernate 3
    cache.region.factory_class = 'org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory' // Hibernate 4
I'm currently in the middle of releasing Grails 2.4.5 and Grails 2.5.0.

Lari



On 24 Mar 2015, at 22:42, Aaron <[hidden email]> wrote:

So every time a new version of hibernate4 or ehcache comes out, I try to upgrade and every time it fails with "

Another unnamed CacheManager already exists in the same VM". I exclude ehcache-core from the hibernate4 dependency but it never works for anything but ehcache-1.0.0

We've been hopelessly stuck on 1.0.0 for like 2 years now.

Can someone please post the magic recipe for using cache-1.1.8 and ehcache-1.0.5 and hibernate4-4.3.8.1?

-Aaron


-- 
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-discuss+[hidden email].
To post to this group, send email to grails-de...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;" onclick="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;">https://groups.google.com/d/msgid/grails-dev-discuss/aeb5d739-a755-44ec-831b-51cb9d11df8b%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-discuss+[hidden email].
To post to this group, send email to grails-de...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/grails-dev-discuss/05e5264a-b63c-4362-87f7-11be37c13306%40googlegroups.com?utm_medium=email&amp;utm_source=footer" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/05e5264a-b63c-4362-87f7-11be37c13306%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;" onclick="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/05e5264a-b63c-4362-87f7-11be37c13306%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;">https://groups.google.com/d/msgid/grails-dev-discuss/05e5264a-b63c-4362-87f7-11be37c13306%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-discuss+[hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/grails-dev-discuss/F7FF6FE5-4311-491D-A6FD-48EBF9A409D3%40lovtangen.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/F7FF6FE5-4311-491D-A6FD-48EBF9A409D3%40lovtangen.com?utm_medium\75email\46utm_source\75footer';return true;" onclick="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/F7FF6FE5-4311-491D-A6FD-48EBF9A409D3%40lovtangen.com?utm_medium\75email\46utm_source\75footer';return true;">https://groups.google.com/d/msgid/grails-dev-discuss/F7FF6FE5-4311-491D-A6FD-48EBF9A409D3%40lovtangen.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/ca097523-8ceb-4a1f-9a22-af0a215c0897%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How in the world do you upgrade to cache-ehcache > 1.0.0

Robert Oschwald
In reply to this post by longwa
Has anyone a workaround for this problem?
I need to use cache-ehcache 1.0.5, but db migrations do not run then and cause the said "Another CacheManager ..“ errors, even with the SingletonEhCacheRegionFactory set.
Application uses Grails 2.4.4 and I need persistent caching.

Already tried the suggested workarounds.

Thanks,
Robert












> Am 26.03.2015 um 20:53 schrieb Aaron <[hidden email]>:
>
> Yeah, looks like the same problem.
>
> Running with:
> ehcacheCacheManager {
>     shared = true
> }
>
> Results in:
> | Error Error executing script DbmGormDiff: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ehcacheCacheManager': Unable to determine target bean definition for FactoryBeans of type grails.plugin.cache.ehcache.GrailsEhCacheManagerFactoryBean (Use --stacktrace to see the full trace)
>
> Using:
>
> cacheManager {
>     shared = true
> }
>
> Gives the same error as before:
>
> | Error Error executing script DbmGormDiff: net.sf.ehcache.CacheException: Another CacheManager with same name 'grails-cache-ehcache' already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following:
>
> 1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary
>
> 2. Shutdown the earlier cacheManager before creating new one with same name.
>
> The source of the existing CacheManager is: InputStreamConfigurationSource [stream=java.io.ByteArrayInputStream@220540af] (Use --stacktrace to see the full trace)
>
>
>
>

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CD8D2545-FA54-4097-BD25-49DB5359CF8D%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How in the world do you upgrade to cache-ehcache > 1.0.0

longwa
I think upgrading to the latest snapshot of the db migrations plugin will fix that problem. It works for us.

-Aaron

On Mon, Jun 1, 2015 at 1:34 PM, Robert Oschwald <[hidden email]> wrote:
Has anyone a workaround for this problem?
I need to use cache-ehcache 1.0.5, but db migrations do not run then and cause the said "Another CacheManager ..“ errors, even with the SingletonEhCacheRegionFactory set.
Application uses Grails 2.4.4 and I need persistent caching.

Already tried the suggested workarounds.

Thanks,
Robert












> Am 26.03.2015 um 20:53 schrieb Aaron <[hidden email]>:
>
> Yeah, looks like the same problem.
>
> Running with:
> ehcacheCacheManager {
>     shared = true
> }
>
> Results in:
> | Error Error executing script DbmGormDiff: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ehcacheCacheManager': Unable to determine target bean definition for FactoryBeans of type grails.plugin.cache.ehcache.GrailsEhCacheManagerFactoryBean (Use --stacktrace to see the full trace)
>
> Using:
>
> cacheManager {
>     shared = true
> }
>
> Gives the same error as before:
>
> | Error Error executing script DbmGormDiff: net.sf.ehcache.CacheException: Another CacheManager with same name 'grails-cache-ehcache' already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following:
>
> 1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary
>
> 2. Shutdown the earlier cacheManager before creating new one with same name.
>
> The source of the existing CacheManager is: InputStreamConfigurationSource [stream=java.io.ByteArrayInputStream@220540af] (Use --stacktrace to see the full trace)
>
>
>
>

--
You received this message because you are subscribed to a topic in the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/grails-dev-discuss/57bpHvzHH3I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CD8D2545-FA54-4097-BD25-49DB5359CF8D%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CABk8AtJKExtWNmiisADfkk-xn-w%2BD01Y2wmBZRWOyoH_hEnmrg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How in the world do you upgrade to cache-ehcache > 1.0.0

Robert Oschwald
Thanks Aaron.

Tried the latest db migration snapshot (1.4.1-SNAPSHOT as of yesterday) but it still does not work.

Config:
- Grails 2.4.4 (OSX 10.10.3, Java 1.7.0_79)
- non-forked mode in development

- plugins:
 :hibernate4:4.3.6.1 (ehcache-core excluded)
 :cache-ehcache:1.0.5
 
  Configured 5 cache zones, including the Hibernate StandardQueryCache and UpdateTimestampsCache (those with default values).

- DataSource:
I tried the ehcache-plugin supplied BeanEhcacheRegionFactory4 and SingletonEhCacheRegionFactory.
It doesn’t work with none of them.



Robert







> Am 01.06.2015 um 20:07 schrieb Aaron Long <[hidden email]>:
>
> I think upgrading to the latest snapshot of the db migrations plugin will fix that problem. It works for us.
>
> -Aaron
>
> On Mon, Jun 1, 2015 at 1:34 PM, Robert Oschwald <[hidden email]> wrote:
> Has anyone a workaround for this problem?
> I need to use cache-ehcache 1.0.5, but db migrations do not run then and cause the said "Another CacheManager ..“ errors, even with the SingletonEhCacheRegionFactory set.
> Application uses Grails 2.4.4 and I need persistent caching.
>
> Already tried the suggested workarounds.
>
> Thanks,
> Robert
>
>
>
>
>
>
>
>
>
>
>
>
> > Am 26.03.2015 um 20:53 schrieb Aaron <[hidden email]>:
> >
> > Yeah, looks like the same problem.
> >
> > Running with:
> > ehcacheCacheManager {
> >     shared = true
> > }
> >
> > Results in:
> > | Error Error executing script DbmGormDiff: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ehcacheCacheManager': Unable to determine target bean definition for FactoryBeans of type grails.plugin.cache.ehcache.GrailsEhCacheManagerFactoryBean (Use --stacktrace to see the full trace)
> >
> > Using:
> >
> > cacheManager {
> >     shared = true
> > }
> >
> > Gives the same error as before:
> >
> > | Error Error executing script DbmGormDiff: net.sf.ehcache.CacheException: Another CacheManager with same name 'grails-cache-ehcache' already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following:
> >
> > 1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary
> >
> > 2. Shutdown the earlier cacheManager before creating new one with same name.
> >
> > The source of the existing CacheManager is: InputStreamConfigurationSource [stream=java.io.ByteArrayInputStream@220540af] (Use --stacktrace to see the full trace)
> >
> >
> >
> >
>
> --
> You received this message because you are subscribed to a topic in the Google Groups "Grails Dev Discuss" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/grails-dev-discuss/57bpHvzHH3I/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CD8D2545-FA54-4097-BD25-49DB5359CF8D%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CABk8AtJKExtWNmiisADfkk-xn-w%2BD01Y2wmBZRWOyoH_hEnmrg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/A673766B-7704-48A9-9BB9-8826C51616B1%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How in the world do you upgrade to cache-ehcache > 1.0.0

longwa
We are running very similar except:

- We are running in forked mode for development
- We are using :hibernate4:4.3.8.1
- We are no longer excluding ehcache-core (I believe the name issues have been resolved in the latest HBM plugin)
- Using cache:1.1.8
- Using cache-ehcache:1.0.5
- Using SingletonEhCacheRegionFactory

Try upgrading to the latest hibernate and remove the exclusion, that might fix it.

-Aaron

On Tue, Jun 2, 2015 at 6:05 AM, Robert Oschwald <[hidden email]> wrote:
Thanks Aaron.

Tried the latest db migration snapshot (1.4.1-SNAPSHOT as of yesterday) but it still does not work.

Config:
- Grails 2.4.4 (OSX 10.10.3, Java 1.7.0_79)
- non-forked mode in development

- plugins:
 :hibernate4:4.3.6.1 (ehcache-core excluded)
 :cache-ehcache:1.0.5

  Configured 5 cache zones, including the Hibernate StandardQueryCache and UpdateTimestampsCache (those with default values).

- DataSource:
I tried the ehcache-plugin supplied BeanEhcacheRegionFactory4 and SingletonEhCacheRegionFactory.
It doesn’t work with none of them.



Robert







> Am 01.06.2015 um 20:07 schrieb Aaron Long <[hidden email]>:
>
> I think upgrading to the latest snapshot of the db migrations plugin will fix that problem. It works for us.
>
> -Aaron
>
> On Mon, Jun 1, 2015 at 1:34 PM, Robert Oschwald <[hidden email]> wrote:
> Has anyone a workaround for this problem?
> I need to use cache-ehcache 1.0.5, but db migrations do not run then and cause the said "Another CacheManager ..“ errors, even with the SingletonEhCacheRegionFactory set.
> Application uses Grails 2.4.4 and I need persistent caching.
>
> Already tried the suggested workarounds.
>
> Thanks,
> Robert
>
>
>
>
>
>
>
>
>
>
>
>
> > Am 26.03.2015 um 20:53 schrieb Aaron <[hidden email]>:
> >
> > Yeah, looks like the same problem.
> >
> > Running with:
> > ehcacheCacheManager {
> >     shared = true
> > }
> >
> > Results in:
> > | Error Error executing script DbmGormDiff: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ehcacheCacheManager': Unable to determine target bean definition for FactoryBeans of type grails.plugin.cache.ehcache.GrailsEhCacheManagerFactoryBean (Use --stacktrace to see the full trace)
> >
> > Using:
> >
> > cacheManager {
> >     shared = true
> > }
> >
> > Gives the same error as before:
> >
> > | Error Error executing script DbmGormDiff: net.sf.ehcache.CacheException: Another CacheManager with same name 'grails-cache-ehcache' already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following:
> >
> > 1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary
> >
> > 2. Shutdown the earlier cacheManager before creating new one with same name.
> >
> > The source of the existing CacheManager is: InputStreamConfigurationSource [stream=java.io.ByteArrayInputStream@220540af] (Use --stacktrace to see the full trace)
> >
> >
> >
> >
>
> --
> You received this message because you are subscribed to a topic in the Google Groups "Grails Dev Discuss" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/grails-dev-discuss/57bpHvzHH3I/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CD8D2545-FA54-4097-BD25-49DB5359CF8D%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CABk8AtJKExtWNmiisADfkk-xn-w%2BD01Y2wmBZRWOyoH_hEnmrg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/grails-dev-discuss/57bpHvzHH3I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/A673766B-7704-48A9-9BB9-8826C51616B1%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CABk8AtKP%3DKGhVoUs9tSw7_Ua1Rx6DtC9isMmmrrknvUyOEvKQw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How in the world do you upgrade to cache-ehcache > 1.0.0

Robert Oschwald
Now it works with cache-ehcache:1.0.5 and hibernate4:4.3.8.1.

Got it working only by explicitly naming the cache manager.
See  http://www.first8.nl/blog/fix-cachemanager-with-same-name-grails-cache-ehcache/

Robert



Am 02.06.2015 um 18:34 schrieb Aaron Long <[hidden email]>:

We are running very similar except:

- We are running in forked mode for development
- We are using :hibernate4:4.3.8.1
- We are no longer excluding ehcache-core (I believe the name issues have been resolved in the latest HBM plugin)
- Using cache:1.1.8
- Using cache-ehcache:1.0.5
- Using SingletonEhCacheRegionFactory

Try upgrading to the latest hibernate and remove the exclusion, that might fix it.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/F2A7207A-C5C7-4C32-B26E-969FEEADD7DC%40gmail.com.
For more options, visit https://groups.google.com/d/optout.