12 Replies Latest reply on Nov 18, 2011 7:18 AM by Daniel Bevenius

    <main-class /> of a JBoss module.xml not being executed

    jaabax Newbie

      hi folks

      according to the JBoss 7 tutorial at https://docs.jboss.org/author/display/MODULES/Module+descriptors I can create a main class to be executed when my module is being connected (I have created a new module at jboss-as-web-7.0.2.Final/modules/br/com/my/module/main)


      at my module.xml I have:


      <?xml version="1.0" encoding="UTF-8"?>

      <module xmlns="urn:jboss:module:1.0" name="br.com.my.module">

           <main-class name="br.com.my.module.framework.core.MainClass" /> <!-- The main class I want to be executed. -->


                <resource-root path="myModule-core-0.0.1-SNAPSHOT.jar" />



                <module name="javax.persistence.api"/> <!-- My module is using javax.persistence.EntityManager class. -->





      and at br.com.my.module.framework.core.MainClass.java I have:


      package br.com.my.module.framework.core;


      public class MainClass {


           public static void main(String[] args) {

                System.out.println("### HERE!!!"); // I've putted a breakpoint for debug here.






      but my module is not being executed when I start JBoss 7

      the debugger does not stop at System.out.println("### HERE!!!");

      and I don't have any "### HERE!!!" message on any standalone log file (nor in the Eclipse console log)

      how can I be sure that my module is running?

      I'm facing problems with creating my own modules because they never run (I'm searching for days for an answer to this, making a lot of tests and Google searches)

      can somebody help me with this issue?