0

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!

TT.
  • 15,774
  • 6
  • 47
  • 88
Alpesh Jikadra
  • 1,692
  • 3
  • 18
  • 38
  • 1
    Can you tell us a bit more about what you're trying to do? I am positive that Wildlfy would not run a main() method. There are examples of, for example, custom login modules to base your code on. What are you trying to do in your module? – stdunbar Dec 20 '16 at 19:52
  • Please add more information about your use case. – Simon Martinelli Dec 20 '16 at 19:54
  • I am trying to **register dataSource as JNDI** , these are **dynamic JNDI** which is used by my **5 application** which is deployed on same wildfly instance, These JNDI details are read from the Database – Alpesh Jikadra Dec 21 '16 at 05:44

0 Answers0