Error when try run Weld Se Applicaton - Weld SE container cannot be initialized - no bean archives found












3















I create a simple JavaSE app using Weld SE.
I'm I try to run with gradle run it throws an exception:



:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:runmai 17, 2016 12:55:55 AM org.jboss.weld.bootstrap.WeldStartup <clinit>
INFO: WELD-000900: 2.3.4 (Final)
Exception in thread "main" java.lang.IllegalStateException: WELD-ENV-002009: Weld SE container cannot be initialized - no bean archives found
at org.jboss.weld.environment.se.Weld.createDeployment(Weld.java:690)

at org.jboss.weld.environment.se.Weld.initialize(Weld.java:570)
at br.com.alexpfx.crawler.run.Main.main(Main.java:14)
FAILED
1 result found for 'bean-discovery-mode'Finding with Options: Case Insensitive

y
bean-discovery-mode
1 found
Find






Replace in current buffer
Replace
Replace All
Gradle: runFile 0Project 0No IssuessrcmainresourcesMETA-INFbeans.xml10:1
CRLFUTF-8XML1 update


What I understand is that it cannot find beans.xml file. But it is there in src/main/resources/META-INF/beans.xml:



<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
bean-discovery-mode="all"
version="1.1">


</beans>


My main class is:



package br.com.alexpfx.crawler.run;
import org.jboss.weld.environment.se.*;
import javax.enterprise.inject.*;
import javax.inject.*;
import br.com.alexpfx.crawler.*;
public class Main {

@Inject
private @Named("SuperMarket") Crawler crawler;


public static void main(String args) {
Weld weld = new Weld();
WeldContainer container = weld.initialize();
Main main = container.instance().select(Main.class).get();
main.run();
weld.shutdown();
}


public void run() {

System.out.println (crawler);

}
}


the build gradle file is:



apply plugin: 'java'
apply plugin: 'application'



repositories{
mavenCentral()
}


dependencies{
// http://mvnrepository.com/artifact/org.jsoup/jsoup
compile group: 'org.jsoup', name: 'jsoup', version: '1.9.1'

// http://mvnrepository.com/artifact/org.jboss.weld.se/weld-se-core
compile group: 'org.jboss.weld.se', name: 'weld-se-core', version: '2.3.4.Final'



}

sourceCompatibility = '1.8'
version = '1.0'
mainClassName = 'br.com.alexpfx.crawler.run.Main'









