Results 1 to 5 of 5

Thread: Spring Security NoSuchMethod error

  1. #1
    Join Date
    Jan 2012
    Posts
    22

    Question Spring Security NoSuchMethod error

    Hi,

    I am a beginner to spring security. I am working with a demo application and i got below problem.

    This is my web.xml
    Code:
            <listener>
    		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    	</listener>
    	<context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>
    			/WEB-INF/dispatcher-servlet.xml
    			/WEB-INF/security-app-context.xml
    		</param-value>
    	</context-param>
    	<!-- - Provides core MVC application controller. See bank-servlet.xml. -->
    	<servlet>
    		<servlet-name>bank</servlet-name>
    		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
    
    	<servlet-mapping>
    		<servlet-name>bank</servlet-name>
    		<url-pattern>*.html</url-pattern>
    	</servlet-mapping>
    
    	<!-- Spring Security -->
    
    	<filter>
    		<filter-name>springSecurityFilterChain</filter-name>
    		<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    	</filter>
    
    	<filter-mapping>
    		<filter-name>springSecurityFilterChain</filter-name>
    		<url-pattern>/*</url-pattern>
    	</filter-mapping>
    This is my security-app-context.xml
    Code:
    <http auto-config="true">
            <intercept-url pattern="/**" access="permitAll" />
            <form-login />
        </http>
    
        <authentication-manager>
            <authentication-provider>
                <user-service>
                    <user name="peter" password="peter" authorities="user" />
                </user-service>
            </authentication-provider>
        </authentication-manager>
    This is list of jars, those are in /WEB-INF/lib/ directory.
    • antlr-2.7.6
    • antlr-runtime-3.0
    • commons-collections-3.1
    • commons-logging-1.1-dev
    • jstl
    • jta-1.1
    • org.springframework.aop-3.1.0.RELEASE
    • org.springframework.asm-3.1.0.RELEASE
    • org.springframework.beans-3.1.0.RELEASE
    • org.springframework.context.support-3.1.0.RELEASE
    • org.springframework.context-3.1.0.RELEASE
    • org.springframework.core-3.1.0.RELEASE
    • org.springframework.expression-3.1.0.RELEASE
    • org.springframework.security.config-3.0.0.RELEASE
    • org.springframework.transaction-3.1.0.RELEASE
    • org.springframework.web.servlet-3.1.0.RELEASE
    • org.springframework.web-3.1.0.RELEASE
    • spring-security-aspects-3.0.7.RELEASE
    • spring-security-core-3.0.7.RELEASE
    • spring-security-web-3.0.7.RELEASE
    • standard



    When i run this application i got following error message.
    Code:
    
    Caused by: java.lang.NoSuchMethodError: org.springframework.security.core.userdetails.memory.UserMap.addUser(Lorg/springframework/security/core/userdetails/UserDetails;)V
    
    Please help.

  2. #2
    Join Date
    Nov 2006
    Location
    London, UK and Tallinn, Estonia
    Posts
    55

    Default

    I would suggest running spring security 3.1.x as you are using 3.1.x releases for the other spring libraries.
    Toby Hobson
    toby.hobson@cloudseal.com
    Single Sign on for Java - www.cloudseal.com
    Follow me on Twitter: tobyhobson

  3. #3
    Join Date
    Jan 2012
    Posts
    22

    Question

    Hi,

    Thanks for the reply. I have replaced jars as per your suggestion.
    Now i have following JARs in my classpath.

    • antlr-2.7.6
    • antlr-runtime-3.0
    • commons-collections-3.1
    • commons-logging-1.1-dev
    • jstl
    • jta-1.1
    • org.springframework.aop-3.1.0.RELEASE
    • org.springframework.asm-3.1.0.RELEASE
    • org.springframework.beans-3.1.0.RELEASE
    • org.springframework.context.support-3.1.0.RELEASE
    • org.springframework.context-3.1.0.RELEASE
    • org.springframework.core-3.1.0.RELEASE
    • org.springframework.expression-3.1.0.RELEASE
    • org.springframework.security.config-3.0.0.RELEASE
    • org.springframework.transaction-3.1.0.RELEASE
    • org.springframework.web.servlet-3.1.0.RELEASE
    • org.springframework.web-3.1.0.RELEASE
    • spring-security-aspects-3.1.0.RELEASE
    • spring-security-config-3.1.0.RELEASE
    • spring-security-core-3.1.0.RELEASE
    • spring-security-web-3.1.0.RELEASE
    • standard


    The previous error was solved but now i am stuck in another error.
    Code:
    
    java.lang.NoClassDefFoundError: org/springframework/security/web/util/AntUrlPathMatcher
    
    I googled for this error and found that this class is available in 3.0.7 version.

    Please help.

  4. #4
    Join Date
    Jan 2012
    Posts
    22

    Thumbs up Issue Solved !!!

    Hi,

    I just replaced my all the Spring and Spring Security JARs with older version 3.0.X. and it worked.

  5. #5
    Join Date
    Feb 2012
    Posts
    1

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •