Skip to content

Resources in /META-INF/ of executable-fat-jar would be fetched repeatedly. #16536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
QilongZhang opened this issue Apr 11, 2019 · 3 comments
Closed
Labels
status: duplicate A duplicate of another issue

Comments

@QilongZhang
Copy link

QilongZhang commented Apr 11, 2019

When execute a Spring Boot Fat Jar,it's bootstrapped in AppClassLoader, actually switch to LaunchedURLClassLoader during refreshing application context.

As the parent of LaunchedURLClassLoader is AppClassLoader, it will lead resource in /META-INF/* of executable-fat-jar to be loaded repeatedly when invoke LaunchedURLClassLoader.getResources:

    public Enumeration<URL> getResources(String name) throws IOException {
        Objects.requireNonNull(name);
        @SuppressWarnings("unchecked")
        Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2];
        if (parent != null) {
            tmp[0] = parent.getResources(name);
        } else {
            tmp[0] = BootLoader.findResources(name);
        }
        tmp[1] = findResources(name);

        return new CompoundEnumeration<>(tmp);
    }

it leads our program failed to run!would you fix it?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 11, 2019
@philwebb
Copy link
Member

I'm sorry but I can't understand the issue as it's reported. Could you please provide a sample application that shows the failure.

@QilongZhang
Copy link
Author

Thanks a lot. I found this bug has been fixed in 1.4.x.

#7449
#7595

@snicoll snicoll added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 12, 2019
@philwebb
Copy link
Member

@QilongZhang 1.4.x is no longer supported, you should upgrade to 2.1.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

4 participants