1

We use jakarta.xml.ws.Provider class (lib version:4.0.2) in our project. This class chooses the com.sun.xml.ws.spi.ProviderImpl class as the provider, which is related to com.sun.xml:jaxws-rt library (lib version:4.0.3).

jakarta.xml.ws.Provider code:

public abstract class Provider {  

    private static final String DEFAULT_JAXWSPROVIDER = "com.sun.xml.ws.spi.ProviderImpl";  

    protected Provider() {  
    }  

    public static Provider provider() {  
        try {  
            return (Provider) FactoryFinder.find(Provider.class, "com.sun.xml.ws.spi.ProviderImpl");  
        } catch (WebServiceException var1) {  
            throw var1;  
        } catch (Exception var2) {  
            throw new WebServiceException("Unable to create EndpointReference Provider", var2);  
        }  
    }  

//some codes
}

In jaxws-rt library, com.sun.xml.ws.util.xml.XmlCatalogUtil class refers to file META-INF/jax-ws-catalog.xml, which is taken from org.apache.cxf:cxf library (lib version:2.7.18) at RunTime in our project.

com.sun.xml.ws.util.xml.XmlCatalogUtil code:

public final class XmlCatalogUtil{

//some codes

  public static EntityResolver createDefaultCatalogResolver() {  
    try {  
        ClassLoader cl = Thread.currentThread().getContextClassLoader();  
        Enumeration<?> catalogEnum;  
        if (cl == null) {  
            catalogEnum = ClassLoader.getSystemResources("META-INF/jax-ws-catalog.xml");  
        } else {  
            catalogEnum = cl.getResources("META-INF/jax-ws-catalog.xml");  
        }  
        EntityResolver er = createCatalogResolver(Collections.list(catalogEnum));  
        return er;  
    } catch (Exception var3) {  
        throw new WebServiceException(var3);  
    }  
  }
}

META-INF/jax-ws-catalog.xml content existed in cxf library:

<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system">  
    <rewriteSystem systemIdStartString="http://www.w3.org/2006/03/addressing" rewritePrefix="classpath:/schemas/wsdl"/>  
    <rewriteSystem systemIdStartString="http://www.w3.org/2005/08/addressing" rewritePrefix="classpath:/schemas/wsdl"/>  
</catalog>

we encounter this error:

