This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
I am working on Spring application and i run the example "Spring Security 3 - MVC: Using a Simple User-Service Tutorial" given by KRAMS.
When i run the application, it is throughing the error as follows
Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 11 in XML document from ServletContext resource [/WEB-INF/spring-security.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'security:http'.
You will have to post your config file. It could be a number of reasons. Do you have the security namespace set up in the top portion of the xml. Is it pointing to the correct version of the .xsd that is in your classpath in the Spring Security jar?
<!-- Declare an authentication-manager to use a custom userDetailsService -->
<!-- Use a Md5 encoder since the user's passwords are stored as Md5 in the database -->
<bean class="org.springframework.security.authentication.encoding.Md5PasswordEncoder" id="passwordEncoder"/>
<!-- An in-memory list of users. No need to access an external database layer.
See Spring Security 3.1 Reference 5.2.1 In-Memory Authentication -->
<!-- john's password is admin, while jane;s password is user -->
<security:user name="john" password="21232f297a57a5a743894a0e4a801fc3" authorities="ROLE_USER, ROLE_ADMIN" />
<security:user name="jane" password="ee11cbb19052e40b07aac0ca060c23ee" authorities="ROLE_USER" />
<!-- Activates various annotations to be detected in bean classes -->
<!-- Scans the classpath for annotated components that will be auto-registered as Spring beans.
For example @Controller and @Service. Make sure to set the correct base-package-->
<context:component-scan base-package="org.krams.tutorial" />
<!-- Configures the annotation-driven Spring MVC Controller programming model.
Note that, with Spring 3.0, this tag works in Servlet MVC only! -->
I don't see anything jumping out at me as incorrect with the spring-security.xml you posted (although its hard to read unformatted and without code tags). You said that you got this from an online tutorial? Did you copy and paste this off of the web page? Some times C+P code or configuration off of a web page can cause weird issues. Try typing that up in a new file and see if your problem goes away.