Monday, April 13, 2015

How to resolve "A schema cannot contain two global components with the same name"?

When I have a project using spring-data-cassandra, the XML configuration applicationContext.xml's header looks like below.


...

Eclipse always complains the following errors:

Referenced file contains errors (http://www.springframework.org/schema/beans/spring-beans.xsd).  For more information, right click on the message in the Problems View and select "Show Details..."
Referenced file contains errors (http://www.springframework.org/schema/tool/spring-tool.xsd).  For more information, right click on the message in the Problems View and select "Show Details..."

The details are shown as below.

The errors below were detected when validating the file "spring-beans.xsd" via the file "applicationContext.xml".  In most cases these errors can be detected by validating "spring-beans.xsd" directly.  However it is possible that errors will only occur when spring-beans.xsd is validated in the context of applicationContext.xml.

sch-props-correct.2: A schema cannot contain two global components with the same name; this schema contains two occurrences of 'http://www.springframwork.org/schema/beans,identifiedType'. line 43
...

The problem is caused, I believe, by the version in different XSDs. For example, spring-context.xsd imports spring-beans.xsd and spring-tools.xsd, and always uses the links with a version like this: http://www.springframework.org/schema/beans/spring-beans-4.1.xsd.




...

But spring-cassandra.xsd imports XSDs without version.




 
...

If you download the following xsd, spring-beans, spring-tool, spring-cassandra, spring-context and spring-repository, and change all schemaLocations to point a local file like "file:///tmp/spring-beans.xsd", the validation errors will be gone.

This is really annoying when you see red X. Here are my suggestions:

  • remove xsi:schemaLocation in your applicationContext.xml, there will be a warning like "No grammar"
  • Window->Preferences->XML->XMl Files->Validation->uncheck "Honor all XML schema locations"

36 comments:

  1. this was an annoying error for me as well - thanks for providing this fix!

    ReplyDelete
  2. Thank you for another great article. Where else could anyone get that kind of information in such a perfect way of writing? I have a presentation next week, and I am on the look for such information.

    Cassandra Training Courses


    ReplyDelete
  3. i cant say how much i am thankful for you.

    ReplyDelete

  4. I am facing the same situation but in my case there is not hibernate-context.xml. Could you give some details about how did you debug the problem ? Selenium Training in Bangalore

    Python Training in Bangalore

    ReplyDelete
  5. Technology is new tool in all service sectors. I am working in health care sector with Top Hospitals in Hyderabad but I am very much interested in technology and its developments.

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. You have done very well its really helpful post for skinny head . if you are not satisfy to other .you can check this link and get your dental treatments. Bariatric Surgery in Hyderabad

    ReplyDelete
  8. Thanks for the informative article. This is one of the best resources I have found in quite some time. Nicely written and great info. I really cannot thank you enough for sharing.
    python training in omr

    python training in annanagar | python training in chennai

    python training in marathahalli | python training in btm layout

    python training in rajaji nagar | python training in jayanagar

    ReplyDelete
  9. Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.

    angularjs Training in chennai
    angularjs Training in chennai

    angularjs-Training in tambaram

    angularjs-Training in sholinganallur

    angularjs-Training in velachery

    ReplyDelete
  10. You are doing a great job. I would like to appreciate your work. clearly explained
    Regards
    Best Machine Learning Training in Chennai

    ReplyDelete
  11. Awesome article. It is so detailed and well formatted that i enjoyed reading it as well as get some new information too.

    angularjs online training

    apache spark online training

    informatica mdm online training

    devops online training

    aws online training

    ReplyDelete
  12. Excellent Blog. I really want to admire the quality of this post. I like the way of your presentation of ideas, views and valuable content. No doubt you are doing great work. I’ll be waiting for your next post. Thanks .Keep it up! Are you interested to buy luxury boxes... then click here Wallet Box | Perfume Box Manufacturer
    Candle Packaging Boxes
    Luxury Leather Box | Luxury Clothes Box
    Luxury Cosmetics Box | Shoe Box Manufacturer | Luxury Watch Box

    ReplyDelete
  13. Wow, what an awesome spot to spend hours and hours! It's beautiful and I'm also surprised that you had it all to yourselves!
    Kindly visit us @ Best HIV Treatment in India | Top HIV Hospital in India
    HIV AIDS Treatment in Mumbai | HIV Specialist in Bangalore
    HIV Positive Treatment in India | Medicine for AIDS in India

    ReplyDelete
  14. I learned World's Trending Technology from certified experts for free of cost. I Got a job in decent Top MNC Company with handsome 14 LPA salary, I have learned the World's Trending Technology from Big data training in btm experts who know advanced concepts which can help to solve any type of Real-time issues in the field of Big data. Really worth trying

    ReplyDelete

  15. Best content.Thank you so much for sharing,i have learnt something new.I hope you will share more information like this,keep updating.
    Best Data Science Certification Course in Bangalore

    ReplyDelete
  16. If AWS is a job that you're dreaming of, then we, Infycle are with you to make your dream into reality. Infycle Technologies offers the best AWS Course Chennai, with various levels of highly demanded software courses such as Oracle, Java, Python, Hadoop, Big Data, etc., in 100% hands-on practical training with specialized tutors in the field. Along with that, the pre-interviews will be given for the candidates, so that, they can face the interviews with complete knowledge. To know more, dial 7502633633 for more.Best AWS Training in Chennai

    ReplyDelete
  17. Title:
    Best Java Training Institute in Chennai | Infycle Technologies

    Description:
    Practice Java for making your career towards a sky-high with Infycle Technologies. Infycle Technologies is the best Java training institute in Chennai, providing courses for the Java certification in Chennai in 200% hands-on practical training with professional trainers in the domain. Apart from the training, the placement interviews will be arranged for the students to set their careers without any struggle. Of all that, 100% placement assurance will be given here. To have the best job, call 7502633633 to Infycle Technologies and grab a free demo to know more.

    best training institute in chennai

    ReplyDelete
  18. In this game, more than a hundred players parachute onto an island and scavenge for weapons and equipment to kill others when avoiding getting killed themselves .Pubg License Key 2022

    ReplyDelete
  19. This comment has been removed by the author.

    ReplyDelete
  20. Gun evidence actually line study. Rule forget move factor.religious

    ReplyDelete