Hi Les,

Thanks for the quick response.

Removing the [main] header made no difference. At the moment there is no 
auto-population of web.xml happening in the build process. I’ve checked the 
built artefact and formatting/line breaks look the same as in the original 
source file (and the ini file I was working with previously).

Embedded config is:

<param-name>config</param-name>
<param-value>
[main]
customRealm = uk.co.blah.security.shiro.realm.CustomRealm
simpleMatcher = org.apache.shiro.authc.credential.SimpleCredentialsMatcher
customRealm.credentialsMatcher = $simpleMatcher
securityManager.sessionManager.globalSessionTimeout = 1800000
</param-value>

Regards,

Martin.


From: [email protected] [mailto:[email protected]] On Behalf 
Of Les Hazlewood
Sent: 20 July 2011 17:16
To: [email protected]
Subject: Re: Different classpaths for .ini and web.xml config?


Hi Martin,

There aren't any classloading differences between the two mechanisms.  It seems 
as if the embedded config is getting mixed up - can you share it at?

Based on what I see below, it appears as if the [main] section isn't being 
parsed properly, but without seeing the config, it is hard to tell.  You might 
try removing the [main] section header itself and see what happens (the 
IniSecurityManagerFactory assumes the first bit of text to appear is the main 
section if not explicitly defined).

It also may be a line break issue.  Based on the exception messages, it appears 
as if the [main] section header is being interpreted as an object definition 
itself.  Might the web.xml nested config be auto-poulated based on a build 
process, and it isn't preserving the Ini formatting?

Regards,

Les
On Jul 20, 2011 8:08 AM, "Martin Dixon" 
<[email protected]<mailto:[email protected]>> wrote:
>
> Just getting to grips with Shiro and come across behaviour I can't find 
> explained in the documentation anywhere.
>
> I have authentication and permission checking working fine in an app using 
> basic ini configuration approach - new 
> IniSecurityManagerFactory("classpath:shiro.ini")
>
> When I try using exactly the same config with DefaultWebSecurityManager and 
> instead of using an ini file put the config (realm & credentials matcher) 
> within web.xml IniShiroFilter definition (using inline init-param config), 
> deployment fails with the error below.
>
> Are there any differences in the class loading for the 2 config approaches?
>
> Thanks,
>
> Martin.
>
>
> 15:37:41,431 ERROR [STDERR] 12 [Thread-2] ERROR 
> org.apache.shiro.web.servlet.AbstractFilter - Unable to start Filter: [Unable 
> to instantiate class [customRealm = 
> uk.co.blah.security.shiro.realm.CustomRealm simpleMatcher = 
> org.apache.shiro.authc.credential.SimpleCredentialsMatcher 
> customRealm.credentialsMatcher = $simpleMatcher 
> securityManager.sessionManager.globalSessionTimeout = 1800000] for object 
> named '[main]'. Please ensure you've specified the fully qualified class name 
> correctly.].
> 15:37:41,433 ERROR [STDERR] org.apache.shiro.config.ConfigurationException: 
> Unable to instantiate class [customRealm = uk.co.blah.security.shiro
> .realm.CustomRealm simpleMatcher = 
> org.apache.shiro.authc.credential.SimpleCredentialsMatcher 
> customRealm.credentials
> Matcher = $simpleMatcher securityManager.sessionManager.globalSessionTimeout 
> = 1800000] for object named '[main]'. Please ensure you've specified the
> fully qualified class name correctly.
> 15:37:41,437 ERROR [STDERR] at 
> org.apache.shiro.config.ReflectionBuilder.createNewInstance(ReflectionBuilder.java:143)
> 15:37:41,437 ERROR [STDERR] at 
> org.apache.shiro.config.ReflectionBuilder.buildObjects(ReflectionBuilder.java:114)
> 15:37:41,438 ERROR [STDERR] at 
> org.apache.shiro.config.IniSecurityManagerFactory.buildInstances(IniSecurityManagerFactory.java:170)
> 15:37:41,439 ERROR [STDERR] at 
> org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:119)
> 15:37:41,440 ERROR [STDERR] at 
> org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:97)
> 15:37:41,441 ERROR [STDERR] at 
> org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:83)
> 15:37:41,442 ERROR [STDERR] at 
> org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:41)
> 15:37:41,443 ERROR [STDERR] at 
> org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:123)
> 15:37:41,444 ERROR [STDERR] at 
> org.apache.shiro.util.AbstractFactory.getInstance(AbstractFactory.java:47)
> 15:37:41,445 ERROR [STDERR] at 
> org.apache.shiro.web.servlet.IniShiroFilter.applySecurityManager(IniShiroFilter.java:353)
> 15:37:41,446 ERROR [STDERR] at 
> org.apache.shiro.web.servlet.IniShiroFilter.configure(IniShiroFilter.java:321)
> 15:37:41,447 ERROR [STDERR] at 
> org.apache.shiro.web.servlet.IniShiroFilter.init(IniShiroFilter.java:292)
> 15:37:41,447 ERROR [STDERR] at 
> org.apache.shiro.web.servlet.AbstractShiroFilter.onFilterConfigSet(AbstractShiroFilter.java:83)
> 15:37:41,448 ERROR [STDERR] at 
> org.apache.shiro.web.servlet.AbstractFilter.init(AbstractFilter.java:94)
> 15:37:41,449 ERROR [STDERR] at 
> org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:447)
> 15:37:41,450 ERROR [STDERR] at 
> org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3246)
> 15:37:41,451 ERROR [STDERR] at 
> org.apache.catalina.core.StandardContext.start(StandardContext.java:3843)
> 15:37:41,452 ERROR [STDERR] at 
> org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:294)
> 15:37:41,453 ERROR [STDERR] at 
> org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:146)
> 15:37:41,454 ERROR [STDERR] at 
> org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:477)
> 15:37:41,455 ERROR [STDERR] at 
> org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
> 15:37:41,455 ERROR [STDERR] at 
> org.jboss.web.deployers.WebModule.start(WebModule.java:95)
> ...
>

Reply via email to