File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Spring and the fly likes Integrating Spring & JDBC into JSF2 login page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Integrating Spring & JDBC into JSF2 login page" Watch "Integrating Spring & JDBC into JSF2 login page" New topic

Integrating Spring & JDBC into JSF2 login page

Lyubomir Tsvetanov

Joined: Aug 21, 2011
Posts: 2
I've used a properly running example project (documentation) to create a simple JSF login page working with Spring Security on Tomcat 7 using Eclipse. The above example stores usernames, passwords and roles in applicationContext-security.xml in the following format:

I want to modify it so that I can use authentication database through JDBC. After making a simple modification, I am no longer able to access my project on the server (404) due to an error (Eclipse does not provide details, or maybe I don't know where to look). Could you please give me some suggestions on what might be going wrong? I'm not quite sure whether it is Spring or Eclipse/Tomcat issue... Thanks.

Below is a complete copy of my updated applicationContext-security.xml:

Lyubomir Tsvetanov

Joined: Aug 21, 2011
Posts: 2
The problem is solved! I had to remove this:

As it created more than one instance of userDetailsService, which caused the error.
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276


<jdbc-user-service data-source-ref="dataSource"/>

<beans:bean id="userDetailsService" class="">
<beans:property name="dataSource" ref="dataSource"/>

are both identical beans. However, while there are two UserDetailsService implementations as beans, the Authentication Manager will only use one of them. In my xml at a company I worked at, we had two UserDetailsService implementations as beans and it worked fine. Anyway….

Nice that your resolved it and I apologize that when I looked at your post the other day I didn't give it enough time to really look at it and find your issue for you quicker.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: Integrating Spring & JDBC into JSF2 login page
It's not a secret anymore!