0

zk 6.0.1 and Spring Security 3.0.7 problem - can't find org/springframework/security/util/UrlMatcher

asked 2012-08-01 03:59:39 +0800

parlante gravatar image parlante
48

I updated my project to ZK 6.0.1 and Spring / Spring Security 3.0.7.

I did not update to Spring Security 3.1 because of the known issues with ZK. However, with Spring Security 3.0.7 I'm getting the exception during start up that org.springframework.security.util.UrlMatcher can't be found. The problem is the path is org.springframework.security.web.util.UriMatcher. For some reason it isn't looking in the right place as the web package is missing.

The exception occurs when parsing my applicationContext-security.xml file. Any help is really appreciated. I can't figure this one out.

Here is the top of applicationContext-security.xml and the exception.

applicationContext-security.xml

<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:zksp="http://www.zkoss.org/2008/zkspring"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.zkoss.org/2008/zkspring
http://www.zkoss.org/2008/zkspring/zkspring.xsd
http://www.zkoss.org/2008/zkspring/core
http://www.zkoss.org/2008/zkspring/core/zkspring-core.xsd
...

Exception

2012-07-31 20:41:41,740 ERROR ContextLoader(227): Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [applicationContext-security.xml]; nested exception is org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [org.zkoss.spring.config.ZkSpringNamespaceHandler] for namespace [http://www.zkoss.org/2008/zkspring]: problem with handler class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/springframework/security/util/UrlMatcher
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
...


http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2012-08-01 07:04:11 +0800

hawk gravatar image hawk
3250 1 5
http://hawkphoenix.blogsp... ZK Team

Hi,
if you use zkspring 3.0 or 3.1, XML namespace should be

    xmlns:zksp="http://www.zkoss.org/2008/zkspring/security"
    xsi:schemaLocation="http://www.zkoss.org/2008/zkspring/security http://www.zkoss.org/2008/zkspring/security/zkspring-security.xsd"

link publish delete flag offensive edit

answered 2012-08-01 14:14:06 +0800

parlante gravatar image parlante
48

Hi Hawk,

Thanks for the feedback.

I tried your suggestion and get the following exception. It can't find the namespace http://www.zkoss.org/2008/zkspring/security

Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.zkoss.org/2008/zkspring/security]
Offending resource: class path resource [applicationContext-security.xml]

Here is my complete applicatoinContext-security.xml. It's such a small file I figured I'd post it and hopefully somebody can see an obvious thing. Thanks in advanced for any help.

<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:zksp="http://www.zkoss.org/2008/zkspring/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.zkoss.org/2008/zkspring/security
http://www.zkoss.org/2008/zkspring/security/zkspring-security.xsd
http://www.zkoss.org/2008/zkspring
http://www.zkoss.org/2008/zkspring/zkspring.xsd
http://www.zkoss.org/2008/zkspring/core
http://www.zkoss.org/2008/zkspring/core/zkspring-core.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.0.xsd">

<!-- Enable the @Secured annotation to secure service layer methods. -->
<global-method-security secured-annotations="enabled" />

<!-- Secure the pages using the URL pattern. -->
<http auto-config="true" use-expressions="true" access-denied-page="/authentication/denied.zul" >

<intercept-url pattern="/authentication/login.zul" access="permitAll"/>
<intercept-url pattern="/administration" access="hasRole('ROLE_ADMIN')"/>
<intercept-url pattern="/parlante/main/common" access="hasRole('ROLE_USER')"/>

<form-login
login-page="/authentication/login.zul"
authentication-failure-url="/authentication/login.zul?error=true"
default-target-url="/parlante/main/common"/>

<logout
invalidate-session="true"
logout-success-url="/authentication/login.zul"
logout-url="/authentication/logout.zul"/>

</http>

<!-- Declare an authentication-manager to use a custom userDetailsService. -->
<authentication-manager>
<authentication-provider user-service-ref="customUserDetailsService">
<password-encoder ref="passwordEncoder"/>
</authentication-provider>
</authentication-manager>

<!-- Use a Md5 encoder since the user's passwords are stored as Md5 in the database. -->
<beans:bean id="passwordEncoder" class="org.springframework.security.authentication.encoding.Md5PasswordEncoder"/>

<!-- A custom service where Spring will retrieve users and their corresponding access levels. -->
<beans:bean id="customUserDetailsService" class="com.tickertrack.service.BaseUserDetailService"/>

<!-- Secure the ZK event processing per the event name and ZK component path pattern. -->
<zksp:zk-event login-template-close-delay="5">
<zksp:intercept-event event="onClick" path="//*/header/login" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
<zksp:intercept-event event="onClick" path="//*/header/register" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
<zksp:intercept-event event="onClick" path="//*/register/save" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
<zksp:intercept-event event="onClick" path="//*/register/cancel" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
<zksp:intercept-event event="onClick" path="//*/login/*" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
<zksp:intercept-event event="onClick" path="/**" access="ROLE_ADMIN, ROLE_USER"/>
<zksp:intercept-event path="/**" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
</zksp:zk-event>
</beans:beans>

link publish delete flag offensive edit

answered 2012-08-01 14:32:07 +0800

parlante gravatar image parlante
48

I got it.

I totally overlooked the most obvious thing. Upgrading the actual ZK security library. The namespace you posted Hawk works like a charm once I did this. Thanks.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-08-01 03:59:39 +0800

Seen: 262 times

Last updated: Aug 01 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More