2 Replies Latest reply on Jul 28, 2006 12:16 AM by javajedi

    Can't get Seam application to work as a Portlet

      Sorry for the duplicate posting. The topic somehow got truncated in my last post.

      JBoss Portal 2.4.0-CR2
      Seam 1.0.0
      JBoss 4.0.4

      I've got a Seam app that works fine on its own. When I deploy it as a portlet, the initial page of the portlet displays fine, but when I submit a form from that first page, the Seam action doesn't get invoked. The page is just redisplayed.

      I've changed FaceletViewHandler and SeamExtendedManagedPersistencePhaseListener to FaceletPortletViewHandler and SeamExtendedManagedPersistencePortletPhaseListener in faces-config.xml.

      I've added very simple jboss-portlet.xml, portlet-instances.xml, portlet.xml, and myapp-object.xml files.

      I've commented StartupServletContextListener out of my web.xml.

      These are the only changes that I've made to the app from when it was working fine as a standalone Seam application.

      Here is the debug output from Seam when the app is running as a portlet, and not working:

      2006-07-24 17:14:28,807 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.nami
      ng.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.n
      aming:org.jnp.interfaces}
      2006-07-24 17:14:28,808 DEBUG [org.jboss.seam.jsf.SeamExtendedManagedPersistencePortletPhaseListener
      ] beginning transaction prior to phase: RESTORE_VIEW(1)
      2006-07-24 17:14:28,808 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.nami
      ng.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.n
      aming:org.jnp.interfaces}
      2006-07-24 17:14:28,808 DEBUG [org.jboss.seam.contexts.Lifecycle] >>> Begin web request
      2006-07-24 17:14:28,808 DEBUG [org.jboss.seam.Component] instantiating Seam component: localeSelecto
      r
      2006-07-24 17:14:28,808 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.nami
      ng.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.n
      aming:org.jnp.interfaces}
      2006-07-24 17:14:28,809 DEBUG [org.jboss.seam.jsf.SeamExtendedManagedPersistencePortletPhaseListener
      ] committing transaction after phase: RESTORE_VIEW(1)
      2006-07-24 17:14:28,809 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.nami
      ng.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.n
      aming:org.jnp.interfaces}
      2006-07-24 17:14:28,809 DEBUG [org.jboss.seam.Component] instantiating Seam component: org.jboss.sea
      m.core.manager
      2006-07-24 17:14:28,809 DEBUG [org.jboss.seam.core.Manager] No stored conversation
      2006-07-24 17:14:28,809 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: org.j
      boss.seam.core.init
      2006-07-24 17:14:28,809 DEBUG [org.jboss.seam.jsf.AbstractSeamPhaseListener] After restoring convers
      ation context: ConversationContext(2)
      2006-07-24 17:14:28,978 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.nami
      ng.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.n
      aming:org.jnp.interfaces}
      2006-07-24 17:14:28,978 DEBUG [org.jboss.seam.jsf.SeamExtendedManagedPersistencePortletPhaseListener
      ] beginning transaction prior to phase: RENDER_RESPONSE(6)
      2006-07-24 17:14:28,978 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.nami
      ng.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.n
      aming:org.jnp.interfaces}
      2006-07-24 17:14:28,978 DEBUG [org.jboss.seam.contexts.Lifecycle] >>> Begin web request
      2006-07-24 17:14:28,978 DEBUG [org.jboss.seam.Component] instantiating Seam component: org.jboss.sea
      m.core.manager
      2006-07-24 17:14:28,978 DEBUG [org.jboss.seam.core.Manager] No stored conversation
      2006-07-24 17:14:28,978 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: org.j
      boss.seam.core.init
      2006-07-24 17:14:28,978 DEBUG [org.jboss.seam.jsf.AbstractSeamPhaseListener] After restoring convers
      ation context: ConversationContext(3)
      2006-07-24 17:14:28,979 DEBUG [org.jboss.seam.Component] instantiating Seam component: facesMessages
      
      2006-07-24 17:14:28,980 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolving name: uploadBean
      2006-07-24 17:14:28,980 DEBUG [org.jboss.seam.Component] instantiating Seam component: uploadBean
      2006-07-24 17:14:28,980 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolved name to seam compon
      ent
      2006-07-24 17:14:28,981 DEBUG [org.jboss.seam.core.Manager] Discarding conversation state: 3
      2006-07-24 17:14:28,981 DEBUG [org.jboss.seam.contexts.Lifecycle] flushing page context
      2006-07-24 17:14:28,983 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.nami
      ng.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.n
      aming:org.jnp.interfaces}
      2006-07-24 17:14:28,983 DEBUG [org.jboss.seam.jsf.SeamExtendedManagedPersistencePortletPhaseListener
      ] committing transaction after phase: RENDER_RESPONSE(6)
      2006-07-24 17:14:28,983 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.nami
      ng.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.n
      aming:org.jnp.interfaces}
      2006-07-24 17:14:28,983 DEBUG [org.jboss.seam.contexts.Lifecycle] After render response, destroying
      contexts
      2006-07-24 17:14:28,983 DEBUG [org.jboss.seam.contexts.Lifecycle] destroying event context
      2006-07-24 17:14:28,983 DEBUG [org.jboss.seam.contexts.Contexts] destroying: uploadBean
      2006-07-24 17:14:28,983 DEBUG [org.jboss.seam.contexts.Contexts] destroying: org.jboss.seam.core.man
      ager
      2006-07-24 17:14:28,984 DEBUG [org.jboss.seam.contexts.Lifecycle] destroying conversation context
      2006-07-24 17:14:28,984 DEBUG [org.jboss.seam.contexts.Contexts] destroying: facesMessages
      2006-07-24 17:14:28,984 DEBUG [org.jboss.seam.contexts.Lifecycle] flushing server-side conversation
      context
      2006-07-24 17:14:28,984 DEBUG [org.jboss.seam.contexts.Lifecycle] <<< End web request
      2006-07-24 17:18:08,577 DEBUG [org.jboss.seam.contexts.Lifecycle] destroying event context
      2006-07-24 17:18:08,577 DEBUG [org.jboss.seam.contexts.Lifecycle] destroying event context




      Here is the same debug output from the working, non-portlet version of the same app:

      2006-07-24 17:21:55,963 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.nami
      ng.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.n
      aming:org.jnp.interfaces}
      2006-07-24 17:21:55,963 DEBUG [org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener] begin
      ning transaction prior to phase: RESTORE_VIEW(1)
      2006-07-24 17:21:55,963 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.nami
      ng.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.n
      aming:org.jnp.interfaces}
      2006-07-24 17:21:55,964 DEBUG [org.jboss.seam.contexts.Lifecycle] >>> Begin web request
      2006-07-24 17:21:56,517 DEBUG [org.jboss.seam.Component] instantiating Seam component: org.jboss.sea
      m.core.manager
      2006-07-24 17:21:56,518 DEBUG [org.jboss.seam.core.Manager] No stored conversation
      2006-07-24 17:21:56,518 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: org.j
      boss.seam.core.init
      2006-07-24 17:21:56,518 DEBUG [org.jboss.seam.jsf.AbstractSeamPhaseListener] After restoring convers
      ation context: ConversationContext(2)
      2006-07-24 17:21:56,519 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolving name: uploadBean
      2006-07-24 17:21:56,519 DEBUG [org.jboss.seam.Component] instantiating Seam component: uploadBean
      2006-07-24 17:21:56,519 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolved name to seam compon
      ent
      2006-07-24 17:21:56,520 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolving name: uploadBean
      2006-07-24 17:21:56,520 DEBUG [org.jboss.seam.contexts.Contexts] found in event context: uploadBean
      2006-07-24 17:21:56,520 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolved name to seam compon
      ent
      2006-07-24 17:21:56,523 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolving name: perfImportUp
      loadAction
      2006-07-24 17:21:56,523 DEBUG [org.jboss.seam.Component] instantiating Seam component: perfImportUpl
      oadAction
      2006-07-24 17:21:56,523 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.nami
      ng.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.n
      aming:org.jnp.interfaces}
      2006-07-24 17:21:56,523 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolved name to seam compon
      ent
      2006-07-24 17:21:56,538 DEBUG [org.jboss.seam.Component] instantiating Seam component: fooPerfImport
      er
      2006-07-24 17:21:56,538 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.nami
      ng.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.n
      aming:org.jnp.interfaces}
      2006-07-24 17:21:56,539 DEBUG [org.jboss.seam.contexts.Contexts] found in event context: uploadBean
      2006-07-24 17:21:56,539 INFO [MyActionBean]
      HERE IS WHERE THE SEAM ACTION GETS INVOKED
      
      2006-07-24 17:21:56,542 DEBUG [org.jboss.seam.Component] instantiating Seam component: hibSession
      2006-07-24 17:21:56,551 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.nami
      ng.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.n
      aming:org.jnp.interfaces}
      2006-07-24 17:21:56,756 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.nami
      ng.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.n
      aming:org.jnp.interfaces}
      2006-07-24 17:21:56,757 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.nami
      ng.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.n
      aming:org.jnp.interfaces}
      2006-07-24 17:21:56,757 DEBUG [org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener] commi
      tting transaction after phase: INVOKE_APPLICATION(5)
      2006-07-24 17:21:56,757 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.nami
      ng.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.n
      aming:org.jnp.interfaces}
      2006-07-24 17:21:56,758 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.nami
      ng.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.n
      aming:org.jnp.interfaces}
      2006-07-24 17:21:56,759 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.nami
      ng.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.n
      aming:org.jnp.interfaces}
      2006-07-24 17:21:56,759 DEBUG [org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener] begin
      ning transaction prior to phase: RENDER_RESPONSE(6)
      2006-07-24 17:21:56,759 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.nami
      ng.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.n
      aming:org.jnp.interfaces}
      2006-07-24 17:21:56,760 DEBUG [org.jboss.seam.Component] instantiating Seam component: facesMessages
      
      2006-07-24 17:21:56,762 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolving name: uploadBean
      2006-07-24 17:21:56,762 DEBUG [org.jboss.seam.contexts.Contexts] found in event context: uploadBean
      2006-07-24 17:21:56,762 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolved name to seam compon
      ent
      2006-07-24 17:21:56,763 DEBUG [org.jboss.seam.core.Manager] Discarding conversation state: 2
      2006-07-24 17:21:56,767 DEBUG [org.jboss.seam.contexts.Lifecycle] flushing page context
      2006-07-24 17:21:56,776 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.nami
      ng.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.n
      aming:org.jnp.interfaces}
      2006-07-24 17:21:56,777 DEBUG [org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener] commi
      tting transaction after phase: RENDER_RESPONSE(6)
      2006-07-24 17:21:56,777 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.nami
      ng.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.n
      aming:org.jnp.interfaces}
      2006-07-24 17:21:56,778 DEBUG [org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener] Trans
      action: org.jboss.tm.usertx.client.ServerVMClientUserTransaction@be8dd0, UserTransaction
      2006-07-24 17:21:56,778 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.nami
      ng.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.n
      aming:org.jnp.interfaces}
      2006-07-24 17:21:56,778 DEBUG [org.jboss.seam.contexts.Lifecycle] After render response, destroying
      contexts
      2006-07-24 17:21:56,778 DEBUG [org.jboss.seam.contexts.Lifecycle] destroying event context
      2006-07-24 17:21:56,778 DEBUG [org.jboss.seam.contexts.Contexts] destroying: uploadBean
      2006-07-24 17:21:56,779 DEBUG [org.jboss.seam.contexts.Contexts] destroying: org.jboss.seam.core.man
      ager
      2006-07-24 17:21:56,779 DEBUG [org.jboss.seam.contexts.Lifecycle] destroying conversation context
      2006-07-24 17:21:56,779 DEBUG [org.jboss.seam.contexts.Contexts] destroying: hibSession
      2006-07-24 17:21:56,779 DEBUG [org.jboss.seam.contexts.Contexts] destroying: facesMessages
      2006-07-24 17:21:56,780 DEBUG [org.jboss.seam.contexts.Lifecycle] flushing server-side conversation
      context
      2006-07-24 17:21:56,780 DEBUG [org.jboss.seam.contexts.Lifecycle] <<< End web request
      2006-07-24 17:21:56,780 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.nami
      ng.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.n
      aming:org.jnp.interfaces}
      
      


      Any suggestions as to what I might be doing wrong? Is there some extra missing piece of glue between Seam and Portal that I need?

        • 1. Re: Can't get Seam application to work as a Portlet

          BTW, this is my web page:

          <ui:composition xmlns="http://www.w3.org/1999/xhtml"
           xmlns:h="http://java.sun.com/jsf/html"
           xmlns:t="http://myfaces.apache.org/tomahawk"
           xmlns:ui="http://java.sun.com/jsf/facelets">
          
           <h:form id="importForm" enctype="multipart/form-data">
           <t:inputFileUpload storage="file" value="#{uploadBean.file}"/>
           <br/>
           <h:commandButton value="Submit" action="#{perfImportUploadAction.upload}"/>
           <h:messages/>
           </h:form>
          
          </ui:composition>


          and these are the referenced components:

          @Name("uploadBean")
          public class UploadBackingBean {
           private UploadedFile _file;
           public void setFile(UploadedFile file) {
           _file = file;
           }
           @NotNull
           public UploadedFile getFile() {
           return _file;
           }
          }


          @Stateless
          @Name("perfImportUploadAction")
          public class PerfImportUploadActionBean implements PerfImportUploadAction {
          
           @In
           private UploadBackingBean uploadBean;
          
           @Begin(join=true)
           public String upload() {
          ...


          public interface PerfImportUploadAction {
           String upload();
          }


          • 2. Re: Can't get Seam application to work as a Portlet

            Solved my problem. The problem was that inputFileUpload relies on a servlet filter, which doesn't work in a portlet. I found a patch for myfaces here:
            http://issues.apache.org/jira/browse/MYFACES-434
            and it's working with the patch applied.