title: Pluto 2.0 + MyFaces Portlet bridge + JSF 2.0 Application
body: <p>Recently I have explored the possibilities to integrate a regular JSF 2.0 application as a portlet a portlal.</p>
  
  <p>The first thing I've done is downloaded <a href="http://portals.apache.org/pluto/" rel="nofollow">Pluto 2.0</a> (bundled with tomcat) and <a href="http://myfaces.apache.org/portlet-bridge/2.0/index.html" rel="nofollow">Myfaces Portlet Bridge 2</a>. I have created a small webapp (<a href="http://horstmann.com/corejsf/" rel="nofollow">Core JSF 2.0</a> chapter 2 quiz application).
  As I saw from the tutorials I have created portlet.xml file in WEB-INF with the following content:</p>
  
  <pre><code>&lt;portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
  version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd
  http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"&gt;
  
     &lt;portlet&gt;
  
          &lt;portlet-name&gt;QPortlet&lt;/portlet-name&gt;
          &lt;portlet-class&gt;javax.portlet.faces.GenericFacesPortlet&lt;/portlet-class&gt;
          &lt;expiration-cache&gt;0&lt;/expiration-cache&gt;
          &lt;init-param&gt;
          &lt;name&gt;javax.portlet.faces.defaultViewId.view&lt;/name&gt;
          &lt;value&gt;faces/index.xhtml&lt;/value&gt;
          &lt;/init-param&gt;
          &lt;supports&gt;
              &lt;mime-type&gt;text/html&lt;/mime-type&gt;
              &lt;portlet-mode&gt;VIEW&lt;/portlet-mode&gt;
          &lt;/supports&gt;
          &lt;supports&gt;
              &lt;mime-type&gt;application/xhtml+xml&lt;/mime-type&gt;
              &lt;portlet-mode&gt;VIEW&lt;/portlet-mode&gt;
          &lt;/supports&gt;
          &lt;portlet-info&gt;
              &lt;title&gt;QPortlet&lt;/title&gt;
              &lt;short-title&gt;QPortlet&lt;/short-title&gt;
          &lt;/portlet-info&gt;
      &lt;/portlet&gt;
  &lt;/portlet-app&gt;
  </code></pre>
  
  <p>Then I added several lines in the web.xml:</p>
  
  <pre><code>&lt;servlet&gt;
          &lt;servlet-name&gt;QPortlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.apache.pluto.container.driver.PortletServlet&lt;/servlet-class&gt;
          &lt;init-param&gt;
          &lt;param-name&gt;portlet-name&lt;/param-name&gt;
          &lt;param-value&gt;QPortlet&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
          &lt;/servlet&gt;
          &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;QPortlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/PlutoInvoker/QPortlet&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>Have copied the corresponding bridge Jar to the lib folder, packaged as war file and deployed to Pluto. Pluto itself recognized my webapp as a portlet.  Cool but when I opened the  window with the portlet it was just empty. The web application works nice separately, But not as a portlet. 
  I have tried the examples from MyFaces but the most I can get is the following exception: </p>
  
  <pre><code>Error rendering portlet portlet-bridge-carstore.
  
  java.lang.IllegalArgumentException: Only supported in a portlet environment
  at org.apache.myfaces.portlet.faces.util.map.PortletRequestMap.(PortletRequestMap.java:42)
  </code></pre>
  
  <p>…</p>
  
  <p>Am I doing something wrong?
  I have also tried <a href="http://www.jboss.org/portletbridge" rel="nofollow">JBoss Portlet Bridge</a>, but I get the same result…</p>