2 Replies Latest reply on Aug 7, 2009 9:47 AM by muellerc

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

    muellerc

      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.

       

      Regards,

      Christian

        • 1. Re: The matching wildcard is strict but no declaration can be found for element
          joe.luo

          Hi, Christian

           

          The Fuse ESB 4.1.0.2-fuse 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:

           

          http\://www.springframework.org/schema/osgi/spring-osgi-1.0.xsd=org/springframework/osgi/config/spring-osgi-1.0.xsd

          http\://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd=org/springframework/osgi/config/spring-osgi-1.1.xsd

          http\://www.springframework.org/schema/osgi/spring-osgi-1.2-m2.xsd=org/springframework/osgi/config/spring-osgi-1.2-m2.xsd

          http\://www.springframework.org/schema/osgi/spring-osgi.xsd=org/springframework/osgi/config/spring-osgi-1.2-m2.xsd

          http\://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium-1.0.xsd=org/springframework/osgi/compendium/config/spring-osgi-compendium-1.0.xsd

          http\://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium-1.1.xsd=org/springframework/osgi/compendium/config/spring-osgi-compendium-1.1.xsd

          http\://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium-1.2-m2.xsd=org/springframework/osgi/compendium/config/spring-osgi-compendium-1.2-m2.xsd

          http\://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd=org/springframework/osgi/compendium/config/spring-osgi-compendium-1.2-m2.xsd

           

          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,

           

          /Joe

           

          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
            muellerc

            Hi Joe!

             

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

             

            Cheers,

            Christian