1

I have some warning messages when I use java 11 instead of java 8 because some of some new dependecies (jaxb, jaxws). The message is :

WARN  o.a.t.u.s.StandardJarScanner.log - Failed to scan [...] from classloader hierarchy

For a lot of JAR (some examples: jaxb-api.jar, txw2-2.4.0-b180830.0438.jar, istack-commons-runtime-3.0.7.jar...)

So to solve this I can add to my @Configuration file

@Bean
      public TomcatServletWebServerFactory tomcatFactory() {
        return new TomcatServletWebServerFactory() {
          @Override
          protected void postProcessContext(Context context) {
            ((StandardJarScanner) context.getJarScanner()).setScanManifest(false);
          }
        };
      }

Which skip the JAR scaning for all JAR.

So my question is, what is this JAR scaning and do I need it? Also, I know I can add jar to catalina.properties for tomcat.util.scan.StandardJarScanFilter.jarsToSkip but can I do this in my spring boot app?

Raikyn
  • 79
  • 1
  • 9

2 Answers2

0

So I still don't know the use of the JAR scanning but I've found a way to just exclude certain jaxb related packages. Add this to the @Configuration file

@Bean
    public TomcatServletWebServerFactory tomcatFactory() {
        return new TomcatServletWebServerFactory() {
            @Override
            protected void postProcessContext(Context context) {
                Set<String> pattern = new LinkedHashSet<>();

                pattern.add("jaxb*.jar");
                pattern.add("jaxws*.jar");          

                StandardJarScanFilter filter = new StandardJarScanFilter();
                filter.setTldSkip(StringUtils.collectionToCommaDelimitedString(pattern));

                ((StandardJarScanner) context.getJarScanner()).setJarScanFilter(filter);

            }
        };
    }
Raikyn
  • 79
  • 1
  • 9
0

See Sundararaj Govindasamy's and rustyx's answers for: AFTER upgrade from Spring boot 1.2 to 1.5.2, FileNotFoundException during Tomcat 8.5 Startup

E.g. in application.properties:

server.tomcat.additional-tld-skip-patterns= # Comma-separated list of additional patterns that match jars to ignore for TLD scanning.

(https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html)

You should list only the jars w/ problem, as e.g. using *.jar will break JSP/JSTL support.

Ogmios
  • 558
  • 5
  • 11