I am not sure whether this is the correct behaviour but as I could not find the Application Client JSR to check it out I am asking it over here (and also providing a sample).
Chapter EE.9 in Java EE5 spec.
During some tests with JBoss 5 Application Client deployment I noticed that injection only occurs in case the invoked main class is also the Main-Class specified on MANIFEST.MF. Is it the correct behaviour?
Yes, that's the expected behaviour.
As it is what the spec states I have now two questions:
1- Does it make sense to specify a different main class and end up having no injection ?
2- I just realized that "-jbossclient" parameter is optional but in an attempt to launch the client without it I got the exception below:
2009-09-14 10:48:00,610 INFO [main][org.jboss.client.AppClientMain] - <j2ee.clientName=QueueClient> Exception in thread "main" java.lang.IllegalArgumentException: Neither a Main-Class was found in the manifest, nor was a -jbossclient specified at org.jboss.client.AppClientMain.main(AppClientMain.java:115)
And the strange thing about this exception is that in fact I had a Main-Class in the MANIFEST.MF file (as you can verify on the EAR I provided). Isnt it strange?