I am getting the following error when attempting to navigate to the /connect endpoint of the spring social web module.
What I am getting:
[Request processing failed; nested exception is
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'scopedTarget.connectionRepository'
defined in ServletContext resource [/WEB-INF/appContext.xml]:
Initialization of bean failed; nested exception is
org.springframework.aop.framework.AopConfigException:
Could not generate CGLIB subclass of class
[class org.springframework.social.connect.jdbc.JdbcConnectionRepository]:
Common causes of this problem include using a final class or a non-visible class;
nested exception is java.lang.IllegalArgumentException:
Superclass has no null constructors but no arguments were given]
Relevant portions of web.xml:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/appContext.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value></param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
Relevant portion of appContext.xml:
<bean id="connectionFactoryLocator"
class="org.springframework.social.connect.support.ConnectionFactoryRegistry">
<property name="connectionFactories">
<list>
<bean class="org.springframework.social.facebook.connect.FacebookConnectionFactory">
<constructor-arg value="${facebook.clientId}" />
<constructor-arg value="${facebook.clientSecret}" />
</bean>
</list>
</property>
</bean>
<bean id="usersConnectionRepository"
class="org.springframework.social.connect.jdbc.JdbcUsersConnectionRepository">
<constructor-arg ref="dataSource" />
<constructor-arg ref="connectionFactoryLocator" />
<constructor-arg ref="textEncryptor" />
</bean>
<bean id="connectionRepository" factory-method="createConnectionRepository"
factory-bean="usersConnectionRepository" scope="request">
<constructor-arg value="#{request.userPrincipal.name}" />
<aop:scoped-proxy proxy-target-class="false" />
</bean>
Thank you for any responses.
I find this link useful https://github.com/socialsignin/socialsignin-showcase/issues/6, It solved my problem.
Basically in this case problem is with AOP proxy, for some reason CGLIB proxying not working in this case. so you have to turn it off and switch to JDK proxy. So what i did was just make this change in my context.xml -
<tx:annotation-driven transaction-manager="transactionManager"
proxy-target-class="true"/>
to
<tx:annotation-driven transaction-manager="transactionManager"
proxy-target-class="false"/>
By making proxy-target-class="false" spring will use JDK proxy (don't ask why i have no idea).
It's solved my problem.
But if it doesn't work for you, then also change this:
<security:global-method-security proxy-target-class="false" >
and this:
<bean id="connectionFactoryLocator" class="org.springframework.social.connect.support.ConnectionFactoryRegistry">
<property name="connectionFactories">
<list>
<bean class="org.springframework.social.facebook.connect.FacebookConnectionFactory">
<constructor-arg value="xxxxxxxxxxx" />
<constructor-arg value="xxxxxxxxxxxxxxxxxxxxxxxxxxx" />
</bean>
</list>
</property>
<aop:scoped-proxy proxy-target-class="false"/>
</bean>
Hope this helped. Happy coding :)
I had similar issue, however I didn't use any of xml configs, everything was autoconfigured by spring-boot.
Here is what I got trying to do a /connect/facebook:
There was an unexpected error (type=Internal Server Error,
status=500). Error creating bean with name
'scopedTarget.connectionRepository' defined in class path resource
[org/springframework/social/config/annotation/SocialConfiguration.class]:
Initialization of bean failed; nested exception is
org.springframework.aop.framework.AopConfigException: Could not
generate CGLIB subclass of class [class
org.springframework.social.connect.jdbc.JdbcConnectionRepository]:
Common causes of this problem include using a final class or a
non-visible class; nested exception is
org.springframework.cglib.core.CodeGenerationException:
java.lang.reflect.InvocationTargetException-->null
The root cause was having spring-boot-devtools in the classpath. Removing devtools solved the problem. I also found a PR opened by some guy, please leave a comment there to bring more attention to the issue.
pull request
Upd. the PR was merged and starting from 2.0.0.M1 there is no issue with dev-tools anymore.
there is two methods to slove this problem for springboot project:
removing spring-boot-debtools dependency.
setting spring.aop.proxy-target-class=false in your application.properties.
I know this post is very old, however, the exception
Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class ... brought me here.
The solution for me was a default constructor.
The solution for me was to remove final from class definition.
I got the same exception while using PreAuthorize annotation on some Rest Controllers.
The problem was that the controller classes where defined as final and it caused such error.
Related
I am having an error in my servlet-context.xml. It is saying that it can find the below classes but there actually exist in the projecct folder.
<beans:bean id="personDAO" class="com.springhibernatemvc.dao.PersonDAOImpl">
<beans:property name="sessionFactory" ref="hibernate4AnnotatedSessionFactory" />
</beans:bean>
<beans:bean id="personService" class="com.springbibernate.services.PersonServiceImpl">
<beans:property name="personDAO" ref="personDAO"></beans:property>
</beans:bean>
It is saying that this class is not found
- Class 'com.springbibernate.services.PersonServiceImpl'
My servlet-context file is also defined in my web.xml file
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
I have adding servlet-context.xml to the root folder of my web app but still the error exists.
Complete stacktrace
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0': Invocation of init method failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.springhibernatemvc.dao.PersonDAOImpl] for bean with name 'personDAO' defined in ServletContext resource [/WEB-INF/spring/appServlet/servlet-context.xml]; nested exception is java.lang.ClassNotFoundException: com.springhibernatemvc.dao.PersonDAOImpl
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.springhibernatemvc.dao.PersonDAOImpl] for bean with name 'personDAO' defined in ServletContext resource [/WEB-INF/spring/appServlet/servlet-context.xml]; nested exception is java.lang.ClassNotFoundException: com.springhibernatemvc.dao.PersonDAOImpl
What could be wrong?
from Java Docs
Thrown when an application tries to load in a class through its string name using:
The forName method in class Class.
The findSystemClass method in class ClassLoader .
The loadClass method in class ClassLoader.
but no definition for the class with the specified name could be found.
The problem here is not with the servlet-context.xml but the beans defined in there. make sure that the full cannonical class names are correct and respective class files are present under WEB-INF or some library under that .
From a first high level look it seems that you are defining bean with class as
'com.springbibernate.services.PersonServiceImpl'
where the correct name appears to be 'com.springhibernate.services.PersonServiceImpl'
So the xml content should be like :
<beans:bean id="personDAO" class="com.springhibernatemvc.dao.PersonDAOImpl">
<beans:property name="sessionFactory" ref="hibernate4AnnotatedSessionFactory" />
</beans:bean>
<beans:bean id="personService" class="com.springhibernate.services.PersonServiceImpl">
<beans:property name="personDAO" ref="personDAO"></beans:property>
</beans:bean>
Make an entry of the below tags in your spring-context xml file:
<context:annotation-config />
<context:component-scan base-package="com.springhibernate.services, com.springhibernatemvc.dao" />
if you are getting the java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
then, follow the below link:
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
I have created a spring-config.xml file.In that file I have created all beans for service class and DAO class.Now I want to call the bean in my Spring controller.The method I already know is
ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");
SeviceClassName objService = (SeviceClassName) context.getBean("BeanName");
But the problem is I have put the file in WEB-INF folder.
To metigate the problem I have used
ApplicationContext context = new FileSystemXmlApplicationContext("C:/Users/xyz/Desktop/HelloWeb/WebContent/WEB-INF/spring-config.xml");
It's working fine.
But it doesn't seem to be a good practise.
Then I have tried to initialize the DispatcherServlet by spring-config.xml.
<servlet>
<servlet-name>HelloWeb</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
But I don't konw how to call the bean in controller.
I tried to use #Autowired in my spring controller.But it is not working.
Whenever I try this (#Autowired) and try to excecute a jsp file of the same application in eclipse it shows 'requested resource not avaliable".
Can any one suggest me how to solve the problem.
Or
Can anyone suggest me a better approach by which I can invoke a bean of service class which I have created in spring-config.xml.
Or
any other approach for invoking service class methods in spring controller.
I am using spring 3.0.
I have created a Dynamic Web Project in Eclipse.In my WEB-INF folder I have put 4 xml file
--web.xml,spring-config.xml,HelloWeb-servlet.xml .
My HelloWeb-servlet contains
<mvc:annotation-driven />
<context:annotation-config />
<context:component-scan base-package="com.tutorialspoint" />
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="mediaTypes">
<map>
<entry key="html" value="text/html"/>
<entry key="json" value="application/json"/>
</map>
</property>
</bean>
<bean id="jacksonMessageConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"></bean>
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="messageConverters">
<list>
<ref bean="jacksonMessageConverter"/>
</list>
</property>
</bean>
My spring-config contains all the bean configuration.In the spring controller I just to invoke the service method which are written in the service class for which I have already created bean in spring-config.xml.
Check this Stackoverflow answer. It is probably a much more detailed answer than what you are looking for, but it will definitely help you go through the basics.
Essentially, a root context established via a Spring context loader listener, and a servlet context established via the corresponding servlet parameter. The param name for both are contextConfigLocation(former is a listener context-param and the latter is a servlet init-param).
#Autowired or #Inject can be used to inject the service bean in the controller. Make sure that the service bean is annotated with #Service or #Resource so the bean is picked up during component scanning.
I am quite new to Spring and Java world. I am trying to write a web app looking at petclinic application provided in the samples. However, I am hitting this roadblock since yesterday. It will be great if someone can point me in right direction. I looked up many links on google, but none of the solutions worked for me.
Here is the error root cause
org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [org.hibernate.SessionFactory] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:949)
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:818)
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:730)
org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:795)
org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:723)
org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1049)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:953)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:490)
.
.
.
Here is my web.xml in WEB-INF
<display-name>Game's List</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/applicationContext-hibernate.xml</param-value>
</context-param>
<session-config>
<session-timeout>10</session-timeout>
</session-config>
<servlet>
<servlet-name>gamelist</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>gamelist</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
Here is the applicationContext-hibernate.xml
<!-- ========================= RESOURCE DEFINITIONS ========================= -->
<!-- import the dataSource definition -->
<import resource="applicationContext-dataSource.xml"/>
<!-- Configurer that replaces ${...} placeholders with values from a properties file -->
<!-- (in this case, Hibernate-related settings for the sessionFactory definition below) -->
<context:property-placeholder location="classpath:jdbc.properties"/>
<context:annotation-config />
<!-- Hibernate SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
p:dataSource-ref="dataSource" p:mappingResources="gamelist-hibernate.xml">
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.generate_statistics">${hibernate.generate_statistics}</prop>
</props>
</property>
<property name="eventListeners">
<map>
<entry key="merge">
<bean class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener"/>
</entry>
</map>
</property>
</bean>
<!-- central data access object: Hibernate implementation -->
<bean id="gameDataStore" class="com.gamelist.datastore.GameItemDataStore"/>
<!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"
p:sessionFactory-ref="sessionFactory"/>
<!-- ========================= BUSINESS OBJECT DEFINITIONS ========================= -->
<!--
Activates various annotations to be detected in bean classes:
Spring's #Required and #Autowired, as well as JSR 250's #Resource.
-->
<context:annotation-config/>
<!--
Instruct Spring to perform declarative transaction management
automatically on annotated classes.
-->
<tx:annotation-driven/>
<!--
Exporter that exposes the Hibernate statistics service via JMX. Autodetects the
service MBean, using its bean name as JMX object name.
-->
<context:mbean-export/>
This is gamelist-servlet.xml
<context:component-scan base-package="com.gamelist"/>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/pages/"/>
<property name="suffix" value=".jsp"/>
</bean>
This is the controller class
public class GameLibraryController {
private IDataStore gameDataStore;
#Autowired
public GameLibraryController(GameItemDataStore gameDataStore){
this.gameDataStore = gameDataStore;
}
#RequestMapping("/addGame")
public String addNewGame(Model model){
model.addAttribute("gameItem",new GameItem());
return "library/addgameform";
}
#RequestMapping("/addGameSubmit")
public void add(#ModelAttribute GameItem gameItem,BindingResult result, SessionStatus status){
this.gameDataStore.add(gameItem);
status.setComplete();
}
}
This is the hibernate implementation class GameItemDataStore
#Repository
#Transactional
public class GameItemDataStore implements IDataStore{
private SessionFactory sessionFactory;
#Autowired
public GameItemDataStore(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
public void add(BaseItem newGame){
sessionFactory.getCurrentSession().save(newGame);
}
}
This is the IDataStore interface
public interface IDataStore {
public void add(BaseItem newGame);
}
To avoid any confusion, I am going to assume the configuration you mentioned in the question, and start from there. (Ignoring the changes you may have tried after reading the comments on your question)
First a little background:
There are two contexts at play in a Spring MVC application. The applicationContext which is more accurately referred to as the ROOT WebApplicationContext, which is meant to be available to all Servlet level spring contexts, through an integration with the Servlet Container's lifecycle implementation. The second type of context is loaded for each DispatcherServlet configured in the web.xml lets call it ServletApplicationContext
Now, when the container starts, the Root application context is loaded
When the Servlet is loaded, the Servlet Application Context is loaded. At this point, beans from the Root Application Context are available to the Servlet Application Context.
IF, you do end up loading the same bean definitions in both the contexts, its like overriding beans in the Servlet Context. Very inefficient to load duplicate beans, and can cause weird errors if you are relying on the same instance being available in all context. But, for simple cases like a single servlet deployment, this should not cause your application to break at startup, spring will deal with this.
Now getting to what's wrong with your configuration:
There is no ContextLoaderListener configured in your web.xml. Without a ContextLoaderListener, the ROOT application context is NOT loaded. So none of the beans from /WEB-INF/spring/applicationContext-hibernate.xml are loaded.
When your servlet kicks up, it loads the beans from gamelist-servlet.xml, and cannot locate a sessionFactory bean, because the ROOT Web Application Context was never loaded~!
To confirm this, for a test, comment out all bean definitions from the two context files, just keep empty <beans></beans> tags in them. Start your server, you'll see a log statement at the end that says something like no ROOT Web Application Context found, configure ContextLoaderListener in web.xml
And the fix:
Add the ContextLoaderListener to your web.xml
You may choose to continue your configuration as you have it now, or follow the advice given in earlier comments and include only MVC related definitions in the servlet context and all else in the ROOT application context.
Another, simpler option would be to simply have an empty application context xml for the ROOT Web Application Context, and configure all beans in the servlet context. This is not correct from a purist design point of view, but a practical simple solution, provided you plan on having a single servlet application.
Sorry for the looong description, but I felt some explanation was mandated. Hope this helps.
Get rid of
<bean id="gameDataStore" class="com.gamelist.datastore.GameItemDataStore"/>
which you won't need because of #Repository on your class and
<context:annotation-config />
which you have twice. Then add
<context:component-scan base-package="com.your.package" />
where com.your.package is a top level package that contains the GameItemDataStore class.
I'm using Spring Web Services to expose a service as a web service. In my spring configuration xml file, I have a bean which is an instance of DefaultWsdl11Definition. One of the properties that needs to be set is the locationUri. This needs to be a fully qualified Uri, but I don't want to have to change this value when the application gets promoted from dev to uat and to production. Spring knows what the web application context root is, so is there a variable that I can specify in my configuration file to access it?
Something like:
<bean id="myWebServices"
class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
<property name="schemaCollection">
<bean
class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
<property name="xsds" ref="xsdList"/>
<property name="inline" value="true" />
</bean>
</property>
<property name="portTypeName" value="myWebServices" />
<property name="locationUri" value="${webContextRoot}/webServices" />
</bean>
With Spring 3.0, you should be able to access the servlet context through the servletContext bean in the web application context:
<property name="locationUri" value="#{servletContext.contextPath}/webServices" />
If you're using pre-Spring-EL (before 3.0), you should be able to do
<bean name="servletContextBean" class="org.springframework.web.context.support.ServletContextFactoryBean" />
<bean name="contextPath" factory-bean="servletContextBean" factory-method="getContextPath" />
<bean name="locationUri" factory-bean="contextPath" factory-method="concat">
<constructor-arg value="/webServices" />
</bean>
and inside your myWebservices bean
<property name="locationUri" ref="locationUri" />
EDIT:
I don't think getting the server name and port from the ServletContext, as depending on the setup the web container may not know the hostname (i.e. a HTTP server may be in front of the web container, e.g. tomcat may be behind an Apache web server or depending on the Websphere configuration).
However, the following may be part of a solution to get the hostname. With Spring 3.0, you could do the following:
<property name="host"
class="java.net.InetAddress"
factory-method="getLocalHost"/>
<property name="locationUri"
value="http://#{host.canonicalHostName}:8080/#{servletContext.contextPath}/webServices" />
I had a similar problem that you described, I use property files to do this
ws_dev.properties
ws_prod.properties
I configured my property file like this, The deployment property is java vm argument like
-Ddeployment=dev
<context:property-placeholder location="ws_${deployment}.properties"/>
May be late, but may some other need a solution too:
set property in servlet:
web.xml
<servlet>
<servlet-name>spring-ws</servlet-name>
<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:/spring-ws-context.xml</param-value>
</init-param>
<init-param>
<param-name>transformWsdlLocations</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
The bean declaration in spring-ws-context.xml:
<bean id="WebService"
class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition"
p:portTypeName="App" p:locationUri="/WebServices" p:requestSuffix="Request"
p:responseSuffix="Response">
<property name="schema">
<bean class="org.springframework.xml.xsd.SimpleXsdSchema" p:xsd="classpath:/requestTypes.xsd" />
</property>
</bean>
You can add ApplicationContextAware interface to your bean, cast it to WebApplicationContext and then get ServletContext. Also see class org.springframework.web.context.ContextLoader
I'm working through Peter Mularien's Spring Security 3, and am having a problem setting up the UserDetailsManager.
I create the JdbcUserDetailsManager bean as follows:
<bean id="jdbcUserService" class="org.springframework.security.provisioning.JdbcUserDetailsManager">
<property name="dataSource" ref="mySqlDb" />
<property name="authenticationManager" ref="authenticationManager" />
</bean>
and autowire its UserDetailsManager interface in my controller like so:
#Autowired
public UserDetailsManager userDetailsManager;
When I start up the app to test it out, I get the following exception:
Error creating bean with name 'changePasswordController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.security.provisioning.UserDetailsManager com.ebisent.web.ChangePasswordController.userDetailsManager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [org.springframework.security.provisioning.UserDetailsManager] is defined: expected single matching bean but found 2: [org.springframework.security.provisioning.JdbcUserDetailsManager#0, jdbcUserService]
I searched through my project to see if I might have set up (Jdbc)UserDetailsManager elsewhere, but I don't appear to have done so. If I remove the "id" attribute in the bean definition, then the ambiguity is between JdbcUserDetailsManager#0 and JdbcUserDetailsManager#1.
My web.xml references app-config.xml in two places:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/spring/app-config.xml</param-value>
</context-param>
<servlet>
<servlet-name>dispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/spring/app-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
There was definitely a problem with specifying app-config.xml twice, but that's not the answer to the problem originally stated.
It appears that Spring autowires based on type. The bean is defined with the class JdbcUserDetailsManager, which implements UserDetailsManager.
In my controller, I am autowiring the interface UserDetailsManager. Spring finds the interface twice, and complains that it doesn't know which to pick.
Adding the #Qualifier annotation fixes the problem. Here's how it looks now:
#Autowired
#Qualifier("jdbcUserService") // <-- this references the bean id
public UserDetailsManager userDetailsManager;
Robert,
Yes. What your web.xml says is to create a web app context of app-config.xml pointing to a parent of app-config.xml. That means you have two copies of each bean - which as you've noticed is incorrect.
this seems to do the trick:
Comment the "jdbcUserService"
Insert:
<authentication-manager alias="authenticationManager">
<authentication-provider>
<jdbc-user-service data-source-ref="dataSource"/>
</authentication-provider>
</authentication-manager>
Create a datasource:
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost/secureApp"/>
<property name="username" value="root"/>
<property name="password" value="root"/>
</bean>
Create the nessecary config depending on witch datasource you are using (MySQL in this case). Create any additional config if you are using hibernate or jpa ...
Run the server.
I was able to reproduce this today. The database got updated with the changed password. It seems that the authentication-manager already instantiates a JdbcUserDetailsManager ??