Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring-Security 3.1 java.lang.ClassNotFoundException: org.springframework.security.taglibs.authz.AuthorizeTag

I just upgraded from Spring Security 3.0.5 to 3.1.0.RC3

Now, the following JSP code gives me java.lang.ClassNotFoundException: org.springframework.security.taglibs.authz.AuthorizeTag

<security:authorize access="not hasRole('ROLE_ANONYMOUS')">
Welcome <%= request.getUserPrincipal().getName() %>
</security:authorize>

I look at the Spring Security Reference Documentation 3.1 and it looks like the <security:authorize> tag should work. However when I look at the directory org.springframework.security.taglibs.authz in spring-security-taglibs-3.1.0.RC3.jar I cannot see any AuthorizeTag.class there.

What is wrong here?

Thanks!

like image 694
rapt Avatar asked Oct 06 '11 17:10

rapt


3 Answers

I found that Tomcat might cache the old security.tld, even the spring security library are all 3.1 version. Delete the Tomcat work directory and restart it would works fine now.

like image 168
Simon Avatar answered Oct 13 '22 23:10

Simon


I guess you have an old security.tld file somewhere. Make sure that you haven't copied it into your WEB-INF and that you don't have any old Spring Security jars in your classpath.

like image 33
axtavt Avatar answered Oct 13 '22 22:10

axtavt


it is renamed to JspAuthorizeTag

(org.springframework.security.taglibs.authz.JspAuthorizeTag)

like image 36
aki Avatar answered Oct 13 '22 21:10

aki