Caused by: java.lang.IllegalArgumentException: JAXP09020005: The specified argument 'classpath:/schemas/wsdl' (case sensitive) for 'setRewritePrefix' is not valid.  
at javax.xml.catalog.CatalogMessages.reportIAE (CatalogMessages.java:140) ~[?:?]  
at javax.xml.catalog.BaseEntry.verifyURI (BaseEntry.java:233) ~[?:?]  
at javax.xml.catalog.RewriteSystem.setRewritePrefix (RewriteSystem.java:65) ~[?:?]  
at javax.xml.catalog.RewriteSystem.<init>(RewriteSystem.java:47) ~[?:?]  
at javax.xml.catalog.CatalogReader.startElement (CatalogReader.java:190) ~[?:?]  
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement (AbstractSAXParser.java:518) ~[?:?]  
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement (AbstractXMLDocumentParser.java:183) ~[?:?]  
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement (XMLNSDocumentScannerImpl.java:353) ~[?:?]  
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next (XMLDocumentFragmentScannerImpl.java:2726) ~[?:?]  
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next (XMLNSDocumentScannerImpl.java:605) ~[?:?]  
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next (XMLNSDocumentScannerImpl.java:114) ~[?:?]  
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument (XMLDocumentFragmentScannerImpl.java:542) ~[?:?]  
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse (XML11Configuration.java:889) ~[?:?]  
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse (XML11Configuration.java:825) ~[?:?]  
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse (XMLParser.java:141) ~[?:?]  
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse (AbstractSAXParser.java:1224) ~[?:?]  
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse (SAXParserImpl.java:637) ~[?:?]  
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse (SAXParserImpl.java:326) ~[?:?]  
at javax.xml.parsers.SAXParser.parse (SAXParser.java:276) ~[?:?]  
at javax.xml.catalog.CatalogImpl.parse (CatalogImpl.java:294) ~[?:?]  
at javax.xml.catalog.CatalogImpl.load (CatalogImpl.java:170) ~[?:?]  
at javax.xml.catalog.CatalogManager.catalog (CatalogManager.java:73) ~[?:?]  
at javax.xml.catalog.CatalogManager.catalogResolver (CatalogManager.java:119) ~[?:?]  
at com.sun.xml.ws.util.xml.XmlCatalogUtil.createCatalogResolver (XmlCatalogUtil.java:95) ~[jaxws-rt-4.0.3.jar:4.0.3]  
at com.sun.xml.ws.util.xml.XmlCatalogUtil.createDefaultCatalogResolver (XmlCatalogUtil.java:75) ~[jaxws-rt-4.0.3.jar:4.0.3]  
at com.sun.xml.ws.util.xml.XmlUtil.createDefaultCatalogResolver (XmlUtil.java:255) ~[jaxws-rt-4.0.3.jar:4.0.3]  
at com.sun.xml.ws.client.WSServiceDelegate.createCatalogResolver (WSServiceDelegate.java:344) ~[jaxws-rt-4.0.3.jar:4.0.3]  
at com.sun.xml.ws.client.WSServiceDelegate.parseWSDL (WSServiceDelegate.java:336) ~[jaxws-rt-4.0.3.jar:4.0.3]  
at com.sun.xml.ws.client.WSServiceDelegate.<init> (WSServiceDelegate.java:293) ~[jaxws-rt-4.0.3.jar:4.0.3]  
at com.sun.xml.ws.client.WSServiceDelegate.<init> (WSServiceDelegate.java:201) ~[jaxws-rt-4.0.3.jar:4.0.3]  
at com.sun.xml.ws.client.WSServiceDelegate.<init> (WSServiceDelegate.java:182) ~[jaxws-rt-4.0.3.jar:4.0.3]  
at com.sun.xml.ws.client.WSServiceDelegate.<init> (WSServiceDelegate.java:178) ~[jaxws-rt-4.0.3.jar:4.0.3]  
at com.sun.xml.ws.spi.ProviderImpl.createServiceDelegate (ProviderImpl.java:89) ~[jaxws-rt-4.0.3.jar:4.0.3]  
at jakarta.xml.ws.Service.<init> (Service.java:82) ~[jakarta.xml.ws-api-4.0.2.jar:4.0.2]  
at com.microsoft.schemas.exchange.services._2006.messages.ExchangeService.<init> (ExchangeService.java:43) ~[ews-2010.jar:3.0.0]  
at com.chmail.cs.fb.ExchangeEWSFreeBusyProvider.<clinit> (ExchangeEWSFreeBusyProvider.java:82) ~[chmailstore.jar:?]  
... 78 more
Caused by: java.net.MalformedURLException: unknown protocol: classpath  
at java.net.URL.<init>(URL.java:779) ~[?:?]  
at java.net.URL.<init>(URL.java:654) ~[?:?]  
at javax.xml.catalog.BaseEntry.verifyURI(BaseEntry.java:227) ~[?:?]  
at javax.xml.catalog.RewriteSystem.setRewritePrefix(RewriteSystem.java:65) ~[?:?]  
at javax.xml.catalog.RewriteSystem.<init>(RewriteSystem.java:47) ~[?:?]  
at javax.xml.catalog.CatalogReader.startElement(CatalogReader.java:190) ~[?:?]  
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:518) ~[?:?]  
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:183) ~[?:?]  
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:353) ~[?:?]  
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2726) ~[?:?]  
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605) ~[?:?]  
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:114) ~[?:?]  
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:542) ~[?:?]  
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:889) ~[?:?]  
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825) ~[?:?]  
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) ~[?:?]  
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1224) ~[?:?]  
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:637) ~[?:?]  
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:326) ~[?:?]  
at javax.xml.parsers.SAXParser.parse(SAXParser.java:276) ~[?:?]  
at javax.xml.catalog.CatalogImpl.parse(CatalogImpl.java:294) ~[?:?]  
at javax.xml.catalog.CatalogImpl.load(CatalogImpl.java:170) ~[?:?]  
at javax.xml.catalog.CatalogManager.catalog(CatalogManager.java:73) ~[?:?]  
at javax.xml.catalog.CatalogManager.catalogResolver(CatalogManager.java:119) ~[?:?]  
at com.sun.xml.ws.util.xml.XmlCatalogUtil.createCatalogResolver(XmlCatalogUtil.java:95) ~[jaxws-rt-4.0.3.jar:4.0.3]  
at com.sun.xml.ws.util.xml.XmlCatalogUtil.createDefaultCatalogResolver(XmlCatalogUtil.java:75) ~[jaxws-rt-4.0.3.jar:4.0.3]  
at com.sun.xml.ws.util.xml.XmlUtil.createDefaultCatalogResolver(XmlUtil.java:255) ~[jaxws-rt-4.0.3.jar:4.0.3]  
at com.sun.xml.ws.client.WSServiceDelegate.createCatalogResolver(WSServiceDelegate.java:344) ~[jaxws-rt-4.0.3.jar:4.0.3]  
at com.sun.xml.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:336) ~[jaxws-rt-4.0.3.jar:4.0.3]  
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:293) ~[jaxws-rt-4.0.3.jar:4.0.3]  
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:201) ~[jaxws-rt-4.0.3.jar:4.0.3]  
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:182) ~[jaxws-rt-4.0.3.jar:4.0.3]  
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:178) ~[jaxws-rt-4.0.3.jar:4.0.3]  
at com.sun.xml.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:89) ~[jaxws-rt-4.0.3.jar:4.0.3]  
at jakarta.xml.ws.Service.<init>(Service.java:82) ~[jakarta.xml.ws-api-4.0.2.jar:4.0.2]  
at com.microsoft.schemas.exchange.services._2006.messages.ExchangeService.<init>(ExchangeService.java:43) ~[ews-2010.jar:3.0.0]  
at com.chmail.cs.fb.ExchangeEWSFreeBusyProvider.<clinit>(ExchangeEWSFreeBusyProvider.java:82) ~[chmailstore.jar:?]  
... 78 more

How can i fix this error?

our java version:21

(note: In the Google search, it was written to use cxf-rt-frontend-jaxws, cxf-rt-transports-http, cxf-rt-transports-http-jetty libraries instead of com.sun.xml.ws (or any other rt) library. But because we cannot directly choose which library to use in our code and Jakarta is making this decision, so I could not test this solution.)

1 Answer 1

0

I had same problem, but I created jax-ws-catalog.xml in my project and solved error. https://stackoverflow.com/a/34547520

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.