-
1. Re: <main-class /> of a JBoss module.xml not being executed
alesj Nov 15, 2011 10:12 AM (in response to jaabax)I think main(String[] args) is only executed if the module is the initial module.
(module that JBoss Modules loads first)
-
2. Re: <main-class /> of a JBoss module.xml not being executed
jaabax Nov 15, 2011 10:51 AM (in response to alesj)but look what the docs says:
{quote}
A module which is defined with a "main-class" element is said to be executable. In other words, the module name can be listed on the command line, and the standard static main(String[]) method in the named module's "main-class" will be loaded and executed.
{quote}
and, do you call initial modules that modules defined on JBOSS7_HOME/standalone/configuration/standalone.xml?
e.g.:
{code}
<modules>
...
<module identifier="org.jboss.osgi.blueprint" startlevel="3"/>
...
</modules>
{code}
-
3. Re: <main-class /> of a JBoss module.xml not being executed
alesj Nov 16, 2011 5:31 AM (in response to jaabax)No, initial module is the one in standalone.conf, next to jboss-modules.jar, should be some jboss-as-*.
And, the docs say *from command line*, not later on. ;-)
-
4. Re: <main-class /> of a JBoss module.xml not being executed
jaabax Nov 16, 2011 6:01 AM (in response to alesj)so,
how do I execute the class defined in
<main-class name="br.com.my.module.framework.core.MainClass" />
? -
5. Re: <main-class /> of a JBoss module.xml not being executed
alesj Nov 16, 2011 6:03 AM (in response to jaabax)You mean from AS or standalone?
In AS you have to do it yourself, standalone - see how stadalone.conf sets up initial jboss-as-* module.
-
6. Re: <main-class /> of a JBoss module.xml not being executed
jaabax Nov 16, 2011 6:12 AM (in response to alesj){quote}
You mean from AS or standalone?
{quote}
what do you mean by "AS or standalone"?
on my understanding, AS is the application server itself and standalone is a mode of my server (like domain is another mode)
what's the difference?
-
7. Re: <main-class /> of a JBoss module.xml not being executed
alesj Nov 16, 2011 6:23 AM (in response to jaabax)Ah, ok, probably bad choice of mode.
AS - JBossAS7 usage, either standalone or domain
standalone - no JBossAS7, direct JBoss Modules usage
But I guess you mean AS, hence you're on your own for main() invocation.
e.g. perhaps you can change that module into JavaEE App client
-
8. Re: <main-class /> of a JBoss module.xml not being executed
jaabax Nov 16, 2011 6:29 AM (in response to alesj)yes, I'm talking about AS
and my server works in standalone mode (not domain) =)
but my doubt is:
how do I run the main method of the class defined by
<main-class name="br.com.my.module.framework.core.MainClass" />
in my module.xml, after my server is started? -
9. Re: <main-class /> of a JBoss module.xml not being executed
jaabax Nov 17, 2011 6:08 AM (in response to jaabax)hello Ales =)
-
10. Re: <main-class /> of a JBoss module.xml not being executed
alesj Nov 17, 2011 8:10 AM (in response to jaabax)br.com.my.module.framework.core.MainClass.main(new String[]{}) ? ;-)
-
11. Re: <main-class /> of a JBoss module.xml not being executed
jaabax Nov 18, 2011 7:21 AM (in response to alesj)yes =)
but let me reformulate my question
why should I use the <main-class /> tag on my module descriptor?
when the main method of the class defined in <main-class /> will be called?
why this tag exists?
thanks in advance!
-
12. Re: <main-class /> of a JBoss module.xml not being executed
beve Nov 18, 2011 7:18 AM (in response to jaabax)1 of 1 people found this helpfulwhy should I use the <main-class /> tag on my module descriptor?
when the main method of the class defined in <main-class /> will be called?
You would perhaps do this when you are using JBoss Modules standalone, like Ales said. For example:
java -jar jboss-modules.jar -mp modules br.com.my.module
If you require somthing to be performed upon startup perhaps using the ServiceActivator could be an option. An example can be found here.
Regards,
/Daniel