File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Application Frameworks and the fly likes [Spring 2.0.8/Security]  Error:  No bean named '' is defined Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "[Spring 2.0.8/Security]  Error:  No bean named Watch "[Spring 2.0.8/Security]  Error:  No bean named New topic
Author

[Spring 2.0.8/Security] Error: No bean named '' is defined

Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2053
Hi,

I tried to create a simple as possible application with spring security.

I have 3 html pages (secured.html,unsecured.html,and accessdenied.html - which I all put outside and same level of WEB-INF), and an xml to specify the security (springSecurity.xml at WEB-INF folder).

Functionality: I have one secured page (secured.html), which requires the specified role mentioned in springSecurity.xml. All implementations used are from spring (voters, authentication manager, etc.). In-memory dao authentication is used.

I am getting the error:
=======
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named '' is defined
=======
The entire error dump, and my spring and web.xml are below (the hmtls i made are simple htmls with one liners only).

(I am deploying on jboss 4.2.3. Some chunks of codes I used are from Spring in Action book.)

I will really appreciate any ideas.

The web.xml:



The springSecurity.xml:


The error dump:
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

You might not like my response.

But looking like you are starting to learn it, I recommend using the latest versions of Spring and Spring Security. It is so way much easier than what you had to do there. A lot less xml and typing and makes things, well again way much more easier

Look at the docs here

http://static.springframework.org/spring-security/site/reference/html/springsecurity.html

But in general all you need is the ProxyChainFilter. In the xml you use the security namespace so that you just have something like (I don't have it memorized, so this is missing the correct tags and attributes, but the basic concept is the same and easy)

Web.xml





OK, I cheated and went to the docs and copied that stuff from that url I posted above.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2053
Yes, I am tempted to do so, and use the latest versions.

I am doing this because I want to complete the book Spring in Action using the version it uses - Spring 2.0.x.

But I might as well use the latest versions if it wont confuse me; as the rest of the book would be referring to 2.0.x.

Is the difference merely on 'using annotations, instead of xml'?

However, if any knows what is wrong with my code here, please do let me know.
Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2053
Just want to share. I fixed it.

I used game* as my bean names. I properly named and wired them. And I got this error that I posted.

I changed them all to use the default bean names, and it is okay now:
for example:
instead of gameAuthenticationDao, I changed it to authenticationDao

I think that I wired them properly when using game*. But anyway, I will let this go for now.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Jesus Angeles wrote:
Is the difference merely on 'using annotations, instead of xml'?


No not at all, as you can see Spring Security is much different, it is much easier. The Spring in Action is a good book and most of the stuff is very valid today.

Mark
Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2053
For 2.0.x, Spring in Action is the best for a beginner.
 
 
subject: [Spring 2.0.8/Security] Error: No bean named '' is defined