7 Replies Latest reply on Feb 14, 2008 10:52 PM by Wesley Hales

    Anybody got seam 2.0 portlets working?

    Martijn Hinten Newbie

      Environment:
      JBoss Portal Version: 2.6.3
      Did you get Portal from CVS? or download it? --> download binaries
      JBoss AS Version --> 4.2.2.GA
      Database Vendor and Version --> Oracle 10g
      JDBC Connector and Version --> ojdbc14.jar
      OS Platform --> Windows XP

      Problem/Question
      I know this has been posted before, but am unable to verify wether anybody has successfully implemented portlets based on Seam 2.0.

      Is there anybody out there who has made a simple working seam 2.0 portlet, and has starting with seam-gen?

      I did get the examples working (well, more or less: there are still serious issues like several links that don't work, but at least the portlet shows in the portal), following this blog entry: http://blog.jboss-portal.org/2007/11/seam-20-portlet-example.html

      But when I try to cook my own Seam 2.0 portlets I am getting all kinds of errors, the last one being:

      17:07:04,530 ERROR [STDERR] Caused by: java.lang.ClassCastException: javax.portlet.faces.GenericFacesPortlet
      17:07:04,530 ERROR [STDERR] at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.start(PortletContainerImpl.java:231)
      17:07:04,530 ERROR [STDERR] ... 74 more
      17:07:04,546 WARN [InstanceMetaData] The instance SimpleSeamPortletInstance will not be created because the component referenced is
       outside of the same web app portlets06simpleSeam.SimpleSeamPortlet
      17:07:04,546 WARN [PortletAppDeployment] Failed to create instance SimpleSeamPortletInstance of portlet /portlets06simpleSeam.Simpl
       eSeamPortlet because portlet /portlets06simpleSeam.SimpleSeamPortlet is not available

      (full stack trace pasted further down below).

      My config files are:

      faces-config.xml:
      <?xml version='1.0' encoding='UTF-8'?>
      <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
      
       <application>
       <locale-config>
       <default-locale>en</default-locale>
       </locale-config>
      
      <view-handler>com.sun.facelets.FaceletPortletViewHandler</view-handler>
      
       </application>
      </faces-config>
      


      portlet.xml
      <portlet-app version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/portlet" xmlns="http://java.sun.com/xml/ns/portlet">
      
      
       <!-- this is a seam 2.0 portlet that doesn't work -->
       <portlet>
       <portlet-name>SimpleSeamPortlet</portlet-name>
       <portlet-class> javax.portlet.faces.GenericFacesPortlet </portlet-class>
      
       <init-param>
       <name>javax.portlet.faces.defaultViewId.view</name>
       <value>/home.xhtml</value>
       </init-param>
      
       <init-param>
       <name>javax.portlet.faces.defaultViewId.edit</name>
       <value>/edit_portlet.xhtml</value>
       </init-param>
      
       <init-param>
       <name>javax.portlet.faces.defaultViewId.help</name>
       <value>/help.xhtml</value>
       </init-param>
      
       <expiration-cache>-0</expiration-cache>
       <portlet-info>
       <title>Simple Seam Portlet</title>
       </portlet-info>
       <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>VIEW</portlet-mode>
       <portlet-mode>EDIT</portlet-mode>
       <portlet-mode>HELP</portlet-mode>
       </supports>
       </portlet>
      
       <!-- This is a non-seam portlet that works -->
       <portlet>
       <portlet-name>MultiMasterPortlet</portlet-name>
       <portlet-class>nl.geotax.MultiMasterPortlet</portlet-class>
       <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>VIEW</portlet-mode>
       <portlet-mode>EDIT</portlet-mode>
       <portlet-mode>HELP</portlet-mode>
       </supports>
       <portlet-info>
       <title>Geotax IPC Multi Master Portlet</title>
       </portlet-info>
       </portlet>
      
      </portlet-app>
      


      portlet-instances.xml:
      <?xml version="1.0" encoding="utf-8" standalone="yes"?>
      <deployments>
       <!-- seam portlet that doesn't work -->
       <deployment>
       <instance>
       <instance-id>SimpleSeamPortletInstance</instance-id>
       <portlet-ref>SimpleSeamPortlet</portlet-ref>
       </instance>
       </deployment>
      
       <!-- non seam portlet that works -->
       <deployment>
       <instance>
       <instance-id>MultiMasterPortletInstance</instance-id>
       <portlet-ref>MultiMasterPortlet</portlet-ref>
       </instance>
       </deployment>
      </deployments>
      


      seamportlet-object.xm:l
      <?xml version="1.0" encoding="UTF-8"?>
      <deployments>
      
       <!-- attempts at creating a seam portlet -->
       <deployment>
       <parent-ref>default</parent-ref>
       <if-exists>overwrite</if-exists>
       <instance>
       <instance-name>SimpleSeamPortletInstance</instance-name>
       <component-ref>portlets06simpleSeam.SimpleSeamPortlet</component-ref>
       </instance>
       </deployment>
      
      
       <deployment>
       <if-exists>overwrite</if-exists>
       <parent-ref>default</parent-ref>
       <page>
       <page-name>Simple Seam Portlets</page-name>
       <window>
       <window-name>SimpleSeamPortlet</window-name>
       <instance-ref>SimpleSeamPortletInstance</instance-ref>
       <region>left</region>
       <height>0</height>
       </window>
       </page>
       </deployment>
      
       <!-- non-seam portlet that works -->
       <deployment>
       <if-exists>overwrite</if-exists>
       <parent-ref>default</parent-ref>
       <page>
       <page-name>PoC Multi IPC-2</page-name>
       <window>
       <window-name>MultiMasterPortletWindow</window-name>
       <instance-ref>MultiMasterPortletInstance</instance-ref>
       <region>left</region>
       <height>0</height>
       </window>
       <window>
       <window-name>What the hell</window-name>
       <instance-ref>SimpleSeamPortletInstance</instance-ref>
       <region>center</region>
       <height>0</height>
       </window>
      
      
       </page>
       </deployment>
      
      </deployments>
      


      web.xml:
      <?xml version="1.0" ?>
      <web-app xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
       version="2.5">
      
      
      
      
       <description>SeamPortlets</description>
      
      
       <context-param>
       <param-name>javax.portlet.faces.BridgeImplClass</param-name>
       <param-value>org.apache.myfaces.portlet.faces.bridge.BridgeImpl</param-value>
       </context-param>
      
       <listener>
       <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
       </listener>
      
       <servlet>
       <servlet-name>Seam Resource Servlet</servlet-name>
       <servlet-class>org.jboss.seam.servlet.ResourceServlet</servlet-class>
       </servlet>
      
       <servlet-mapping>
       <servlet-name>Seam Resource Servlet</servlet-name>
       <url-pattern>/seam/resource/*</url-pattern>
       </servlet-mapping>
      
      
       <filter>
       <filter-name>Seam Filter</filter-name>
       <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
       </filter>
      
       <filter-mapping>
       <filter-name>Seam Filter</filter-name>
       <url-pattern>/*</url-pattern>
       </filter-mapping>
      
       <context-param>
       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
       <param-value>server</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>false</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-name>Faces Servlet</servlet-name>
       <url-pattern>*.seam</url-pattern>
       </servlet-mapping>
      
       <listener>
       <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
       </listener>
      
       <session-config>
       <session-timeout>30</session-timeout>
       </session-config>
      
       <welcome-file-list>
       <welcome-file>index.html</welcome-file>
       </welcome-file-list>
      
      
      
      </web-app>
      


      And finally, the full stack trace when deploying:
      stack trace:
      09:01:40,366 ERROR [STDERR] org.jboss.portal.portlet.container.PortletInitializationException: The portlet SimpleSeamPortlet threw a
       runtime exception during init
      09:01:40,366 ERROR [STDERR] at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.start(PortletContainerImpl.java:264)
      09:01:40,366 ERROR [STDERR] at org.jboss.portal.portlet.impl.container.PortletApplicationContextImpl.startPortletApplication(Por
      tletApplicationContextImpl.java:135)
      09:01:40,366 ERROR [STDERR] at org.jboss.portal.portlet.deployment.jboss.PortletAppDeployment.start(PortletAppDeployment.java:15
      1)
      09:01:40,382 ERROR [STDERR] at org.jboss.portal.core.deployment.jboss.PortletAppDeployment.start(PortletAppDeployment.java:96)
      09:01:40,382 ERROR [STDERR] at org.jboss.portal.server.deployment.jboss.DeploymentContext.start(DeploymentContext.java:99)
      09:01:40,382 ERROR [STDERR] at org.jboss.portal.server.deployment.jboss.PortalDeploymentInfoContext.start(PortalDeploymentInfoCo
      ntext.java:211)
      09:01:40,382 ERROR [STDERR] at org.jboss.portal.server.deployment.jboss.ServerDeployer.start(ServerDeployer.java:217)
      09:01:40,382 ERROR [STDERR] at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
      09:01:40,382 ERROR [STDERR] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
      09:01:40,382 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor202.invoke(Unknown Source)
      09:01:40,382 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      09:01:40,382 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      09:01:40,382 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      09:01:40,382 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      09:01:40,382 ERROR [STDERR] at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
      09:01:40,382 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      09:01:40,382 ERROR [STDERR] at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.jav
      a:142)
      09:01:40,382 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      09:01:40,382 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      09:01:40,382 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      09:01:40,382 ERROR [STDERR] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      09:01:40,382 ERROR [STDERR] at $Proxy206.deploy(Unknown Source)
      09:01:40,382 ERROR [STDERR] at org.jboss.portal.server.deployment.jboss.ServerDeployer.deploy(ServerDeployer.java:259)
      09:01:40,398 ERROR [STDERR] at org.jboss.portal.server.deployment.WebAppAdapter.deploy(WebAppAdapter.java:53)
      09:01:40,398 ERROR [STDERR] at org.jboss.portal.server.deployment.WebAppIntercepter.handleNotification(WebAppIntercepter.java:15
      9)
      09:01:40,398 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
      09:01:40,398 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      09:01:40,398 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      09:01:40,398 ERROR [STDERR] at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:153)
      09:01:40,398 ERROR [STDERR] at $Proxy209.handleNotification(Unknown Source)
      09:01:40,398 ERROR [STDERR] at org.jboss.mx.util.JBossNotificationBroadcasterSupport.handleNotification(JBossNotificationBroadca
      sterSupport.java:127)
      09:01:40,398 ERROR [STDERR] at org.jboss.mx.util.JBossNotificationBroadcasterSupport.sendNotification(JBossNotificationBroadcast
      erSupport.java:108)
      09:01:40,398 ERROR [STDERR] at org.jboss.deployment.SubDeployerSupport.emitNotification(SubDeployerSupport.java:340)
      09:01:40,398 ERROR [STDERR] at org.jboss.deployment.SubDeployerSupport.start(SubDeployerSupport.java:308)
      09:01:40,398 ERROR [STDERR] at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:482)
      09:01:40,398 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor116.invoke(Unknown Source)
      09:01:40,398 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      09:01:40,398 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      09:01:40,398 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      09:01:40,398 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      09:01:40,398 ERROR [STDERR] at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
      09:01:40,398 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      09:01:40,398 ERROR [STDERR] at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.jav
      a:142)
      09:01:40,413 ERROR [STDERR] at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
      09:01:40,413 ERROR [STDERR] at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:23
      8)
      09:01:40,413 ERROR [STDERR] at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:87)
      09:01:40,413 ERROR [STDERR] at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptor
      Support.java:188)
      09:01:40,413 ERROR [STDERR] at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
      09:01:40,413 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      09:01:40,413 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      09:01:40,413 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      09:01:40,413 ERROR [STDERR] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      09:01:40,413 ERROR [STDERR] at $Proxy188.start(Unknown Source)
      09:01:40,413 ERROR [STDERR] at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
      09:01:40,413 ERROR [STDERR] at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1015)
      09:01:40,413 ERROR [STDERR] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
      09:01:40,413 ERROR [STDERR] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
      09:01:40,413 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)
      09:01:40,413 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      09:01:40,413 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      09:01:40,413 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      09:01:40,413 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      09:01:40,413 ERROR [STDERR] at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
      09:01:40,413 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      09:01:40,429 ERROR [STDERR] at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.jav
      a:142)
      09:01:40,429 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      09:01:40,429 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      09:01:40,429 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      09:01:40,429 ERROR [STDERR] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      09:01:40,429 ERROR [STDERR] at $Proxy9.deploy(Unknown Source)
      09:01:40,429 ERROR [STDERR] at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
      09:01:40,429 ERROR [STDERR] at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610)
      09:01:40,429 ERROR [STDERR] at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentSca
      nner.java:263)
      09:01:40,429 ERROR [STDERR] at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScann
      er.java:274)
      09:01:40,429 ERROR [STDERR] at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanne
      r.java:225)
      09:01:40,429 ERROR [STDERR] Caused by: java.lang.ClassCastException: javax.portlet.faces.GenericFacesPortlet
      09:01:40,429 ERROR [STDERR] at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.start(PortletContainerImpl.java:231)
      09:01:40,429 ERROR [STDERR] ... 74 more
      09:01:40,445 WARN [InstanceMetaData] The instance SimpleSeamPortletInstance will not be created because the component referenced is
       outside of the same web app portlets06simpleSeam.SimpleSeamPortlet
      09:01:40,445 WARN [PortletAppDeployment] Failed to create instance SimpleSeamPortletInstance of portlet /portlets06simpleSeam.Simpl
       eSeamPortlet because portlet /portlets06simpleSeam.SimpleSeamPortlet is not available
      


      Any help would be greatly appreciated...