org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name?

2.7k views Asked by At

I am getting below error while maven build on Linux server though on windows machine it works fine

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)

Here is relevant snippet from 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>

First XSD relevant part

<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns="http://www.cohbe.org/CustomerRequest"
            xmlns:customer="http://www.cohbe.org/customer"
            targetNamespace="http://www.cohbe.org/CustomerRequest"
            elementFormDefault="qualified">
    <xsd:import schemaLocation="CustomerDetails.xsd"
              namespace="http://www.cohbe.org/customer"/>
    <xsd:element name="CustomerNewRequest">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="customer:CustomerApplicationDetail" minOccurs="0"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    ...
</xsd:schema>

CustomerDetails.xsd location is same as of First XSD. Here is relevant part

<?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>

UPDATE:- second file attributes are :-

      xmlns="http://www.cohbe.org/customer"
            targetNamespace="http://www.cohbe.org/customer"

instead of

      xmlns="http://www.cohbe.org/CustDetails"
            targetNamespace="http://www.cohbe.org/CustDetails"

It was copy/paste error in this question So I am getting same error i.e org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name

0

There are 0 answers