This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Spring and the fly likes cvc-complex-type.2.3:Element 'beans' cannot have character [children] type's content type is element Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "cvc-complex-type.2.3:Element Watch "cvc-complex-type.2.3:Element New topic
Author

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

Satyajeet Kadam
Ranch Hand

Joined: Oct 19, 2006
Posts: 215
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

Joined: Oct 19, 2006
Posts: 215
PLease reply urgently. I tried to all possiable ways to run above program but still i am unable to run it?
Alaa Nassef
Ranch Hand

Joined: Jan 28, 2008
Posts: 460
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



  • Visit my blog: http://jnassef.blogspot.com/
    Satyajeet Kadam
    Ranch Hand

    Joined: Oct 19, 2006
    Posts: 215
    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

    Joined: Jan 28, 2008
    Posts: 460
    Well, I don't know a lot of AOP, so I can't help with that. Sorry
    Satyajeet Kadam
    Ranch Hand

    Joined: Oct 19, 2006
    Posts: 215
    Please any one can help me?
    Kuntal Mondal
    Greenhorn

    Joined: Nov 27, 2010
    Posts: 1
    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">
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: cvc-complex-type.2.3:Element 'beans' cannot have character [children] type's content type is element