1 Reply Latest reply on Dec 20, 2006 5:08 PM by Carolina U.

    Seam Portlet in Jboss Portal

    Carolina U. Newbie

      I'm trying to make just a small seam app and get it working as a portlet

      Currently I have
      jboss-seam 1.0 GA
      jboss portal 2.4 and
      AS jboss_4.0.5GA


      Just to start testing if this works I made a sportlet.war as follows

      WEB-INF
      META-INF
      main.xhtml

      Into the WEB-INF directory the following conf files and libs can be found

      - web.xml, sportlet-object.xml, portlet.xml, jboss.web.xml, jboss-portlet.xml, jboss-app.xml, faces-config.xml, and components.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="2.4"
       xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
      
      
      
       <!-- MY FACES -->
      
      
       <context-param>
       <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <context-param>
       <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
       <param-value>false</param-value>
       </context-param>
      
       <context-param>
       <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <context-param>
       <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <!-- Extensions Filter -->
       <filter>
       <filter-name>extensionsFilter</filter-name>
       <filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
       <init-param>
       <param-name>uploadMaxFileSize</param-name>
       <param-value>100m</param-value>
       </init-param>
       <init-param>
       <param-name>uploadThresholdSize</param-name>
       <param-value>100k</param-value>
       </init-param>
       </filter>
      
       <!-- Seam -->
      
       <listener>
       <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
       </listener>
      
      
       <!-- Propagate conversations across redirects -->
       <filter>
       <filter-name>Seam Redirect Filter</filter-name>
       <filter-class>org.jboss.seam.servlet.SeamRedirectFilter</filter-class>
       </filter>
      
       <filter-mapping>
       <filter-name>Seam Redirect Filter</filter-name>
       <url-pattern>*.seam</url-pattern>
       </filter-mapping>
      
       <filter-mapping>
       <filter-name>Seam Redirect Filter</filter-name>
       <url-pattern>*.xhtml</url-pattern>
       </filter-mapping>
      
       <!-- JSF -->
      
       <context-param>
       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
       <param-value>client</param-value>
       </context-param>
      
       <context-param>
       <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
       <param-value>.xhtml</param-value>
       </context-param>
      
       <context-param>
       <param-name>facelets.DEVELOPMENT</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <servlet>
       <servlet-name>Faces Servlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
      
       <!-- Servlet Mapping -->
       <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>*.seam</url-pattern>
       </servlet-mapping>
      
       <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>*.xhtml</url-pattern>
       </servlet-mapping>
      
      
      </web-app>
      


      components.xml



      <components>
      
       <component name="org.jboss.seam.core.init">
       <property name="debug">true</property>
       <property name="myFacesLifecycleBug">false</property>
       <property name="jndiPattern">sportlet/#{ejbName}/local</property>
       </component>
      
       <component class="org.jboss.seam.core.Ejb" installed="false"/>
      
       <!-- Bootstrap Hibernate -->
      
      </components>


      portlet.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <portlet-app
       xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd /opt/SUNWps/dtd/portlet.xsd"
       version="1.0">
       <portlet>
       <portlet-name>SPortlet</portlet-name>
       <init-param>
       <name>default-view</name>
       <value>/main.xhtml</value>
       </init-param>
       <portlet-class>org.apache.myfaces.portlet.MyFacesGenericPortlet</portlet-class>
       <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>VIEW</portlet-mode>
       </supports>
       <portlet-info>
       <title>SPortlet</title>
       </portlet-info>
       </portlet>
      </portlet-app>
      


      etc...

      In my lib directory into WEB-INF I just included :

      - my sportlet.jar with seam.properties file and the my java classes
      - jboss-seam.jar
      - jboss-seam-ui.jar

      facelets libs:
      - el-ri.jar
      - el-api.jar
      - jsf-facelets.jar

      The thing is that I get the following errors, when deploying this app to my jboss AS

      20:51:10,418 ERROR [[/sportlet]] StandardWrapper.Throwable
      java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
      If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
      A typical config looks like this;

      <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>


      at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:90)
      at javax.faces.webapp.FacesServlet.init(FacesServlet.java:88)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3951)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4225)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
      at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.apache.catalina.core.StandardContext.init(StandardContext.java:5052)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)


      ----

      Well, but it deploys anyways, I can run my Jboss portal but when I access the sportlet it crashes with this exception :


      
      21:59:22,970 ERROR [PhaseListenerManager] Exception in PhaseListener RENDER_RESPONSE(6) afterPhase
      java.lang.IllegalStateException: No active session context
       at org.jboss.seam.Seam.isSessionInvalid(Seam.java:176)
       at org.jboss.seam.contexts.Lifecycle.endRequest(Lifecycle.java:
      
      
      
      at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:416)
       at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
       at org.jboss.seam.jsf.SeamViewHandler.renderView(SeamViewHandler.java:59)
       at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
       at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
       at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
       at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
       at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:416)
       at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
       at org.jboss.seam.jsf.SeamViewHandler.renderView(SeamViewHandler.java:59)
       at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
       at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
       at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
       at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
       at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:416)
       at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
       at org.jboss.seam.jsf.SeamViewHandler.renderView(SeamViewHandler.java:59)
       at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
       at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
       at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
       at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
       at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:416)
       at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
       at org.jboss.seam.jsf.SeamViewHandler.renderView(SeamViewHandler.java:59)
       at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
       at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
      


        • 1. Re: Seam Portlet in Jboss Portal
          Carolina U. Newbie

          Am I missing something? My Jboss portal seems to work fine, as I have downloaded some portlets and they worked straight away, and on the other hand I have other seam applications running on the same jboss AS perfectly. But... this is the first time I try to make a seam app run as a portlet on my Jboss Portal.

          Regards,

          Carolina