Announcement Announcement Module
Collapse
No announcement yet.
Unable to load schema extensions from classpath Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to load schema extensions from classpath

    Hi,

    I have defined a XML schema extension and created the following artifacts:
    • XSD containing xml extensions
    • NamespaceHandler implementation
    • BeanDefinitionParser implementation
    • META-INF/spring.schemas
    • META-INF/spring.handlers

    When i test using Junit within the same project i am able to properly use the custom extension to instantiate the bean.

    In another project i have defined another extension which uses the extension defined in the above project. I have created the artifacts as listed above for the new extension + i have also included the above project as a jar file and the jar file is placed on the classpath.

    When i run the test it is not able to pick up the custom extension elements which is now present in a jar file on the classpath.

    If i understand correctly spring.schemas becomes a classpath resource and spring will automatically search for resources from the classpath which have been defined in spring.schemas

    Names and schema have been changed but the structure is almost the same

    First Extension
    Code:
    <xsd:complexType name="personType">
       <xsd:complexContent>
         <xsd:extension base="beans:identifiedType">
             <xsd:all> 
                 <xsd:element name="name" type="xsd:string"/>
                 .... 
             </xsd:all>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="person" type="personType"/>
    Second Extension
    Code:
    <!-- imported the schema above and the prefix used is say 'p' -->
    <xsd:complexType name="employeeType">
       <xsd:complexContent>
         <xsd:extension base="beans:identifiedType">
                <xsd:all>
                    <xsd:element name="person" type="p:person"/>
                    <xsd:element name="org" type="xsd:string"/>
                    ....
                </xsd:all>
    </xsd:complexType>
    Now when a spring xml is created to use these extensions from within the second project which includes the first project as a jar dependency then an error is thrown that it is not able to recognize 'person'

    Any idea what am i missing?
    Also eventually these are going to be osgi bundles, how does spring handle classpath resources in osgi?

    Regards,
    Madhav
Working...
X