You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by snake0zero <sn...@hotmail.com> on 2014/06/16 12:00:05 UTC

About using shiro's cacheManager with ehcache in servicemix

Hi,

I need to use org.apache.servicemix.bundles.ehcache as shiro's cacheManager,
but when i login my account,

it always occurs[net.sf.ehcache.CacheException:
java.lang.ClassNotFoundException: org.apache.shiro.session.mgt.SimpleSession
not found by org.apache.servicemix.bundles.ehcache [172]]

it seems that org.apache.servicemix.bundles.ehcache bundle can not load
shiro's SimpleSession class.

In my bundle, my shiro configuration is like below:

   <bean id="securityManager"
class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
      <property name="realm" ref="simpleRealm" />
      <property name="sessionManager" ref="defaultWebSessionManager"/>
      <property name="cacheManager" ref="cacheManager" />
   </bean>

   <bean id="cacheManager"
class="org.apache.shiro.cache.ehcache.EhCacheManager">
       <property name="cacheManager" ref="ehCacheManager"/>
       <property name="cacheManagerConfigFile" value="classpath:ehcache.xml"
/>
   </bean>
   <bean id="ehCacheManager" class="net.sf.ehcache.CacheManager" />

How should i do to solve this issue? Does it need me to export shiro's
related package.

your reply is very appreciated.

Thanks and Best regards.

Joseph.




--
View this message in context: http://servicemix.396122.n5.nabble.com/About-using-shiro-s-cacheManager-with-ehcache-in-servicemix-tp5720893.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: About using shiro's cacheManager with ehcache in servicemix

Posted by Wim Verreydt <wi...@anova.be>.
Hi Joseph,

It seems to me that this class is not available in the ehcache bundle's classloader This is normal as this only has/imports classes necessary for ehcache.

Normally you would pass along your own bundle’s classloader to the ehcache instance so it can find the class definitions there. But after a quick look at the ehcache api and code I wasn’t able to find a way to do this.

An dirty workaround is to enable dynamic-imports on the ehcache bundle. The ehcache’s classlouder is then able to find alle exported classes trough the entire container.
This can be done with the dev:dynamic-import <bundle id> command.

Please notify us if only this last solution was a possible workaround. In that case we might have to add the dynamic imports option permanently to the ehcache bundle.

Good luck!

Wim


On 16 Jun 2014, at 12:00, snake0zero <sn...@hotmail.com> wrote:

> Hi,
> 
> I need to use org.apache.servicemix.bundles.ehcache as shiro's cacheManager,
> but when i login my account,
> 
> it always occurs[net.sf.ehcache.CacheException:
> java.lang.ClassNotFoundException: org.apache.shiro.session.mgt.SimpleSession
> not found by org.apache.servicemix.bundles.ehcache [172]]
> 
> it seems that org.apache.servicemix.bundles.ehcache bundle can not load
> shiro's SimpleSession class.
> 
> In my bundle, my shiro configuration is like below:
> 
>   <bean id="securityManager"
> class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
>      <property name="realm" ref="simpleRealm" />
>      <property name="sessionManager" ref="defaultWebSessionManager"/>
>      <property name="cacheManager" ref="cacheManager" />
>   </bean>
> 
>   <bean id="cacheManager"
> class="org.apache.shiro.cache.ehcache.EhCacheManager">
>       <property name="cacheManager" ref="ehCacheManager"/>
>       <property name="cacheManagerConfigFile" value="classpath:ehcache.xml"
> />
>   </bean>
>   <bean id="ehCacheManager" class="net.sf.ehcache.CacheManager" />
> 
> How should i do to solve this issue? Does it need me to export shiro's
> related package.
> 
> your reply is very appreciated.
> 
> Thanks and Best regards.
> 
> Joseph.
> 
> 
> 
> 
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/About-using-shiro-s-cacheManager-with-ehcache-in-servicemix-tp5720893.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.