2 Replies Latest reply on Jan 23, 2015 9:52 AM by tamm0r

    Tons of WELD-001125: Illegal bean type warnings

    tamm0r

      Hi,

       

      I'm trying to integrate Weld 2.2.9 into a Maven-based "hello world"-style Dropwizard application and package everything as a fat jar using the maven-shade plugin. The application is running fine from within Eclipse without any unexpected warnings. In order to get the fat jar running I had to exclude some transitive dependencies to overcome ClassNotFoundExceptions and to exclude some packages from bean discovery. With that I got the application running but I see tons of warnings:

       

      WARN  [2015-01-23 03:15:31,493] org.jboss.weld.Bootstrap: WELD-001125: Illegal bean type javax.ws.rs.ext.MessageBodyWriter<com.google.common.base.Optional<?>> ignored on [EnhancedAnnotatedTypeImpl] public @Produces @Provider class io.dropwizard.jersey.guava.OptionalMessageBodyWriter

      WARN  [2015-01-23 03:15:31,620] org.jboss.weld.Bootstrap: WELD-001125: Illegal bean type jersey.repackaged.com.google.common.base.Function<java.lang.reflect.Constructor<?>, java.lang.Boolean> ignored on [EnhancedAnnotatedTypeImpl] static  class jersey.repackaged.com.google.common.util.concurrent.Futures$5

      WARN  [2015-01-23 03:15:31,659] org.jboss.weld.Bootstrap: WELD-001125: Illegal bean type interface com.fasterxml.jackson.databind.util.Converter<class java.lang.Object,java.lang.Iterable<?>> ignored on [EnhancedAnnotatedTypeImpl] static  class com.fasterxml.jackson.datatype.guava.GuavaSerializers$FluentConverter

      WARN  [2015-01-23 03:15:31,659] org.jboss.weld.Bootstrap: WELD-001125: Illegal bean type com.fasterxml.jackson.databind.util.StdConverter<java.lang.Object, java.lang.Iterable<?>> ignored on [EnhancedAnnotatedTypeImpl] static  class com.fasterxml.jackson.datatype.guava.GuavaSerializers$FluentConverter

      WARN  [2015-01-23 03:15:31,691] org.jboss.weld.Bootstrap: WELD-001125: Illegal bean type com.google.common.reflect.TypeToken.com.google.common.reflect.TypeToken$TypeCollector<com.google.common.reflect.TypeToken<?>> ignored on [EnhancedAnnotatedTypeImpl] static  class com.google.common.reflect.TypeToken$TypeCollector$1

      ...

       

      Application startup increased from ~3 seconds (Eclipse) to ~10 seconds (far jar). I assume Weld scans far more classes in the latter case although I don't understand why.


      In case it's of relevance: Dropwizard integrates Jersey so I included the cdi-hk2 bridge as explained here. When running the fat jar I also see a lot of warnings from Jersey (that do not appear when running from Eclipse):


      WARN  [2015-01-23 03:15:33,117] org.glassfish.jersey.internal.Errors: The following warnings have been detected: WARNING: Parameter 1 of type ch.qos.logback.core.pattern.Converter<E> from public void ch.qos.logback.core.pattern.CompositeConverter.setChildConverter(ch.qos.logback.core.pattern.Converter<E>) is not resolvable to a concrete type.

      WARNING: Parameter 1 of type ch.qos.logback.core.pattern.Converter<E> from public final void ch.qos.logback.core.pattern.Converter.setNext(ch.qos.logback.core.pattern.Converter<E>) is not resolvable to a concrete type.

      WARN  [2015-01-23 03:15:33,123] org.glassfish.jersey.internal.Errors: The following warnings have been detected: WARNING: Parameter 1 of type ch.qos.logback.core.pattern.Converter<E> from public void ch.qos.logback.core.pattern.CompositeConverter.setChildConverter(ch.qos.logback.core.pattern.Converter<E>) is not resolvable to a concrete type.

      WARNING: Parameter 1 of type ch.qos.logback.core.pattern.Converter<E> from public final void ch.qos.logback.core.pattern.Converter.setNext(ch.qos.logback.core.pattern.Converter<E>) is not resolvable to a concrete type.

      WARN  [2015-01-23 03:15:33,409] org.glassfish.jersey.internal.Errors: The following warnings have been detected: WARNING: Parameter 1 of type javax.validation.spi.ValidationProvider<?> from public final void org.hibernate.validator.internal.xml.ValidationBootstrapParameters.setProvider(javax.validation.spi.ValidationProvider<?>) is not resolvable to a concrete type.

      ...

       

      Any ideas what's going on here?

        • 1. Re: Tons of WELD-001125: Illegal bean type warnings
          mkouba

          Hi Marian,

          from within Eclipse Weld only scans archives on classpath which contain beans.xml descriptor. If you put all those archives together into one fat jar and place beans.xml there, Weld must scan all the classes from that jar. I would try to use bean-discovery-mode=annotated if possible (see also 12.1. Bean archives). As to those warnings - it means that there are some classes which are recognized as managed beans but they have an illegal bean type in the set of bean types (this type ignored although the spec is not clear, see also CDI-495).

          • 2. Re: Tons of WELD-001125: Illegal bean type warnings
            tamm0r

            Hi Martin,

             

            thanks for the quick answer. Generating a far jar is not a hard requirement for me so going with regular jars seems easier in this case.