3 Replies Latest reply on Mar 7, 2007 12:00 PM by trickyvail

    How to implement cross cutting classes jar in a seam ear?

    trickyvail

      I'm trying to split my utility classes away into their own jar file so I can easily reuse them from different seam projects and maintain a single source tree. I've created a jar containing the classes but I have not been able to add the jar into my ear (or war) correctly.

      I've tried a few different approaches with no success:

      - adding the jar to project.ear/project.war/WEB-INF/lib (class not found)
      - adding the jar to project.ear/ and adding a module tag inside application.xml (bean class has no local, webservice or remote interfaces defined)
      - adding the jar to project.ear and adding a loader-repository tag inside jboss-app.xml (expected only one loader-repository tag)

      Some of the classes inside my jar are seam components which is why I've posted this question in the seam forum. My project.ear is esentially a generic empty seam-gen project to which I've added my jar.

        • 1. Re: How to implement cross cutting classes jar in a seam ear
          pmuir

           

          - adding the jar to project.ear/ and adding a module tag inside application.xml (bean class has no local, webservice or remote interfaces defined)
          This works if the components are just Seam JavaBeans

          • 2. Re: How to implement cross cutting classes jar in a seam ear
            trickyvail

            I've got my utility classes working. Here's how:

            Added utility.jar to the root of project.ear.

            Edited project.ear/META-INF/application.xml and added

            <module>
             <java>utility.jar</java>
             </module>


            Thanks for yout reply, I was not seeing that this approach worked because I had introduced another similar error in a different part of the application.

            This has lead me to seek an answer to another question. If you want to deploy fully fledged statefull or stateless ejb3 session beans would you use a tag like this (in application.xml):
            <module>
             <ejb>ejb_bean_classes.jar</ejb>
             </module>


            I'll give it a try.

            • 3. Re: How to implement cross cutting classes jar in a seam ear
              trickyvail

              Small note:

              You need to make sure you have an empty seam.properties file in the root of your jar file so the seam components inside the jar will be deployed.