Search code examples
web-serviceswsdl

Getting XmlSchemaException: Unable to locate imported document


Getting exception when accessing my webservice:

org.apache.ws.commons.schema.XmlSchemaException: Unable to locate imported document at 'test.xsd', relative to 'jndi:/localhost/proj/WEB-INF/wsdl/testwsdl#types1'.


Solution

  • I was accessing webservice from within my war and forgot to include .xsd files under WEB-INF

     <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.3</version>
        <configuration>
            <webXml>src/main/webapp/WEB-INF/web.xml</webXml>
            <webResources>
                <resource>
                    <directory>../service/src/main/resources</directory>
                    <targetPath>WEB-INF/wsdl</targetPath>
                    <includes>
                        <include>*.wsdl</include>
                        <include>*.xsd</include>
                    </includes>
                </resource>
            </webResources>
        </configuration>
     </plugin>