WildFly does not run main class from custom added module

721 views Asked by At

I have added on custom module to WildFly 9. The JAR file has one main class as below:

package com.demo;

public class Main {
    static{
        System.out.println("**********************This is from main static********************");
    }
    public static void main(String[] args) {
        System.out.println("**********************This is from main********************");
    }
}

The module.xml file has the following content:

<?xml version="1.0" ?>

<module xmlns="urn:jboss:module:1.1" name="com.demo">
    <main-class name="com.demo.Main"/>
    <resources>
        <resource-root path="Demo.jar"/>
    </resources>
</module>

I have manually copied both files under wildfly\modules\system\layers\base\com\demo\main. But when I start WildFly I can not see either of the System.out.println lines.

Then I added module using jboss-cli command and it has added modules under wildfly-9.0.2.Final\modules\com\demo\main. But still on start of WildFly I can not see any System.out.println.

Can someone please tell me what I'm doing wrong? Thanks!

0

There are 0 answers