2 Replies Latest reply on Sep 14, 2009 9:54 AM by rafaelri

    Injection in App Client only works if main-class is present

    rafaelri

      Hi all,

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

      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? Or is it a minor issue? And if it is expected, isnt it redundant since you also specify the main class when invoking "org.jboss.client.AppClientMain" ?

      I have provided an EAR that can be deployed directly on JBoss and reproduces what I found: http://itdevworld.files.wordpress.com/2009/09/injection.pdf

      The EAR is attached on the first page of the PDF, I've also provided the sources on each page so if anyone is interested on building the EAR.
      The last page of the PDF is also the command line I am using to execute JBoss App Client launcher. You can safely save it as a batch and invoke it with the following arguments:

      appclient.bat foo.Main QueueClient (injection works since this class is specified as a Main-Class on Manifest)

      appclient.bat foo.NotMain QueueClient (injection fails since this class is NOT specified as Main-Class on Manifest)

      best regards,

        • 1. Re: Injection in App Client only works if main-class is pres
          jaikiran

           

          "rafaelri" wrote:


          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.

          • 2. Re: Injection in App Client only works if main-class is pres
            rafaelri

            Jaikiran,

            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?

            regards,
            Rafael Ribeiro