• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

cvc-complex-type.2.3:Element 'beans' cannot have character [children] type's content type is element

 
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am unable to run the source code for AOP. I am using spring framework 3.0.This code is from the book "Spring in Simple steps". I am getting error as:



Source code

beans.xml




Main.java




Asp.java




Code.java



Q1) Is there any problem in beans.xml?
 
Satyajeet Kadam
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
PLease reply urgently. I tried to all possiable ways to run above program but still i am unable to run it?
 
Ranch Hand
Posts: 471
Mac OS X Hibernate Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, it seems fine to me, but there must be something wrong with it, since this is the meaning of the exception. The meaning of the exception is that the XML, somewhere between the opening and the closing of the beans element, there are some text written, which is not enclosed in an element. Please make sure that this is not in the XML file being parsed, and if you have copied any part of the XML (no matter how small) from somewhere, make sure that every character is correct (sometimes double quotes are writted differently in PDFs for example). Finally, I have a few comments, but don't know if they have any value for your case.
  • Line 15 of your XML has a double slash instead of one (this might cause a problem)
  • Line 17 of your XML can be written as <aop:aspectj-autoproxy/> instead of <aop:aspectj-autoproxy></aop:aspectj-autoproxy>
  • No need to define bean for Main class in line 20 of your XML[/tt]
  • Use the following snippet to load the application context instead of what you have in line 11


  •  
    Satyajeet Kadam
    Ranch Hand
    Posts: 224
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks for your reply Alaa Nassef.

    To Run this program i included:
    1) aopalliance. jar in classpath
    2)i commented the first line



    Now Output of the program is simply Hello World.



    Excepted Output is



    Q1) Why actual output is different from expected output?Why "Hello from @Before Annotation in Aspectj" and "Hello from @AfterReturning Annotation in Aspectj" is not getting printed in console?Please refer above program for more details.


     
    Alaa Nassef
    Ranch Hand
    Posts: 471
    Mac OS X Hibernate Spring
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Well, I don't know a lot of AOP, so I can't help with that. Sorry
     
    Satyajeet Kadam
    Ranch Hand
    Posts: 224
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Please any one can help me?
     
    Greenhorn
    Posts: 1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I know it is kind of late - but your "beans.xml" file has a syntax problem - there is an extra ">" at the following line !!!

    http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
    reply
      Bookmark Topic Watch Topic
    • New Topic