6 Replies Latest reply on May 17, 2010 6:48 PM by vdeminico

    components scan in different projects

    vdeminico

      Hi,
      I'm creating a seam webapp under eclipse... I have two eclipse projects, one in which there's the core application code (entities and services class) - called core- , and the other in which I have xhtml, action components, etc - called web -. The first project is compiled as a jar and it is used by the second project. Obviously the core project has a lot of seam components that the other project uses. When the webapplication starts, the seam engine loads only the components defined on the web project. The cause could be that the seam engine scanner finds only components defined into the package in which it lives. One solution is to manually define each external component into the components.xml of the web project and it works fine. But... what about the use of annotation??? I'd want that when application starts all components are found by the scanner, also the annotated one...


      Thanks,
      Valerio.

        • 1. Re: components scan in different projects
          lvdberg

          Hi Valerio,


          You can make this work, however you need to be aware of  a number of restrictions. The jar file with the annotated beans should be visible for the war-file, meaning you need to have it also in the deploy directory. Furthermore the jar needs to have a marker-file such as an empty seam.properties so Seam will scan through the jar. Finally the War must be loaded AFTER the jar. This gives problems in some Appservers, but it works fine nder Jboss 5.1


          Leo

          • 2. Re: components scan in different projects
            vdeminico

            Ok, it works fine also with Tomcat 6.


            Thanks,
            Valerio

            • 3. Re: components scan in different projects
              clay.clay.ratliff.bsgclearing.com

              Is it necessary to include a components.xml file in the external jar? I have a similar issue where the classes aren't being loaded from an external jar file that we're using as a common library for several projects. It has a seams.properties file, it is loaded before the war file but the annotated classes it contains are never being brought into seam.


              Any ideas?


              Clay

              • 4. Re: components scan in different projects
                vdeminico

                No, components.xml is not necessary... I only put a seam.properties file into root of jar file and it works. Which is the name of your properties file actually?? I hope it isn't seams.properties as you have written above... :D


                • 5. Re: components scan in different projects
                  clay.clay.ratliff.bsgclearing.com

                  valerio de minico wrote on May 17, 2010 18:25:


                  No, components.xml is not necessary... I only put a seam.properties file into root of jar file and it works.


                  OK, so the only thing needed to be scanned is seam.properties? Then I am at something of a loss. I am expecting to see the components from that file loaded appear in the seam initialization logs either before or with the components from the war file that uses it but there is nothing, even with the logging turned up to debug level.



                  Which is the name of your properties file actually?? I hope it isn't seams.properties as you have written above... :D


                  LOL No, that was a typo, it is, in fact, seam.properties. I even checked. :)


                  Click HELP for text formatting instructions. Then edit this text and check the preview.

                  • 6. Re: components scan in different projects
                    vdeminico

                    Stupid question but... is the jar with required component classes into the WEB-INF/lib directory of your webapp????