Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Jesus Angeles
Ranch Hand
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jesus Angeles
Ranch Hand
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For 2.0.x, Spring in Action is the best for a beginner.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic