Announcement Announcement Module
Collapse
No announcement yet.
Spring Security NoSuchMethod error Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    I would suggest running spring security 3.1.x as you are using 3.1.x releases for the other spring libraries.

    Comment


    • #3
      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.

      Comment


      • #4
        Issue Solved !!!

        Hi,

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

        Comment


        • #5
          yes, its great!


          advance google place

          Comment

          Working...
          X