6 Replies Latest reply on Sep 3, 2015 8:16 AM by chrisjr

    WELD 2.2 branch no longer working with JDK6

    chrisjr

      Hi,

       

      I tried upgrading an old JDK6-bound component from WELD 2.1.2.Final to WELD 2.2.15.Final, but the deployment failed with this error:

      Caused by: java.lang.NoClassDefFoundError: java/util/Objects

              at org.jboss.weld.injection.VirtualMethodInjectionPoint.getMethod(VirtualMethodInjectionPoint.java:61)

              at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:88)

              at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:78)

              at org.jboss.weld.util.Beans.callInitializers(Beans.java:399)

              at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:387)

              at org.jboss.weld.injection.producer.ResourceInjector$1.proceed(ResourceInjector.java:70)

              at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)

              at org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:72)

              at org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:121)

       

      It looks like java.util.Objects first appeared with JDK7, which means that WELD >= 2.2.8.Final is now incompatible with JDK6. Was this intentional, please? Because the final comment in WELD-1812 suggests that it isn't. (And besides, dropping support for a JDK version is quite a large change for a minor release).

       

      Cheers,

      Chris

        • 1. Re: WELD 2.2 branch no longer working with JDK6
          mkouba

          Hi Chris,

           

          it's not intentional - it's a bug. 2.2 branch should remain JDK6-compatible (note that this branch is not actively developed anymore). Java 7 is the minimal requirement for building and running Weld 2.3. Unfortunately, VirtualMethodInjectionPoint is not the only class using JDK7 API. I'm going to create a new issue.

          • 2. Re: WELD 2.2 branch no longer working with JDK6
            mkouba

            Chris, I was wondering what's the target runtime?

            • 3. Re: WELD 2.2 branch no longer working with JDK6
              chrisjr

              The WAR in question is being deploying into Tomcat 7.0.57, which is running on top of a JDK6 JVM / CentOS[5-6]. (It turns out that upgrading Tomcat is a lot easier than either the JDK or the OS when the server is physical rather than virtual... )

              • 4. Re: WELD 2.2 branch no longer working with JDK6
                mkouba

                I see, so I suppose you're using org.jboss.weld.servlet:weld-servlet. I've removed the JDK7 API parts but there are some JDK6-incompatible dependencies and so it's not possible to run the complete build/test suite. It would be great if you could try this WELD-2024 branch (i.e. checkout the repository, build the project mvn clean install -DskipTests and test 2.2.16-SNAPSHOT with your application).

                • 5. Re: WELD 2.2 branch no longer working with JDK6
                  chrisjr

                  More precisely, we're doing this:

                  <dependency>
                      <groupId>org.jboss.weld.servlet</groupId>
                      <artifactId>weld-servlet-core</artifactId>
                      <version>${jboss.weld.version}</version>
                      <scope>runtime</scope>
                      <exclusions>
                          <exclusion>
                              <groupId>org.jboss.spec.javax.el</groupId>
                              <artifactId>jboss-el-api_3.0_spec</artifactId>
                          </exclusion>
                      </exclusions>
                  </dependency>
                  <dependency>
                      <groupId>org.jboss.weld</groupId>
                      <artifactId>weld-core</artifactId>
                      <version>${jboss.weld.version}</version>
                      <exclusions>
                          <exclusion>
                              <groupId>org.jboss.spec.javax.el</groupId>
                              <artifactId>jboss-el-api_3.0_spec</artifactId>
                          </exclusion>
                      </exclusions>
                  </dependency>
                  <dependency>
                      <groupId>org.apache.tomcat</groupId>
                      <artifactId>tomcat-el-api</artifactId>
                      <version>${tomcat.version}</version>
                      <scope>provided</scope>
                  </dependency>
                  

                  For tomcat.version=7.0.57, jboss.weld.version=2.1.2.Final.

                  • 6. Re: WELD 2.2 branch no longer working with JDK6
                    chrisjr

                    Martin,

                     

                    2.2.16-SNAPSHOT seems to work fine; there have been no more NoClassDefFoundError exceptions.

                     

                    Cheers,

                    Chris