Cannot find CatalogManager.properties

4.9k Views Asked by At

My servlet app uses XML catalogs.

First I used org.apache.xml.resolver.tools.CatalogResolver. It finds its configuration file CatalogManager.properties under WEB-INF/classes/.

Then I tried the same thing with com.sun.org.apache.xml.internal.resolver.CatalogManager, the version which comes with the JDK.

It doesn’t work:

Cannot find CatalogManager.properties

The spec says that this file must be somewhere on the CLASSPATH, and I suppose it is. What should I do?

1

There are 1 best solutions below

2
lexicore On

Actually, it should work, the code is the same, just repackaged:

  propertyFileURI = CatalogManager.class.getResource("/"+propertyFile);
  InputStream in =
    CatalogManager.class.getResourceAsStream("/"+propertyFile);
  if (in==null) {
    if (!ignoreMissingProperties) {
      System.err.println("Cannot find "+propertyFile);
      // there's no reason to give this warning more than once
      ignoreMissingProperties = true;
    }
    return;
  }

What to do? Try debugging, set the breakpoint und see why it does not work.

Why do you need CatalogManager.properties anyway? If you don't, you could disable the error message with the system property xml.catalog.ignoreMissing.