4 Replies Latest reply on Apr 14, 2009 5:55 AM by davsclaus

    Camel XML Schema URL problem

    wjbustraan

      I'm running into some problems when using Camel schemas within a Spring config file.

       

      First off, let me describe my network situation. I'm behind an authenticated HTTP proxy, so in order to reach the internet, I must supply a valid username and password. When I'm developing in Eclipse, it's able to get through, but when I run the ServiceMix daemon, it cannot.

       

      Apparently, the Apache project recently changed the URL for their camel-spring schema when Camel became a toplevel project.

       

      It used to be:

      http://activemq.apache.org/camel/schema/spring/camel-spring.xsd

       

      But that URL now redirects to:

      http://camel.apache.org/schema/spring/camel-spring.xsd

       

      The problem with this is that the namespace has changed also. So, in Eclipse, if you specify the old namespace:

       

      xsi:schemaLocation="

      http://activemq.apache.org/camel/schema/spring

      http://activemq.apache.org/camel/schema/spring/camel-spring.xsd"

       

      ... it throws an error because the document that is retrieved has the following schema:

       

      http://camel.apache.org/schema/spring

       

      It would seem like the easiest solution would be to just update everything to the camel.apache.org schemas.

       

      I tried this, but I can't deploy bundles with the new namespace. Remember that my ServiceMix install cannot reach the Internet to retrieve .xsd files. This wasn't a problem before because the appropriate .xsd file is included in ServiceMix and it found it locally. The problem is that Fuse ESB 4 contains Camel 1.5 which includes a camel-spring.xsd for the activemq.apache.org namespace.

       

      So, I'm in a catch-22 situation. If I use the new namespace, Eclipse is happy but ServiceMix gives the following error:

       

      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 'camel:camelContext'.

       

      If I use the old namespace, ServiceMix is happy, but the Eclipse won't validate my XML files and gives the same error.

       

      I see two possible resolutions, but they seem to be both out of my control:

       

      1) Somehow get the folks at apache.org to remove the redirect and have http://activemq.apache.org/camel/schema/spring/camel-spring.xsd point to a .xsd file whose namespace matches the url.

       

      2) Get the new camel.apache.org namespace included in a new release of FUSE ESB 4.

       

      Any other suggestions?

        • 1. Re: Camel XML Schema URL problem
          davsclaus

          Camel 1.x uses the old namespace URIs and will continue to due so

           

          Camel 2.0+ uses the new TLP namespace URIs

           

          So you should be able to use the old namespace URIs in Eclipse with Camel 1.x.

          Well at least that is the idea

          • 2. Re: Camel XML Schema URL problem
            davsclaus

            Maybe Eclipse have a feature like IDEA does where you can configure a namespace URI to a local .xsd file.

             

            The camel-spring.xsd is in the camel-spring.jar.

             

            Then Eclipse will validate against the local file instead of going out on the internet.

            • 3. Re: Camel XML Schema URL problem
              wjbustraan

              The problem is that, for Camel 1.x, the publicly hosted .xsd file is gone, so unless you have a local copy, you will not be able to validate your XML.

               

              If you go to http://activemq.apache.org/camel/schema/spring/camel-spring.xsd, the document that you get will be of the wrong namespace.

               

              In the interim, I did find a solution similar to what you suggested. I pulled the .xsd file out of camel-spring.jar, saved it in a folder on my local machine, and set up the Eclipse schema catalog to resolve to that file rather than trying to retrieve it from the Apache site.

               

              However, I think more people are going to run into this problem now that the old 1.x schema is unavailable.

              • 4. Re: Camel XML Schema URL problem
                davsclaus

                Thanks for reporting.

                 

                The redirect is a part of the TLP move for Camel so all old URIs is redirected to the new home.

                 

                I guess we need to add an exception to the rule. I will notify smart people who have access to such servers for help.