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

Common class loader should prefer classes from the domain over class in as-install/lib #25162

Open
OndroMih opened this issue Sep 26, 2024 · 0 comments

Comments

@OndroMih
Copy link
Contributor

The common classloader loads classes from the following locations, in that order (see CommonClassLoaderServiceImpl.java):

  • as-install/lib - JARs
  • domain-dir/lib/classes - classes
  • domain-dir/lib - JARs

It's more logical to me that locations in domain-dir are preferred over as-install location, because if GlassFish installation contains custom JARs, it should be possible to override them for each domain. Multiple domains running from the same installation would not have to share the same JARs if they are dropped into the installation. Edge case, I know :)

Another issue with the Common classloader is that it scans all the JARs in the as-install/lib folder, opens their manifests and searches for the GlassFish-ServerExcluded field there, to find out whether to ignore the JAR or not. By default, currently, there are 3 JARs in the lib folder, so 3 JARs need to be opened and their manifests unpacked at startup. it would be better to avoid opening them just to scan values in their manifests. We could, at package time, generate a file that lists the JARs that should be ignored. Then just a single file would need to be opened and ready, instead of opening a file from 3 JAR archives.

Environment Details

  • GlassFish Version (and build number): up to 7.0.17
  • JDK version: not relevant
  • OS: not relevant
  • Database: not relevant

Impact of Issue

Slows down server startup

Type: Improvement
Component: Startup, Classloader
Priority: low

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

No branches or pull requests

1 participant