share|improve this question



























    3















    I create a simple JavaSE app using Weld SE.
    I'm I try to run with gradle run it throws an exception:



    :compileJava UP-TO-DATE
    :processResources UP-TO-DATE
    :classes UP-TO-DATE
    :runmai 17, 2016 12:55:55 AM org.jboss.weld.bootstrap.WeldStartup <clinit>
    INFO: WELD-000900: 2.3.4 (Final)
    Exception in thread "main" java.lang.IllegalStateException: WELD-ENV-002009: Weld SE container cannot be initialized - no bean archives found
    at org.jboss.weld.environment.se.Weld.createDeployment(Weld.java:690)

    at org.jboss.weld.environment.se.Weld.initialize(Weld.java:570)
    at br.com.alexpfx.crawler.run.Main.main(Main.java:14)
    FAILED
    1 result found for 'bean-discovery-mode'Finding with Options: Case Insensitive

    y
    bean-discovery-mode
    1 found
    Find






    Replace in current buffer
    Replace
    Replace All
    Gradle: runFile 0Project 0No IssuessrcmainresourcesMETA-INFbeans.xml10:1
    CRLFUTF-8XML1 update


    What I understand is that it cannot find beans.xml file. But it is there in src/main/resources/META-INF/beans.xml:



    <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
    http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
    bean-discovery-mode="all"
    version="1.1">


    </beans>


    My main class is:



    package br.com.alexpfx.crawler.run;
    import org.jboss.weld.environment.se.*;
    import javax.enterprise.inject.*;
    import javax.inject.*;
    import br.com.alexpfx.crawler.*;
    public class Main {

    @Inject
    private @Named("SuperMarket") Crawler crawler;


    public static void main(String args) {
    Weld weld = new Weld();
    WeldContainer container = weld.initialize();
    Main main = container.instance().select(Main.class).get();
    main.run();
    weld.shutdown();
    }


    public void run() {

    System.out.println (crawler);

    }
    }


    the build gradle file is:



    apply plugin: 'java'
    apply plugin: 'application'



    repositories{
    mavenCentral()
    }


    dependencies{
    // http://mvnrepository.com/artifact/org.jsoup/jsoup
    compile group: 'org.jsoup', name: 'jsoup', version: '1.9.1'

    // http://mvnrepository.com/artifact/org.jboss.weld.se/weld-se-core
    compile group: 'org.jboss.weld.se', name: 'weld-se-core', version: '2.3.4.Final'



    }

    sourceCompatibility = '1.8'
    version = '1.0'
    mainClassName = 'br.com.alexpfx.crawler.run.Main'









    share|improve this question

























      3












      3








      3


      2






      I create a simple JavaSE app using Weld SE.
      I'm I try to run with gradle run it throws an exception:



      :compileJava UP-TO-DATE
      :processResources UP-TO-DATE
      :classes UP-TO-DATE
      :runmai 17, 2016 12:55:55 AM org.jboss.weld.bootstrap.WeldStartup <clinit>
      INFO: WELD-000900: 2.3.4 (Final)
      Exception in thread "main" java.lang.IllegalStateException: WELD-ENV-002009: Weld SE container cannot be initialized - no bean archives found
      at org.jboss.weld.environment.se.Weld.createDeployment(Weld.java:690)

      at org.jboss.weld.environment.se.Weld.initialize(Weld.java:570)
      at br.com.alexpfx.crawler.run.Main.main(Main.java:14)
      FAILED
      1 result found for 'bean-discovery-mode'Finding with Options: Case Insensitive

      y
      bean-discovery-mode
      1 found
      Find






      Replace in current buffer
      Replace
      Replace All
      Gradle: runFile 0Project 0No IssuessrcmainresourcesMETA-INFbeans.xml10:1
      CRLFUTF-8XML1 update


      What I understand is that it cannot find beans.xml file. But it is there in src/main/resources/META-INF/beans.xml:



      <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
      http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
      bean-discovery-mode="all"
      version="1.1">


      </beans>


      My main class is:



      package br.com.alexpfx.crawler.run;
      import org.jboss.weld.environment.se.*;
      import javax.enterprise.inject.*;
      import javax.inject.*;
      import br.com.alexpfx.crawler.*;
      public class Main {

      @Inject
      private @Named("SuperMarket") Crawler crawler;


      public static void main(String args) {
      Weld weld = new Weld();
      WeldContainer container = weld.initialize();
      Main main = container.instance().select(Main.class).get();
      main.run();
      weld.shutdown();
      }


      public void run() {

      System.out.println (crawler);

      }
      }


      the build gradle file is:



      apply plugin: 'java'
      apply plugin: 'application'



      repositories{
      mavenCentral()
      }


      dependencies{
      // http://mvnrepository.com/artifact/org.jsoup/jsoup
      compile group: 'org.jsoup', name: 'jsoup', version: '1.9.1'

      // http://mvnrepository.com/artifact/org.jboss.weld.se/weld-se-core
      compile group: 'org.jboss.weld.se', name: 'weld-se-core', version: '2.3.4.Final'



      }

      sourceCompatibility = '1.8'
      version = '1.0'
      mainClassName = 'br.com.alexpfx.crawler.run.Main'









      share|improve this question














      I create a simple JavaSE app using Weld SE.
      I'm I try to run with gradle run it throws an exception:



      :compileJava UP-TO-DATE
      :processResources UP-TO-DATE
      :classes UP-TO-DATE
      :runmai 17, 2016 12:55:55 AM org.jboss.weld.bootstrap.WeldStartup <clinit>
      INFO: WELD-000900: 2.3.4 (Final)
      Exception in thread "main" java.lang.IllegalStateException: WELD-ENV-002009: Weld SE container cannot be initialized - no bean archives found
      at org.jboss.weld.environment.se.Weld.createDeployment(Weld.java:690)

      at org.jboss.weld.environment.se.Weld.initialize(Weld.java:570)
      at br.com.alexpfx.crawler.run.Main.main(Main.java:14)
      FAILED
      1 result found for 'bean-discovery-mode'Finding with Options: Case Insensitive

      y
      bean-discovery-mode
      1 found
      Find






      Replace in current buffer
      Replace
      Replace All
      Gradle: runFile 0Project 0No IssuessrcmainresourcesMETA-INFbeans.xml10:1
      CRLFUTF-8XML1 update


      What I understand is that it cannot find beans.xml file. But it is there in src/main/resources/META-INF/beans.xml:



      <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
      http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
      bean-discovery-mode="all"
      version="1.1">


      </beans>


      My main class is:



      package br.com.alexpfx.crawler.run;
      import org.jboss.weld.environment.se.*;
      import javax.enterprise.inject.*;
      import javax.inject.*;
      import br.com.alexpfx.crawler.*;
      public class Main {

      @Inject
      private @Named("SuperMarket") Crawler crawler;


      public static void main(String args) {
      Weld weld = new Weld();
      WeldContainer container = weld.initialize();
      Main main = container.instance().select(Main.class).get();
      main.run();
      weld.shutdown();
      }


      public void run() {

      System.out.println (crawler);

      }
      }


      the build gradle file is:



      apply plugin: 'java'
      apply plugin: 'application'



      repositories{
      mavenCentral()
      }


      dependencies{
      // http://mvnrepository.com/artifact/org.jsoup/jsoup
      compile group: 'org.jsoup', name: 'jsoup', version: '1.9.1'

      // http://mvnrepository.com/artifact/org.jboss.weld.se/weld-se-core
      compile group: 'org.jboss.weld.se', name: 'weld-se-core', version: '2.3.4.Final'



      }

      sourceCompatibility = '1.8'
      version = '1.0'
      mainClassName = 'br.com.alexpfx.crawler.run.Main'






      java gradle jboss-weld weld-se






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked May 17 '16 at 3:59









      alexpfxalexpfx

      1,80341943




      1,80341943
























          3 Answers
          3






          active

          oldest

          votes


















          6














          The problem is that gradle run does not build the jar file for your app. It simply compiles the classes and runs the main class with the resources directory on the classpath (do gradle --info run to see this for yourself). Weld requires a bean archive which is a jar file that contains META-INF/beans.xml or a war file that contains WEB-INF/classes/META-INF/beans.xml. It's not enough for beans.xml to just be on the classpath.



          To get around this, since you're using the application plugin, just do a gradle installDist and run the shell script or batch file in build/install/myapp/bin.






          share|improve this answer

































            1














            I have tried the solution provided by @drenedo (sorry I don't have enough reputation for comment), the following code works fine with me:



            sourceSets.main.resources {
            exclude 'META-INF/beans.xml'
            }
            classes {
            doLast{
            copy {
            from('src/main/resources') { include 'META-INF/beans.xml' }
            into "$buildDir/classes/java/main/"
            }
            }
            }


            And I'm a little confused about what the following code is intended for. Since src/main/resources/META-INF/beans.xml and $buildDir/classes/main/META-INF/beans.xml are not directories, this code would cause an error. So I just simply delete it:



            inputs.dir 'src/main/resources/META-INF/beans.xml'
            outputs.dir "$buildDir/classes/main/META-INF/beans.xml"


            And the solution answered by @J. Lenthe also works fine with me.



            Also you can try this bean-discovery-problems-when-using-weld-se-with-gradle-application-plugin :



            task copyResources(type: Copy) {
            from "${projectDir}/src/main/resources"
            into "${buildDir}/classes/java/main"
            }
            processResources.dependsOn copyResources


            Gradle 4+ uses a different output directory for the classes, so remember to use ${buildDir}/classes/java/main instead of ${buildDir}/classes/main.






            share|improve this answer

































              0














              I solved this issue by adding sourceSets.main.resources in the build.gradle:



              sourceSets.main.resources {
              exclude 'META-INF/beans.xml'
              }
              classes {
              inputs.dir 'src/main/resources/META-INF/beans.xml'
              outputs.dir "$buildDir/classes/main/META-INF/beans.xml"
              } << {
              copy {
              from('src/main/resources') { include 'META-INF/beans.xml' }
              into "$buildDir/classes/main/"
              }
              }


              With the given example:



              apply plugin: 'java'
              apply plugin: 'application'



              repositories{
              mavenCentral()
              }


              dependencies{
              // http://mvnrepository.com/artifact/org.jsoup/jsoup
              compile group: 'org.jsoup', name: 'jsoup', version: '1.9.1'

              // http://mvnrepository.com/artifact/org.jboss.weld.se/weld-se-core
              compile group: 'org.jboss.weld.se', name: 'weld-se-core', version: '2.3.4.Final'
              }

              sourceSets.main.resources {
              exclude 'META-INF/beans.xml'
              }
              classes {
              inputs.dir 'src/main/resources/META-INF/beans.xml'
              outputs.dir "$buildDir/classes/main/META-INF/beans.xml"
              } << {
              copy {
              from('src/main/resources') { include 'META-INF/beans.xml' }
              into "$buildDir/classes/main/"
              }
              }

              sourceCompatibility = '1.8'
              version = '1.0'
              mainClassName = 'br.com.alexpfx.crawler.run.Main'





              share|improve this answer























                Your Answer






                StackExchange.ifUsing("editor", function () {
                StackExchange.using("externalEditor", function () {
                StackExchange.using("snippets", function () {
                StackExchange.snippets.init();
                });
                });
                }, "code-snippets");

                StackExchange.ready(function() {
                var channelOptions = {
                tags: "".split(" "),
                id: "1"
                };
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function() {
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled) {
                StackExchange.using("snippets", function() {
                createEditor();
                });
                }
                else {
                createEditor();
                }
                });

                function createEditor() {
                StackExchange.prepareEditor({
                heartbeatType: 'answer',
                autoActivateHeartbeat: false,
                convertImagesToLinks: true,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: 10,
                bindNavPrevention: true,
                postfix: "",
                imageUploader: {
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                },
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                });


                }
                });














                draft saved

                draft discarded


















                StackExchange.ready(
                function () {
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f37266860%2ferror-when-try-run-weld-se-applicaton-weld-se-container-cannot-be-initialized%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                3 Answers
                3






                active

                oldest

                votes








                3 Answers
                3






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                6














                The problem is that gradle run does not build the jar file for your app. It simply compiles the classes and runs the main class with the resources directory on the classpath (do gradle --info run to see this for yourself). Weld requires a bean archive which is a jar file that contains META-INF/beans.xml or a war file that contains WEB-INF/classes/META-INF/beans.xml. It's not enough for beans.xml to just be on the classpath.



                To get around this, since you're using the application plugin, just do a gradle installDist and run the shell script or batch file in build/install/myapp/bin.






                share|improve this answer






























                  6














                  The problem is that gradle run does not build the jar file for your app. It simply compiles the classes and runs the main class with the resources directory on the classpath (do gradle --info run to see this for yourself). Weld requires a bean archive which is a jar file that contains META-INF/beans.xml or a war file that contains WEB-INF/classes/META-INF/beans.xml. It's not enough for beans.xml to just be on the classpath.



                  To get around this, since you're using the application plugin, just do a gradle installDist and run the shell script or batch file in build/install/myapp/bin.






                  share|improve this answer




























                    6












                    6








                    6







                    The problem is that gradle run does not build the jar file for your app. It simply compiles the classes and runs the main class with the resources directory on the classpath (do gradle --info run to see this for yourself). Weld requires a bean archive which is a jar file that contains META-INF/beans.xml or a war file that contains WEB-INF/classes/META-INF/beans.xml. It's not enough for beans.xml to just be on the classpath.



                    To get around this, since you're using the application plugin, just do a gradle installDist and run the shell script or batch file in build/install/myapp/bin.






                    share|improve this answer















                    The problem is that gradle run does not build the jar file for your app. It simply compiles the classes and runs the main class with the resources directory on the classpath (do gradle --info run to see this for yourself). Weld requires a bean archive which is a jar file that contains META-INF/beans.xml or a war file that contains WEB-INF/classes/META-INF/beans.xml. It's not enough for beans.xml to just be on the classpath.



                    To get around this, since you're using the application plugin, just do a gradle installDist and run the shell script or batch file in build/install/myapp/bin.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Mar 9 '17 at 21:25

























                    answered Mar 9 '17 at 20:19









                    J. LentheJ. Lenthe

                    23628




                    23628

























                        1














                        I have tried the solution provided by @drenedo (sorry I don't have enough reputation for comment), the following code works fine with me:



                        sourceSets.main.resources {
                        exclude 'META-INF/beans.xml'
                        }
                        classes {
                        doLast{
                        copy {
                        from('src/main/resources') { include 'META-INF/beans.xml' }
                        into "$buildDir/classes/java/main/"
                        }
                        }
                        }


                        And I'm a little confused about what the following code is intended for. Since src/main/resources/META-INF/beans.xml and $buildDir/classes/main/META-INF/beans.xml are not directories, this code would cause an error. So I just simply delete it:



                        inputs.dir 'src/main/resources/META-INF/beans.xml'
                        outputs.dir "$buildDir/classes/main/META-INF/beans.xml"


                        And the solution answered by @J. Lenthe also works fine with me.



                        Also you can try this bean-discovery-problems-when-using-weld-se-with-gradle-application-plugin :



                        task copyResources(type: Copy) {
                        from "${projectDir}/src/main/resources"
                        into "${buildDir}/classes/java/main"
                        }
                        processResources.dependsOn copyResources


                        Gradle 4+ uses a different output directory for the classes, so remember to use ${buildDir}/classes/java/main instead of ${buildDir}/classes/main.






                        share|improve this answer






























                          1














                          I have tried the solution provided by @drenedo (sorry I don't have enough reputation for comment), the following code works fine with me:



                          sourceSets.main.resources {
                          exclude 'META-INF/beans.xml'
                          }
                          classes {
                          doLast{
                          copy {
                          from('src/main/resources') { include 'META-INF/beans.xml' }
                          into "$buildDir/classes/java/main/"
                          }
                          }
                          }


                          And I'm a little confused about what the following code is intended for. Since src/main/resources/META-INF/beans.xml and $buildDir/classes/main/META-INF/beans.xml are not directories, this code would cause an error. So I just simply delete it:



                          inputs.dir 'src/main/resources/META-INF/beans.xml'
                          outputs.dir "$buildDir/classes/main/META-INF/beans.xml"


                          And the solution answered by @J. Lenthe also works fine with me.



                          Also you can try this bean-discovery-problems-when-using-weld-se-with-gradle-application-plugin :



                          task copyResources(type: Copy) {
                          from "${projectDir}/src/main/resources"
                          into "${buildDir}/classes/java/main"
                          }
                          processResources.dependsOn copyResources


                          Gradle 4+ uses a different output directory for the classes, so remember to use ${buildDir}/classes/java/main instead of ${buildDir}/classes/main.






                          share|improve this answer




























                            1












                            1








                            1







                            I have tried the solution provided by @drenedo (sorry I don't have enough reputation for comment), the following code works fine with me:



                            sourceSets.main.resources {
                            exclude 'META-INF/beans.xml'
                            }
                            classes {
                            doLast{
                            copy {
                            from('src/main/resources') { include 'META-INF/beans.xml' }
                            into "$buildDir/classes/java/main/"
                            }
                            }
                            }


                            And I'm a little confused about what the following code is intended for. Since src/main/resources/META-INF/beans.xml and $buildDir/classes/main/META-INF/beans.xml are not directories, this code would cause an error. So I just simply delete it:



                            inputs.dir 'src/main/resources/META-INF/beans.xml'
                            outputs.dir "$buildDir/classes/main/META-INF/beans.xml"


                            And the solution answered by @J. Lenthe also works fine with me.



                            Also you can try this bean-discovery-problems-when-using-weld-se-with-gradle-application-plugin :



                            task copyResources(type: Copy) {
                            from "${projectDir}/src/main/resources"
                            into "${buildDir}/classes/java/main"
                            }
                            processResources.dependsOn copyResources


                            Gradle 4+ uses a different output directory for the classes, so remember to use ${buildDir}/classes/java/main instead of ${buildDir}/classes/main.






                            share|improve this answer















                            I have tried the solution provided by @drenedo (sorry I don't have enough reputation for comment), the following code works fine with me:



                            sourceSets.main.resources {
                            exclude 'META-INF/beans.xml'
                            }
                            classes {
                            doLast{
                            copy {
                            from('src/main/resources') { include 'META-INF/beans.xml' }
                            into "$buildDir/classes/java/main/"
                            }
                            }
                            }


                            And I'm a little confused about what the following code is intended for. Since src/main/resources/META-INF/beans.xml and $buildDir/classes/main/META-INF/beans.xml are not directories, this code would cause an error. So I just simply delete it:



                            inputs.dir 'src/main/resources/META-INF/beans.xml'
                            outputs.dir "$buildDir/classes/main/META-INF/beans.xml"


                            And the solution answered by @J. Lenthe also works fine with me.



                            Also you can try this bean-discovery-problems-when-using-weld-se-with-gradle-application-plugin :



                            task copyResources(type: Copy) {
                            from "${projectDir}/src/main/resources"
                            into "${buildDir}/classes/java/main"
                            }
                            processResources.dependsOn copyResources


                            Gradle 4+ uses a different output directory for the classes, so remember to use ${buildDir}/classes/java/main instead of ${buildDir}/classes/main.







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Nov 27 '18 at 3:17

























                            answered Nov 27 '18 at 2:29









                            zhangwanyuezhangwanyue

                            113




                            113























                                0














                                I solved this issue by adding sourceSets.main.resources in the build.gradle:



                                sourceSets.main.resources {
                                exclude 'META-INF/beans.xml'
                                }
                                classes {
                                inputs.dir 'src/main/resources/META-INF/beans.xml'
                                outputs.dir "$buildDir/classes/main/META-INF/beans.xml"
                                } << {
                                copy {
                                from('src/main/resources') { include 'META-INF/beans.xml' }
                                into "$buildDir/classes/main/"
                                }
                                }


                                With the given example:



                                apply plugin: 'java'
                                apply plugin: 'application'



                                repositories{
                                mavenCentral()
                                }


                                dependencies{
                                // http://mvnrepository.com/artifact/org.jsoup/jsoup
                                compile group: 'org.jsoup', name: 'jsoup', version: '1.9.1'

                                // http://mvnrepository.com/artifact/org.jboss.weld.se/weld-se-core
                                compile group: 'org.jboss.weld.se', name: 'weld-se-core', version: '2.3.4.Final'
                                }

                                sourceSets.main.resources {
                                exclude 'META-INF/beans.xml'
                                }
                                classes {
                                inputs.dir 'src/main/resources/META-INF/beans.xml'
                                outputs.dir "$buildDir/classes/main/META-INF/beans.xml"
                                } << {
                                copy {
                                from('src/main/resources') { include 'META-INF/beans.xml' }
                                into "$buildDir/classes/main/"
                                }
                                }

                                sourceCompatibility = '1.8'
                                version = '1.0'
                                mainClassName = 'br.com.alexpfx.crawler.run.Main'





                                share|improve this answer




























                                  0














                                  I solved this issue by adding sourceSets.main.resources in the build.gradle:



                                  sourceSets.main.resources {
                                  exclude 'META-INF/beans.xml'
                                  }
                                  classes {
                                  inputs.dir 'src/main/resources/META-INF/beans.xml'
                                  outputs.dir "$buildDir/classes/main/META-INF/beans.xml"
                                  } << {
                                  copy {
                                  from('src/main/resources') { include 'META-INF/beans.xml' }
                                  into "$buildDir/classes/main/"
                                  }
                                  }


                                  With the given example:



                                  apply plugin: 'java'
                                  apply plugin: 'application'



                                  repositories{
                                  mavenCentral()
                                  }


                                  dependencies{
                                  // http://mvnrepository.com/artifact/org.jsoup/jsoup
                                  compile group: 'org.jsoup', name: 'jsoup', version: '1.9.1'

                                  // http://mvnrepository.com/artifact/org.jboss.weld.se/weld-se-core
                                  compile group: 'org.jboss.weld.se', name: 'weld-se-core', version: '2.3.4.Final'
                                  }

                                  sourceSets.main.resources {
                                  exclude 'META-INF/beans.xml'
                                  }
                                  classes {
                                  inputs.dir 'src/main/resources/META-INF/beans.xml'
                                  outputs.dir "$buildDir/classes/main/META-INF/beans.xml"
                                  } << {
                                  copy {
                                  from('src/main/resources') { include 'META-INF/beans.xml' }
                                  into "$buildDir/classes/main/"
                                  }
                                  }

                                  sourceCompatibility = '1.8'
                                  version = '1.0'
                                  mainClassName = 'br.com.alexpfx.crawler.run.Main'





                                  share|improve this answer


























                                    0












                                    0








                                    0







                                    I solved this issue by adding sourceSets.main.resources in the build.gradle:



                                    sourceSets.main.resources {
                                    exclude 'META-INF/beans.xml'
                                    }
                                    classes {
                                    inputs.dir 'src/main/resources/META-INF/beans.xml'
                                    outputs.dir "$buildDir/classes/main/META-INF/beans.xml"
                                    } << {
                                    copy {
                                    from('src/main/resources') { include 'META-INF/beans.xml' }
                                    into "$buildDir/classes/main/"
                                    }
                                    }


                                    With the given example:



                                    apply plugin: 'java'
                                    apply plugin: 'application'



                                    repositories{
                                    mavenCentral()
                                    }


                                    dependencies{
                                    // http://mvnrepository.com/artifact/org.jsoup/jsoup
                                    compile group: 'org.jsoup', name: 'jsoup', version: '1.9.1'

                                    // http://mvnrepository.com/artifact/org.jboss.weld.se/weld-se-core
                                    compile group: 'org.jboss.weld.se', name: 'weld-se-core', version: '2.3.4.Final'
                                    }

                                    sourceSets.main.resources {
                                    exclude 'META-INF/beans.xml'
                                    }
                                    classes {
                                    inputs.dir 'src/main/resources/META-INF/beans.xml'
                                    outputs.dir "$buildDir/classes/main/META-INF/beans.xml"
                                    } << {
                                    copy {
                                    from('src/main/resources') { include 'META-INF/beans.xml' }
                                    into "$buildDir/classes/main/"
                                    }
                                    }

                                    sourceCompatibility = '1.8'
                                    version = '1.0'
                                    mainClassName = 'br.com.alexpfx.crawler.run.Main'





                                    share|improve this answer













                                    I solved this issue by adding sourceSets.main.resources in the build.gradle:



                                    sourceSets.main.resources {
                                    exclude 'META-INF/beans.xml'
                                    }
                                    classes {
                                    inputs.dir 'src/main/resources/META-INF/beans.xml'
                                    outputs.dir "$buildDir/classes/main/META-INF/beans.xml"
                                    } << {
                                    copy {
                                    from('src/main/resources') { include 'META-INF/beans.xml' }
                                    into "$buildDir/classes/main/"
                                    }
                                    }


                                    With the given example:



                                    apply plugin: 'java'
                                    apply plugin: 'application'



                                    repositories{
                                    mavenCentral()
                                    }


                                    dependencies{
                                    // http://mvnrepository.com/artifact/org.jsoup/jsoup
                                    compile group: 'org.jsoup', name: 'jsoup', version: '1.9.1'

                                    // http://mvnrepository.com/artifact/org.jboss.weld.se/weld-se-core
                                    compile group: 'org.jboss.weld.se', name: 'weld-se-core', version: '2.3.4.Final'
                                    }

                                    sourceSets.main.resources {
                                    exclude 'META-INF/beans.xml'
                                    }
                                    classes {
                                    inputs.dir 'src/main/resources/META-INF/beans.xml'
                                    outputs.dir "$buildDir/classes/main/META-INF/beans.xml"
                                    } << {
                                    copy {
                                    from('src/main/resources') { include 'META-INF/beans.xml' }
                                    into "$buildDir/classes/main/"
                                    }
                                    }

                                    sourceCompatibility = '1.8'
                                    version = '1.0'
                                    mainClassName = 'br.com.alexpfx.crawler.run.Main'






                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered May 11 '17 at 19:53









                                    drenedodrenedo

                                    695




                                    695






























                                        draft saved

                                        draft discarded




















































                                        Thanks for contributing an answer to Stack Overflow!


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid



                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.


                                        To learn more, see our tips on writing great answers.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function () {
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f37266860%2ferror-when-try-run-weld-se-applicaton-weld-se-container-cannot-be-initialized%23new-answer', 'question_page');
                                        }
                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        Popular posts from this blog

                                        Contact image not getting when fetch all contact list from iPhone by CNContact

                                        count number of partitions of a set with n elements into k subsets

                                        A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks