Java org.xml.sax.SAXParseException:src resolve:无法解析名称?
当maven在Linux服务器上构建时,我发现下面的错误 这台机器运转良好Java org.xml.sax.SAXParseException:src resolve:无法解析名称?,java,xml,linux,xsd,maven-jaxb2-plugin,Java,Xml,Linux,Xsd,Maven Jaxb2 Plugin,当maven在Linux服务器上构建时,我发现下面的错误 这台机器运转良好 org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'customer:CustomerApplication' to a(n) 'element declaration' component. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.creat
org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'customer:CustomerApplication' to a(n) 'element declaration' component.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:2537)
这里是pom.xml中的相关片段
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<configuration>
<schemaDirectory>src/main/resources/META-INF/schema</schemaDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
而不是
xmlns="http://www.cohbe.org/CustDetails"
targetNamespace="http://www.cohbe.org/CustDetails"
在这个问题中是复制/粘贴错误,所以我得到了相同的错误,即
org.xml.sax.SAXParseException:src resolve:Cannot resolve name
您的错误消息说customer:CustomerApplication
,您的模式CustomerApplicationDetail
-我相信这是问题中的另一个错误。使用mvn-X-e clean安装运行并提供日志。可能包含进一步的线索。我是的作者。您的错误消息是customer:CustomerApplication
,您的模式CustomerApplicationDetail
——我相信这是问题中的另一个错误。使用mvn-X-e clean安装运行并提供日志。可能包含进一步的线索。我是的作者。您的错误消息是customer:CustomerApplication
,您的模式CustomerApplicationDetail
——我相信这是问题中的另一个错误。使用mvn-X-e clean安装运行并提供日志。可能包含进一步的线索。我是这本书的作者。
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema version="2.15"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.cohbe.org/CustDetails"
targetNamespace="http://www.cohbe.org/CustDetails"
xmlns:countries="http://www.cohbe.org/Counties"
elementFormDefault="qualified">
<!-- Version 2.15 -->
<xsd:import namespace="http://www.cohbe.org/states" schemaLocation="States.xsd"/>
<xsd:element name="CustomerApplicationDetail"
type="CustomerApplicationDetail"/>
<xsd:complexType name="CustomerApplicationDetail">
.....
</xsd:schema>
xmlns="http://www.cohbe.org/customer"
targetNamespace="http://www.cohbe.org/customer"
xmlns="http://www.cohbe.org/CustDetails"
targetNamespace="http://www.cohbe.org/CustDetails"