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

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

    jaabax

      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:

      {code}

      <?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. -->

           <resources>

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

           </resources>

           <dependencies>

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

           </dependencies>

      </module>

      {code}

       

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

      {code}

      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.

           }

       

      }

      {code}

       

      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?

      thanks!