问题描述
当尝试验证 espn.raml 时,我出现以下错误.相同的代码对于 gmail.raml .为什么会这样呢?供您参考,我提供了结果,发现了SchemaFactory包含的jar.
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.
axiom_1.2.11.wso2v6.jar与二进制文件匹配
axiom_1.2.11.wso2v6.jar matches Binary file
org.apache.openjpa_2.2.0.wso2v1.jar与二进制文件匹配
org.apache.openjpa_2.2.0.wso2v1.jar matches Binary file
solr_5.2.1.wso2v1.jar匹配
solr_5.2.1.wso2v1.jar matches
这是我得到的例外:
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
推荐答案
从raml-parser中排除xml-api即可完成这项工作.
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.
这篇关于Raml验证程序在javax.xml.validation.SchemaFactory.newSchema中引发错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!