maven-2yamlosgi-bundleramlraml-java-parser

Raml validator throws an error in javax.xml.validation.SchemaFactory.newSchema


When trying to validate espn.raml I got the below error. Same code is working fine for gmail.raml. Why is this happening? For your reference I have included the results I found what are the jars that SchemaFactory includes.

$ find *.jar | xargs grep SchemaFactory.class Binary file

axiom_1.2.11.wso2v6.jar matches Binary file

org.apache.openjpa_2.2.0.wso2v1.jar matches Binary file

solr_5.2.1.wso2v1.jar matches

This is the exception I'm getting:

Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "javax.xml.validation.SchemaFactory.newSchema(Ljavax/xml/transform/Source;)Ljavax/xml/validation/Schema;" the class loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) of the current class, org/raml/parser/rule/SchemaRule, and the class loader (instance of <bootloader>) for resolved class, javax/xml/validation/SchemaFactory, have different Class objects for the type m/Source;)Ljavax/xml/validation/Schema; used in the signature
    at org.raml.parser.rule.SchemaRule.doValidateValue(SchemaRule.java:118)
    at org.raml.parser.rule.SchemaRule.doValidateValue(SchemaRule.java:48)
    at org.raml.parser.rule.DefaultTupleRule.validateValue(DefaultTupleRule.java:108)
    at org.raml.parser.visitor.YamlDocumentValidator.onScalar(YamlDocumentValidator.java:115)
    at org.raml.parser.visitor.NodeVisitor.visitScalar(NodeVisitor.java:256)
    at org.raml.parser.visitor.NodeVisitor.visit(NodeVisitor.java:222)
    at org.raml.parser.visitor.NodeVisitor.visitResolvedNode(NodeVisitor.java:180)
    at org.raml.parser.visitor.NodeVisitor.doVisitMappingNode(NodeVisitor.java:151)
    at org.raml.parser.visitor.NodeVisitor.visitMappingNode(NodeVisitor.java:86)
    at org.raml.parser.visitor.NodeVisitor.visit(NodeVisitor.java:218)
    at org.raml.parser.visitor.NodeVisitor.visitResolvedNode(NodeVisitor.java:180)
    at org.raml.parser.visitor.NodeVisitor.doVisitMappingNode(NodeVisitor.java:151)
    at org.raml.parser.visitor.NodeVisitor.visitMappingNode(NodeVisitor.java:86)
    at org.raml.parser.visitor.NodeVisitor.visit(NodeVisitor.java:218)
    at org.raml.parser.visitor.NodeVisitor.visitResolvedNode(NodeVisitor.java:180)
    at org.raml.parser.visitor.NodeVisitor.doVisitMappingNode(NodeVisitor.java:151)
    at org.raml.parser.visitor.NodeVisitor.visitMappingNode(NodeVisitor.java:86)
    at org.raml.parser.visitor.NodeVisitor.visit(NodeVisitor.java:218)
    at org.raml.parser.visitor.NodeVisitor.visitResolvedNode(NodeVisitor.java:180)
    at org.raml.parser.visitor.NodeVisitor.doVisitMappingNode(NodeVisitor.java:151)
    at org.raml.parser.visitor.NodeVisitor.visitMappingNode(NodeVisitor.java:86)
    at org.raml.parser.visitor.NodeVisitor.visit(NodeVisitor.java:218)
    at org.raml.parser.visitor.NodeVisitor.visitResolvedNode(NodeVisitor.java:180)
    at org.raml.parser.visitor.NodeVisitor.doVisitMappingNode(NodeVisitor.java:151)
    at org.raml.parser.visitor.NodeVisitor.visitMappingNode(NodeVisitor.java:86)
    at org.raml.parser.visitor.NodeVisitor.visit(NodeVisitor.java:218)
    at org.raml.parser.visitor.NodeVisitor.visitResolvedNode(NodeVisitor.java:180)
    at org.raml.parser.visitor.NodeVisitor.doVisitMappingNode(NodeVisitor.java:151)
    at org.raml.parser.visitor.NodeVisitor.visitMappingNode(NodeVisitor.java:86)
    at org.raml.parser.visitor.NodeVisitor.visit(NodeVisitor.java:218)
    at org.raml.parser.visitor.NodeVisitor.visitResolvedNode(NodeVisitor.java:180)
    at org.raml.parser.visitor.NodeVisitor.doVisitMappingNode(NodeVisitor.java:151)
    at org.raml.parser.visitor.NodeVisitor.visitMappingNode(NodeVisitor.java:86)
    at org.raml.parser.visitor.NodeVisitor.visit(NodeVisitor.java:218)
    at org.raml.parser.visitor.NodeVisitor.visitResolvedNode(NodeVisitor.java:180)
    at org.raml.parser.visitor.NodeVisitor.doVisitMappingNode(NodeVisitor.java:151)
    at org.raml.parser.visitor.NodeVisitor.visitMappingNode(NodeVisitor.java:86)
    at org.raml.parser.visitor.NodeVisitor.visit(NodeVisitor.java:218)
    at org.raml.parser.visitor.NodeVisitor.visitResolvedNode(NodeVisitor.java:180)
    at org.raml.parser.visitor.NodeVisitor.doVisitMappingNode(NodeVisitor.java:151)
    at org.raml.parser.visitor.NodeVisitor.visitDocument(NodeVisitor.java:209)
    at org.raml.parser.visitor.YamlValidationService.validate(YamlValidationService.java:65)
    at org.raml.parser.visitor.YamlValidationService.validate(YamlValidationService.java:95)
    at org.raml.parser.visitor.YamlValidationService.validate(YamlValidationService.java:82)
    at org.raml.parser.visitor.YamlValidationService.validate(YamlValidationService.java:72)
    at org.wso2.carbon.registry.custom.extensions.handlers.utils.RAMLProcessor.isValidateRAML(RAMLProcessor.java:127)
    at org.wso2.carbon.registry.custom.extensions.handlers.utils.RAMLProcessor.processRAML(RAMLProcessor.java:79)
    at org.wso2.carbon.registry.custom.extensions.handlers.RAMLMediaTypeHandler.put(RAMLMediaTypeHandler.java:157)
    at org.wso2.carbon.registry.core.jdbc.handlers.HandlerManager.put(HandlerManager.java:2503)
    ... 78 more

Solution

  • Excluding xml-apis from raml-parser did the job.

    <exclusion>
     <groupId>xml-apis</groupId>
     <artifactId>xml-apis</artifactId>
    </exclusion>
    

    Now its validating without a issue.