0 Replies Latest reply on Oct 8, 2019 7:27 AM by Alan Y

    WELD-000119 Bean not found when searching bean under spring boot fat jar

    Alan Y Newbie

      Hi there,


      I am running latest Weld inside a spring boot application. My SpringBootApplication will initialize Weld via the following code.



      public static void main(String[] args) {


         SpringApplication app = new SpringApplication(MyApplication.class);
         app.addInitializers(new ApplicationContextInitializer<ConfigurableApplicationContext>() {

           public void initialize(ConfigurableApplicationContext applicationContext) {

             new Weld().initialize();




      Then, Weld will scan/load all the beans defined under my application project. This works fine when I run it on Intellij without creating a fat job.


      When I create a fat job, all my application classes go to BOOT-INF/classes and all the dependencies (including weld jars) go to BOOT-INF/lib. Weld finds all my application classes as "BOOT-INF.classes.com.mycompany.MyBean.class, for example. Then the classloader fails to load it and throws


           WELD-000119: Not generating any bean definitions from BOOT-INF.classes.com.mycompany.MyBean because of underlying class loading error


      I searched and found this issue before  https://issues.jboss.org/browse/WELD-2254. But it doesn't really solve the problem after trying a few different weld versions.


      I debugged and find that it can be solved with  a check to remove "BOOT-INF.classes." if it's present in class name inside WeldResourceLoader.java, like


        if (name.startsWith("BOOT-INF.classes.")) {

          name = name.substring("BOOT-INF.classes.".length());

        return getClassLoader().loadClass(name);


      Is there already some other solution/configuration which can solve the problem? If not, do you think you can add this to your next release?