[ 
https://issues.apache.org/jira/browse/SHIRO-389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13542125#comment-13542125
 ] 

Mladen Marev edited comment on SHIRO-389 at 1/3/13 9:37 AM:
------------------------------------------------------------

We need that, because we will be able to run with ehcache configured manager 
from shiro.ini and without.
If application needs it, it has to add it to OSGi runtime and modify 
configuration file. Because it is optional it will be loaded only if available.
If application does not need shiro-ehcache it just does not add shiro-ehcache 
bundle to OSGi environment and optional import does not break shiro-core from 
starting up and initialize successfully.
If you use shiro-ehcache and you do not have the import, then initialization 
fails even if the bundle is available in the OSGi runtime, because classloader 
does not see the class located in shiro-ehcache bundle.
So to summarize it is needed as optional, because shiro-core bundle class 
loader does not know at startup if ehcache is needed or not. It knows it later 
(after startup) when it reads configuration file.
You say shiro-core has no dependency on shiro-ehcache.
You can try this configuration in OSGi environment (example is taken from shiro 
documentation on session management):
[main]
cacheManager = org.apache.shiro.cache.ehcache.EhCacheManager
securityManager.cacheManager = $cacheManager

You will see, how ClassNotFoundException is thrown on initialization even if 
shiro-ehcache bundle is available and loaded in the OSGi runtime.
I hope this info is enough.

P.S. You might also consider other optional import packages also if they can be 
configured to be loaded on initialization from shiro.ini
                
      was (Author: mdmarev):
    We need that, because we will be able to run with ehcache configured 
manager from shiro.ini and without.
If application needs it, it has to add it to OSGi runtime and modify 
configuration file. Because it is optional it will be loaded only if available.
If application does not need shiro-ehcache it just does not add shiro-ehcache 
bundle to OSGi environment and optional import does not break shiro-core from 
starting up and initialize successfully.
If you use shiro-ehcache and you do not have the import, then initialization 
fails even if the bundle is available in the OSGi runtime, because classloader 
does not see the class located in shiro-ehcache bundle.
So to summarize it is needed as optional, because shiro-core bundle class 
loader does not know at startup if ehcache is needed or not. It knows it later 
(after startup) when it reads configuration file.
You say shiro-core has no dependency on shiro-ehcache.
You can try this configuration in OSGi environment (example is taken from shiro 
documentation on session management):
[main]
cacheManager = org.apache.shiro.cache.ehcache.EhCacheManager
securityManager.cacheManager = $cacheManager

You will see, how ClassNotFoundException is thrown on initialization even if 
shiro-ehcache bundle is available and loaded in the OSGi runtime.
I hope this info is enough.
                  
> Fix OSGI Exports for shiro-ehcache
> ----------------------------------
>
>                 Key: SHIRO-389
>                 URL: https://issues.apache.org/jira/browse/SHIRO-389
>             Project: Shiro
>          Issue Type: Bug
>          Components: Caching 
>    Affects Versions: 1.2.0, 1.2.1
>            Reporter: Chris Geer
>            Assignee: Les Hazlewood
>             Fix For: 1.2.2, 1.3.0
>
>         Attachments: SHIRO_389_core.patch, SHIRO-389.patch
>
>
> Currently the osgi-export in the pom file is org.apache.shiro.ehcache which 
> isn't a valid package. It should be changed to org.apache.shiro.cache.ehcache

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to