Skip to content
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

Bundle-ClassPath and lib place on WEB-INF/lib make classpath duplicate #5013

Closed
hieplq opened this issue Jul 2, 2020 · 5 comments · Fixed by #5034
Closed

Bundle-ClassPath and lib place on WEB-INF/lib make classpath duplicate #5013

hieplq opened this issue Jul 2, 2020 · 5 comments · Fixed by #5034

Comments

@hieplq
Copy link

hieplq commented Jul 2, 2020

Jetty version
9.4.x
Java version
jdk-13
OS type/version
linux
Description
deploy jetty as osgi on equinox
deploy a webapp as WebAppContext
webapp is osgi bundle with Bundle-ClassPath for a library place on WEB-INF/lib/

so that library exists on two classpath,
one is normal Bundle-ClassPath
other is jar classpath add by bellow code on class org.eclipse.jetty.webapp.WebInfConfiguration

        // Add WEB-INF classes and lib classpaths
        if (webInf != null && webInf.isDirectory() && context.getClassLoader() instanceof WebAppClassLoader)
        {
            // Look for classes directory
            Resource classes = webInf.addPath("classes/");
            if (classes.exists())
                ((WebAppClassLoader)context.getClassLoader()).addClassPath(classes);

            // Look for jars
            Resource lib = webInf.addPath("lib/");
            if (lib.exists() || lib.isDirectory())
                ((WebAppClassLoader)context.getClassLoader()).addJars(lib);
        }
hieplq added a commit to hieplq/vn.duplicate.classpath that referenced this issue Jul 2, 2020
@hieplq
Copy link
Author

hieplq commented Jul 2, 2020

@hieplq
Copy link
Author

hieplq commented Jul 7, 2020

=== bellow is wrong report, i just not yet delete WEB-INF/lib ===
i do work-around by don't put lib inside WEB-INF, i move lib to root folder of plugin
on run time (eclipse) it's it resolve issue
but when i run binary, when jetty deploy my webapp bundle to temp folder, it move lib back to WEB-INF

@janbartel
Copy link
Contributor

@hieplq I think we expect that WEB-INF/ will just contain classes/ for a web bundle, as any jars would be deployed as bundles within the osgi container instead. I'll have a look and make sure that we can support the scenario where the jars have been included in WEB-INF/lib instead, and/or appear on the Bundle-Classpath.

@janbartel
Copy link
Contributor

Raised PR #5034.

janbartel added a commit that referenced this issue Jul 20, 2020
…i bundle loader (#5034)

Signed-off-by: Jan Bartel <janb@webtide.com>
@janbartel
Copy link
Contributor

Fix merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants