2 Replies Latest reply on Mar 4, 2009 5:59 PM by Norman Richards

    How to use Seam components in non-web applications

    Manish Bhadoria Newbie

      Hi



      Has anyone tried using Seam in a non-web application?


      I am trying to use seam components in a ear that does not have any war file. There are 3 ejb modules in the ear and one of these ear-module has few @Name annotated components too. This ear-module project follows maven structure where seam related files are placed as following:



      •     components.xml file is present in the src/main/resources/META-INF folder.

      •    seam.properties is present in src/main/resources folder(This file has no properties defined).

      •    Declaration for SeamInterceptor is present in ejb-jar.xml file as mentined in Seam documents.






      When I deploy my ejb-module binded within a ear build in JBoss, The console logs do not show any Seam components getting loaded. An attempt to explicitly get hold of seam components (using Component.getInstance(myComponent)) results in the following error log:



      javax.ejb.EJBException: java.lang.IllegalStateException: No application context active

      Clearly the problem is in the Seam initialization. Why is it that none of the Seam components in this jar are being installed? I do not find any helpful links to guide me on how to use Seam in a non-web application. Any pointers in this direction are highly appreciated.