I readed a lot of questions here in S.O. about this error, but none seems like the problem I have.
In Eclipse my project is imported through the following path:
D:\Repositório\branch 7.x.x dev\project-commons
The example.xsd is in the folder *\src\main\resources\schemas* and contain a tag including another xsd like:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:ds="http://ift.tt/uq6naF" xmlns:xs="http://ift.tt/tphNwY" xmlns="http://ift.tt/1sB5uA8" targetNamespace="http://ift.tt/1sB5uA8" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:include schemaLocation="layoutBase.xsd"/>
<xs:element name="complexExample" type="CplExmpl">
<xs:annotation>
<xs:documentation> Process...</xs:documentation>
</xs:annotation>
</xs:element>
</xs:schema>
Type of CplExmpl is defined in layoutBase.xsd. The layoutBase.xsd is located in the same folder of example.xsd.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:ds="http://ift.tt/uq6naF" xmlns:xs="http://ift.tt/tphNwY" xmlns="http://ift.tt/1sB5uA8" targetNamespace="http://ift.tt/1sB5uA8" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="CplExmpl">
<xs:annotation>
<xs:documentation> Process...</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element .../>
<xs:element .../>
</xs:sequence>
<xs:attribute name="version" .../>
</xs:complexType>
</xs:schema>
But when I run my service and validate through example.xsd it does not work. Here the stacktrace:
Caused by: org.xml.sax.SAXParseException; systemId: http://file:/D:/Repositório/branch 7.x.x dev/project-commons/target/classes/schemas/example.xsd;
lineNumber: 4; columnNumber: 45; src-resolve: Cannot resolve the name 'CplExmpl' to a(n) 'type definition' component.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.getGlobalDecl(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseNamedElement(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseGlobal(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.traverseSchemas(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
at org.apache.xerces.jaxp.validation.XMLSchemaFactory.newSchema(Unknown Source)
at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:627)
at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:659)
at br.com.oobj.util.xml.JAXPValidate$ValidatorKeyedPoolFactoryAdapter.getSchema(JAXPValidate.java:523)
at br.com.oobj.util.xml.JAXPValidate$ValidatorKeyedPoolFactoryAdapter.makeObject(JAXPValidate.java:509)
at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:1212)
at br.com.oobj.util.xml.JAXPValidate.borrowValidator(JAXPValidate.java:212)
... 12 more
After that, I did a test running in another directory this service. And it work. Seems like the error is caused by the special character "ó" in D:\Repositório. The <xs:include schemaLocation="layoutBase.xsd"/> is not found. I test putting the complexType inside example.xsd and it work too.
This happen only in my enviroment. Others enviroment of my team is working pretty well.
Has anyone already a problem like that?
No comments:
Post a Comment