This should be changed:
for ( String xmlFile : xmlFiles ) { InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream( xmlFile ); configuration.addInputStream( is ); }
to this:
for ( String xmlFile : xmlFiles ) { try (InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream( xmlFile )) { configuration.addInputStream( is ); } catch (IOException e) { throw new IllegalArgumentException( e ); } }