How to load Seam component from JAR file
coldgin Jul 8, 2009 9:41 PMHi. I have an annotated Seam session bean that I want to externalize from my current Seam application, and package it into a reusable .jar file. When I package the component inside a secondary jar file, add that jar file as an EJB module to my application.xml, and package the jar file inside of the .ear file, the component is not found.
After reading a little bit, I am wondering if this has to do with the jndiPattern in my components.xml file? All of the seam components that are packaged within SeamApp.jar are detected and loaded. The seam component in Utility.jar is not. Below is the project structure, annotated classes, and relevant config. Any idea how I can load the seam component from Utility.jar? Any other settings that I am missing?
Thank you.
Project packaging:
SeamApp.ear ---SeamApp.jar ---Utility.jar ---SeamApp.war
application.xml:
<module> <web> <web-uri>SeamApp.war</web-uri> <context-root>/SeamApp</context-root> </web> </module> <module> <ejb>Utility.jar</ejb> </module> <module> <ejb>SeamApp.jar</ejb> </module> <!-- Seam and EL --> <module> <ejb>jboss-seam.jar</ejb> </module>
components.xml jndiPattern value is:
SeamApp/#{ejbName}/local
Annotated classes that are packaged in Utility.jar:
@Local public interface TestController { public String testMe(); } @Stateful @Scope(ScopeType.SESSION) @Name("testComponent") public class TestManager implements TestController { @In Identity identity; // Identity of logged in user @Logger private Log log; /** * Default constructor */ public TestManager() { log.info("**** TEST COMPONENT FROM EXTERNAL JAR -> CTOR CALLED ****"); } /** * This method is for testing only * * @return String */ public String testMe() { log.info("**** TEST COMPONENT LOADED FROM EXTERNAL JAR ****"); return "hello from test component"; } }