mirror of
https://github.com/apache/nifi.git
synced 2025-03-03 16:09:19 +00:00
NIFI-5479 Upgraded Jetty. Moved where we unpack bundled deps to so we can avoid a new jetty bug with META-INF loading logic.
Signed-off-by: Koji Kawamura <ijokarumawak@apache.org>
This commit is contained in:
parent
58cb900b90
commit
a27ccd8a56
@ -176,21 +176,21 @@ public class NarClassLoader extends URLClassLoader {
|
||||
|
||||
/**
|
||||
* Adds URLs for the resources unpacked from this NAR:
|
||||
* <ul><li>the root: for classes, <tt>META-INF</tt>, etc.</li>
|
||||
* <li><tt>META-INF/dependencies</tt>: for config files, <tt>.so</tt>s,
|
||||
* <ul><li>the root: for classes, <tt>NAR-INF</tt>, etc.</li>
|
||||
* <li><tt>NAR-INF/bundled-dependencies</tt>: for config files, <tt>.so</tt>s,
|
||||
* etc.</li>
|
||||
* <li><tt>META-INF/dependencies/*.jar</tt>: for dependent
|
||||
* <li><tt>NAR-INF/bundled-dependencies/*.jar</tt>: for dependent
|
||||
* libraries</li></ul>
|
||||
*
|
||||
* @param root the root directory of the unpacked NAR.
|
||||
* @throws IOException if the URL list could not be updated.
|
||||
*/
|
||||
private void updateClasspath(File root) throws IOException {
|
||||
addURL(root.toURI().toURL()); // for compiled classes, META-INF/, etc.
|
||||
addURL(root.toURI().toURL()); // for compiled classes, WEB-INF, NAR-INF/, etc.
|
||||
|
||||
File dependencies = new File(root, "META-INF/bundled-dependencies");
|
||||
File dependencies = new File(root, "NAR-INF/bundled-dependencies");
|
||||
if (!dependencies.isDirectory()) {
|
||||
LOGGER.warn(narWorkingDirectory + " does not contain META-INF/bundled-dependencies!");
|
||||
LOGGER.warn(narWorkingDirectory + " does not contain NAR-INF/bundled-dependencies!");
|
||||
}
|
||||
addURL(dependencies.toURI().toURL());
|
||||
if (dependencies.isDirectory()) {
|
||||
@ -206,9 +206,9 @@ public class NarClassLoader extends URLClassLoader {
|
||||
|
||||
@Override
|
||||
protected String findLibrary(final String libname) {
|
||||
File dependencies = new File(narWorkingDirectory, "META-INF/bundled-dependencies");
|
||||
File dependencies = new File(narWorkingDirectory, "NAR-INF/bundled-dependencies");
|
||||
if (!dependencies.isDirectory()) {
|
||||
LOGGER.warn(narWorkingDirectory + " does not contain META-INF/bundled-dependencies!");
|
||||
LOGGER.warn(narWorkingDirectory + " does not contain NAR-INF/bundled-dependencies!");
|
||||
}
|
||||
|
||||
final File nativeDir = new File(dependencies, "native");
|
||||
|
@ -195,7 +195,7 @@ public final class NarUnpacker {
|
||||
final File unpackedNar = entry.getKey();
|
||||
final BundleCoordinate bundleCoordinate = entry.getValue();
|
||||
|
||||
final File bundledDependencies = new File(unpackedNar, "META-INF/bundled-dependencies");
|
||||
final File bundledDependencies = new File(unpackedNar, "NAR-INF/bundled-dependencies");
|
||||
|
||||
unpackBundleDocs(docsDirectory, mapping, bundleCoordinate, bundledDependencies);
|
||||
}
|
||||
@ -261,6 +261,9 @@ public final class NarUnpacker {
|
||||
while (jarEntries.hasMoreElements()) {
|
||||
JarEntry jarEntry = jarEntries.nextElement();
|
||||
String name = jarEntry.getName();
|
||||
if(name.contains("META-INF/bundled-dependencies")){
|
||||
name = name.replace("META-INF/bundled-dependencies", "NAR-INF/bundled-dependencies");
|
||||
}
|
||||
File f = new File(workingDirectory, name);
|
||||
if (jarEntry.isDirectory()) {
|
||||
FileUtils.ensureDirectoryExistAndCanReadAndWrite(f);
|
||||
|
@ -384,7 +384,7 @@ public class JettyServer implements NiFiServer {
|
||||
// consider each nar working directory
|
||||
bundles.forEach(bundle -> {
|
||||
final BundleDetails details = bundle.getBundleDetails();
|
||||
final File narDependencies = new File(details.getWorkingDirectory(), "META-INF/bundled-dependencies");
|
||||
final File narDependencies = new File(details.getWorkingDirectory(), "NAR-INF/bundled-dependencies");
|
||||
if (narDependencies.isDirectory()) {
|
||||
// list the wars from this nar
|
||||
final File[] narDependencyDirs = narDependencies.listFiles(WAR_FILTER);
|
||||
|
@ -913,6 +913,11 @@
|
||||
the application classpath or the maven jetty plugin classpath defined
|
||||
above.
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>apache-jstl</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
|
Loading…
x
Reference in New Issue
Block a user