2 Replies Latest reply on Aug 7, 2009 9:47 AM by Christian Müller

    The matching wildcard is strict but no declaration can be found for element

    Christian Müller Newbie

      Hey guys!


      Some times, I get an exception which tells me, that my spring osgi configuration is not correct:


      Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'osgi:service'.


      My spring osgi configuration looks like:





      I resolved this problem, by changing the schema locations from "http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd" to "http://www.springframework.org/schema/osgi/spring-osgi.xsd" and from "http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium-1.2.xsd" to "http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium-1.2.xsd". But I don't understand why this fixed my problem, because both url's exists and point to the same schema.


      Any idea?


      I wont to use the schema location with the version info to target an explicit version of the schema.




        • 1. Re: The matching wildcard is strict but no declaration can be found for element
          Joe Luo Novice

          Hi, Christian


          The Fuse ESB has spring-osgi-core bundle version 1.2.0-m2 pre-installed. If you have a look at the spring-osgi-core-1.2.0-m2.jar, there is a file called spring.schema and

          below are the content of the file:











          Basically, Spring uses namespace handler to resolve/handle namespaces. And there is a mapping between the schema location and the file that physically exists in the current classpath for Spring to find a target schema file for validating against.


          In your case, the schema location "http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd" does not exist in this mapping file but the "http://www.springframework.org/schema/osgi/spring-osgi.xsd" does exist and it maps to a file called "spring-osgi-1.2-m2.xsd" under package "org/springframework/osgi/config".


          Therefore, it does not work when you use the former schema location but it does when you use the later one. And it is the same for the schema location "http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd".


          Hope it helps,




          Edited by: joeluo on Aug 7, 2009 11:53 AM


          Edited by: joeluo on Aug 7, 2009 2:22 PM

          • 2. Re: The matching wildcard is strict but no declaration can be found for element
            Christian Müller Newbie

            Hi Joe!


            Thank you for taking time to explain me, how it works.