1 Reply Latest reply on Sep 25, 2008 1:26 PM by swd847

    Seam 2.0.2 - Multiple Seam Phase Listeners warning + Service EJBs

    axiom

      Good evening everyone,


      I have a Seam 2.0.2 prototype app in which I'm trying to dynamically add functionality at run-time. I wanted to do this by deploying multiple EARs containing EJBs, and looking them up from a host EAR.


      To get around the need for serialization, I have each EAR running in the same classloader under JBoss using jboss-app.xml.


      However, on startup of each EAR this causes the warning:



      2008-09-23 23:35:12,218 WARN  [org.jboss.seam.jsf.SeamPhaseListener] There should only be one Seam phase listener per application




      Later, this will cause an error when an event is handled



      2008-09-23 23:35:20,000 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/protohost]] Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
      ... 
      Caused by: javax.naming.NameNotFoundException: IncludeEJB2 not bound
      




      I believe this is because the host EAR is receiving an event from the included EAR, and is trying to lookup the EJB using the JNDI mapping in components.xml:


      <core:init debug="true" jndi-pattern="protohost/#{ejbName}/local"/>
      




      Since the EJB is not from the host EAR, it is using the wrong mapping.


      This would still be a warning, but the exception propagates all the way up causing JBoss not to load the host EAR at all.


      I believe the warning is more a full blown error, and I see at least one other person has a similar issue with multiple phase listeners causing problems. In that case, it was two Seam WARs in one EAR.


      I tried a custom deployment of Seam 2.0.2 for each secondary EAR by not having a WAR in them at all, and using interceptors defined in ejb-jar.xml. Certainly I can imagine Seam being useful even without a WAR.  Unfortunately the examples for configuring ejb-jar.xml in the documentation are not working for me - perhaps the 'interceptors' element is illegal under JBoss?


      At this point, I am close to giving up on the idea of deploying multiple Seam-enabled EARs into the same ClassLoader. If anyone has any thoughts on the matter, I'd love to hear them.


      Thanks!


        • 1. Re: Seam 2.0.2 - Multiple Seam Phase Listeners warning + Service EJBs
          swd847

          Every time I have seen this warning it comes from trying to deply multiple WARS in the same seam app, and it causes all kinds of weird behavior, and basically does not work. If you want to dynamically include pages from a WAR in your app you best bet is probably to implement a custom facelets ResourceResolver in your app that can load pages based on JNDI lokkup from the other EAR, although you will have problems with loading .page.xml files in your app (I have come up against this before, and if I get time will submit a patch allowing for custom resolution of .page.xml resources for 2.1).


          Stuart