Satyadev Satyadev - 1 year ago 211
Java Question

Invalid content was found starting with element 'authentication-manager'

I get error with spring configuration:

Invalid content was found starting with element 'authentication-manager'. One of '{"":import, "":alias, "":bean, WC[##other:""]}' is expected.

Here is the bean xml file:

<beans xmlns=""
xmlns:mvc="" xmlns:xsi=""

<context:component-scan base-package="com.rsc."/>
<mvc:annotation-driven />

<authentication-manager alias="authenticationManager">
<authentication-provider user-service-ref="userDetailsServiceImpl">
<password-encoder ref="encoder"></password-encoder>

<bean id="userDetailsServiceImpl" class="com.rsc.service.UserDetailsServiceImpl"></bean>

<bean id="encoder" class="">
<constructor-arg name="strength" value="11"/>

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".jsp"/>

I have added all the required bean configuration but still I am getting error. What I am i missing in the configuration?

Answer Source

I think you need to add the spring security namespace.

<beans xmlns=""
   xsi:schemaLocation="  ">





since beans is your default namespace spring tries to find the authentication-manager there. Therefore you need to introduce the security namespace. See the documentation for further information:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download