Thursday, July 22, 2010

Element 'bean' cannot have character [children], because the type's content type is element-only

Encountered this error yesterday and spend some time on figuring out what could be wrong with the config and later on comparision with the previous version found the bean definition had an additional '-' character.In the Spring context file ,if the bean definition needs any special characters ,it must be enclosed with the escape character else the forementioned exception is thrown.

6 comments:

  1. Thanks a lot this saved me 5 hours of work in my case it was '(' and ')'

    ReplyDelete
  2. i found out it was ',' in my xml which i believe i accidentally keyed tat in. Arigato

    ReplyDelete
  3. I just spent 3 hours figuring out that an invisible character in the text editor was causing this issue. Apparently it was not recognized as white space. Your post helped me focus in on it, thanks!

    ReplyDelete
  4. Yep, whitespace for me too!

    ReplyDelete