You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Krishan Senevirathne <kr...@gmail.com> on 2011/08/08 13:34:08 UTC

Problem with EhCacheManager

Hi, I'm trying to use EhCacheManager implementation to do caching.
In my .ini file I'm having

cacheManager = org.apache.shiro.cache.ehcache.EhCacheManager
securityManager.cacheManager = $cacheManager

shiro-ehcache.jar and ehcache1.5.0.jar in my class path

but I'm getting an exception. Here is the stack trace
SEVERE: Unable to start Filter: [Unable to set property 'cacheManager' with
value [$cacheManager] on object of type
org.apache.shiro.web.mgt.DefaultWebSecurityManager.  If '$cacheManager' is a
reference to another (previously defined) object, prefix it with '$' to
indicate that the referenced object should be used as the actual value.  For
example, $$cacheManager].
org.apache.shiro.config.ConfigurationException: Unable to set property
'cacheManager' with value [$cacheManager] on object of type
org.apache.shiro.web.mgt.DefaultWebSecurityManager.  If '$cacheManager' is a
reference to another (previously defined) object, prefix it with '$' to
indicate that the referenced object should be used as the actual value.  For
example, $$cacheManager
at
org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:373)
at
org.apache.shiro.config.ReflectionBuilder.applySingleProperty(ReflectionBuilder.java:198)
at
org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:159)
at
org.apache.shiro.config.ReflectionBuilder.buildObjects(ReflectionBuilder.java:119)
at
org.apache.shiro.config.IniSecurityManagerFactory.buildInstances(IniSecurityManagerFactory.java:170)
at
org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:119)
at
org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:97)
at
org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:83)
at
org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:41)
at
org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:123)
at
org.apache.shiro.util.AbstractFactory.getInstance(AbstractFactory.java:47)
at
org.apache.shiro.web.servlet.IniShiroFilter.applySecurityManager(IniShiroFilter.java:353)
at
org.apache.shiro.web.servlet.IniShiroFilter.configure(IniShiroFilter.java:321)
at org.apache.shiro.web.servlet.IniShiroFilter.init(IniShiroFilter.java:292)
at
org.apache.shiro.web.servlet.AbstractShiroFilter.onFilterConfigSet(AbstractShiroFilter.java:83)
at org.apache.shiro.web.servlet.AbstractFilter.init(AbstractFilter.java:94)
at
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
at
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at
org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
at
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3838)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4488)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)
at
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)
at
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)
at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
at
org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:365)
... 33 more

I can't figure out the problem.
Is there any problems with my implementation??

Thanks in advance

Cheers
Krishan..

Re: Problem with EhCacheManager

Posted by Krishan <kr...@gmail.com>.
Thanks a lot Les..
It works fine with new versions of EHCache

Cheers
Krishan

--
View this message in context: http://shiro-user.582556.n2.nabble.com/Problem-with-EhCacheManager-tp6663959p6667368.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: Problem with EhCacheManager

Posted by Les Hazlewood <lh...@apache.org>.
Hi Krishan,

Ehcache 1.5 is pretty old.  Shiro is compiled against 2.3.0.  Try that
and see how it works.

As a test, I ran the basic Shiro sample web app here:
http://svn.apache.org/repos/asf/shiro/trunk/samples/web/

I modified the pom to depend on Shiro's shiro-ehcache .jar and then
added the following to the WEB-INF/shiro.ini file at the end of the
[main] section:

sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager
sessionDAO = org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO
sessionManager.sessionDAO = $sessionDAO
securityManager.sessionManager = $sessionManager

cacheManager = org.apache.shiro.cache.ehcache.EhCacheManager
securityManager.cacheManager = $cacheManager

It all started/worked fine.

HTH,

Cheers,

-- 
Les Hazlewood
CTO, Katasoft | http://www.katasoft.com | 888.391.5282
twitter: @lhazlewood | http://twitter.com/lhazlewood
katasoft blog: http://www.katasoft.com/blogs/lhazlewood
personal blog: http://leshazlewood.com