Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2652

In an MR JAR, Weld incorrectly tries to load classes under META-INF-versions



    • Bug
    • Resolution: Done
    • Major
    • 3.1.6.Final, 4.0.0.Final
    • 3.1.5.SP1, 4.0.0.Beta5
    • None
    • None


      Reproducible locally by using Weld SE and adding any MR JAR with explicit bean discovery. For instance SR CP 1.0.20.
      Similar situation could happen with annotated discovery, given that you have different beans for different JDK versions.
      One such reproducer can be seen on my branch - https://github.com/manovotn/core/tree/weld2652_reproducer
      Not that this is not an automated test, you need to inspect the logs to see INFO there since Weld is able bootstrap despite not being able to load these classes.

      The logging looks something like this:

      INFO: WELD-000119: Not generating any bean definitions from META-INF.versions.9.io.smallrye.context.Jdk9CompletableFutureWrapper because of underlying class loading error: Type io.smallrye.context.Jdk9CompletableFutureWrapper (wrong name: META-INF.versions.9.io.smallrye.context.Jdk9CompletableFutureWrapper) not found.  If this is unexpected, enable DEBUG logging to see the full error.

      What happens is that Weld tries to load classes located under META-INF/versions which blows up as those classes should not be loaded directly. If I understand it correctly, using something like ClassLoader.loadClass(...) should already attempt to load proper version of any given class WRT Java version. Therefore, we should be good ignoring classes under META-INF/versions and simply avoid trying to load them.



          Public project attachment banner

            context keys: [headless, issue, helper, isAsynchronousRequest, project, action, user]
            current Project key: WELD


              manovotn Matěj Novotný
              manovotn Matěj Novotný
              0 Vote for this issue
              1 Start watching this issue