6 Replies Latest reply on Jul 2, 2008 5:51 AM by Thomas Heute

    JBoss Portlet Container 2.0.0 - Getting a Portal Page workin

    rene harings Newbie

      Hello,
      I'm trying to get a simple portal page working,
      but I always get Exceptions.

      Here is my Page:

      <%@ page contentType="text/html" %>
      <%@ page language="java" %>
      <%@ taglib prefix="xportal" tagdir="/WEB-INF/tags/portal" %>
      <%@ taglib uri="/WEB-INF/portal.tld" prefix="portal" %>
      <%@ page isELIgnored="false" %>
      
      
      
      <portal:page>
       <xportal:2columns>
       <jsp:attribute name="leftcol">
       <xportal:portlet name="HelloWorld55" applicationName="Test666"/>
       </jsp:attribute>
       <jsp:attribute name="rightcol">
       <xportal:portlet name="HelloWorld55" applicationName="Test666"/>
       </jsp:attribute>
       </xportal:2columns>
       <xportal:portlet name="HelloWorld55" applicationName="Test666"/>
      </portal:page>
      
      


      Here is the content of my WEB-INF-Folder:

      classes
      jsp
      lib
      tags
      jboss-web.xml
      portal.tld
      portlet.xml
      web.xml


      Here are the libraries in my WEB-INF/lib-Folder (some are not important for this question, just using JMaki):

      ajax-wrapper-comp-1.8.0.jar org.json-0.0.1.jar
      common-common-1.2.0.jar portaltaglib.jar
      jsfcompounds-0.0.2.jar portlet-portlet-2.0.0.jar
      jstl.jar

      The portlet is the simple netbeans generated default portlet with jsps for all modes.

      After deployment of my war-archive and visiting the default page this error occurs:


      org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 9
      
      6:
      7:
      8:
      9: <portal:page>
      10: <xportal:2columns>
      11: <jsp:attribute name="leftcol">
      12: <xportal:portlet name="HelloWorld55" applicationName="Test666"/>
      
      
      Stacktrace:
       org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
       org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:415)
       org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
       org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
       javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      
      
      root cause
      
      java.lang.ClassCastException: org.apache.catalina.connector.ResponseFacade
       org.jboss.portal.portlet.portal.jsp.taglib.PortalBodyTagSupport.getPortalResponse(PortalBodyTagSupport.java:42)
       org.jboss.portal.portlet.portal.jsp.taglib.PortalBodyTagSupport.doStartTag(PortalBodyTagSupport.java:47)
       org.apache.jsp.index_jsp._jspx_meth_portal_005fpage_005f0(index_jsp.java:96)
       org.apache.jsp.index_jsp._jspService(index_jsp.java:72)
       org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
       javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
       org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
       org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
       javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      
      
      


      I tried to include the filters from simple-portal in my web.xml,
      but this causes a deployment-failure:

      11:45:52,150 ERROR [MainDeployer] Could not start deployment: file:/H:/portlets/jboss-portletcon
      tainer-2.0.0-jbossas42/server/default/deploy/Test666.war
      org.jboss.deployment.DeploymentException: URL file:/H:/portlets/jboss-portletcontainer-2.0.0-jbo
      ssas42/server/default/tmp/deploy/tmp9325Test666-exp.war/ deployment failed
       at org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java
      :379)
       at org.jboss.web.tomcat.service.TomcatDeployer.performDeploy(TomcatDeployer.java:104)
       at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:375)
       at org.jboss.web.WebModule.startModule(WebModule.java:83)
       at org.jboss.web.WebModule.startService(WebModule.java:61)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
      
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:
      245)
       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.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
       at $Proxy0.start(Unknown Source)
       at org.jboss.system.ServiceController.start(ServiceController.java:417)
       at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
       at $Proxy44.start(Unknown Source)
       at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
       at sun.reflect.GeneratedMethodAccessor137.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInt
      erceptor.java:142)
       at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
       at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSup
      port.java:238)
       at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:87
      )
       at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeploye
      rInterceptorSupport.java:188)
       at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
       at $Proxy45.start(Unknown Source)
       at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
       at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInt
      erceptor.java:142)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
       at $Proxy9.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:42
      1)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610)
      
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractD
      eploymentScanner.java:263)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDep
      loymentScanner.java:274)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDepl
      oymentScanner.java:225)
      


      Can someone please tell me what to do?
      In the User_Guide everything seems so easy without any problems,
      but it just doesn't work...

      Best regards,
      Rene

        • 1. Re: JBoss Portlet Container 2.0.0 - Getting a Portal Page wo
          rene harings Newbie

          Solved the problem,
          just reverse engineered simple-portal!

          • 2. Re: JBoss Portlet Container 2.0.0 - Getting a Portal Page wo
            Thomas Heute Master

            Was it something missing from the doc ? (for others)

            • 3. Re: JBoss Portlet Container 2.0.0 - Getting a Portal Page wo
              rene harings Newbie

               

              "thomas.heute@jboss.com" wrote:
              Was it something missing from the doc ? (for others)


              Ohh, hard answer:

              First the docs (User_Guide) suggest everything is very easy to do:

              just implement a portal and write a simple-portal-page like this (quote from the User_Guide):

              <%@ page contentType="text/html;charset=UTF-8" language="java" %>
              <%@ taglib uri="/WEB-INF/portal.tld" prefix="portal" %>
              <?xml version="1.0" encoding="UTF-8"?>
              <!DOCTYPE html
              PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
              "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
              <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
              <head>
              <title>Simple portal page</title>
              </head>
              <body>
              <portal:page>
              <portal:portlet name="JSPPortlet"
              applicationName="samples-jsp-portlet">
              <portal:portletmarkup/>
              </portal:portlet>
              </portal:page>
              </body>
              </html>
              


              This doesn't work so easy, there are additional steps to mention:

              1) To build a war that works with the container you have to include the following libraries at build time (currently I'm using Netbeans):

              ccpp-1.0.jar common-common-1.2.0.jar
              common-portal-1.2.0.jar portlet-api-2.0.jar
              portlet-portlet-2.0.0.jar web-web-1.2.0.jar

              -> found in JBOSS_HOME/server/default/deploy/simple-portal/lib

              2) In the war-file you have to include the following libraries into the directory WEB-INF/lib:

              common-mc-1.2.0.jar jboss-common-core-2.2.3.GA.jar
              jboss-dependency-2.0.0.Beta13.jar jboss-kernel-2.0.0.Beta13.jar
              jboss-mdr-2.0.0.Beta14.jar jboss-reflect-2.0.0.Beta12.jar
              jbossxb-2.0.0.CR8.jar portlet-controller-2.0.0.jar
              portlet-mc-2.0.0.jar

              -> found in JBOSS_HOME/server/default/deploy/simple-portal/simple-portal.war/WEB-INF/lib

              3) To get the extended Taglib I simply copied
              JBOSS_HOME/server/default/deploy/simple-portal/simple-portal.war/WEB-INF/tags
              to my WEB-INF directory

              4) I really don't know, what the controller-filter is doing but I recognized two filters in the web.xml of simple-portal.war:

              I think the listener is only needed for beans,
              but my Web-Application won't work without the filters,
              so I included them into my web.xml:

              <filter>
               <filter-name>ErrorHandlingFilter</filter-name>
               <filter-class>org.jboss.portal.portlet.portal.ErrorHandlingFilter</filter-class>
               </filter>
               <filter>
               <filter-name>ControllerFilter</filter-name>
               <filter-class>org.jboss.portal.portlet.portal.jsp.ControllerFilter</filter-class>
               </filter>
               <filter-mapping>
               <filter-name>ErrorHandlingFilter</filter-name>
               <url-pattern>*.jsp</url-pattern>
               </filter-mapping>
               <filter-mapping>
               <filter-name>ControllerFilter</filter-name>
               <url-pattern>*.jsp</url-pattern>
               </filter-mapping>
              
              <listener>
               <listener-class>
              org.jboss.portal.common.mc.bootstrap.WebBootstrap</listener-class>
               </listener>
              
               <servlet>
               <servlet-name>ContainerServlet</servlet-name>
               <servlet-class>
              org.jboss.portal.web.impl.tomcat.TC6ContainerServlet
              </servlet-class>
               <load-on-startup>0</load-on-startup>
               </servlet>
              


              I also included the following files into the WEB-INF-directory:

              context.xml jboss-beans.xml
              jboss-web.xml portal.tld

              -> found in JBOSS_HOME/server/default/deploy/simple-portal/simple-portal.war/WEB-INF


              Perhaps I'm an idiot and everything is much easier, but now my portal-page works.

              I still have some strange problems:


              1) Still I can't get the "<portal:portlet>"-tag to work, i.e. using this tag doesn't cause an exception but the portlet won't appear. The taglib is included!
              So I'm using the extended taglib.

              2) The resizing problem (view the other post)

              Please excuse my crappy english,
              best regards,
              rene

              • 4. Re: JBoss Portlet Container 2.0.0 - Getting a Portal Page wo
                Thomas Heute Master

                The doc says to start form the simple portal war, it would have save you a lot of time:

                http://www.jboss.org/files/portletcontainer/docs/2.0.0/html/ch03s02s02s01.html

                • 5. Re: JBoss Portlet Container 2.0.0 - Getting a Portal Page wo
                  rene harings Newbie

                  Thanks for your reply,
                  perhaps it would be a good idea to provide the source code of simple-portal in a single zip-file for download.

                  At the moment you have to download the complete sources of the container.

                  And still no ideas about the resizing problem?

                  • 6. Re: JBoss Portlet Container 2.0.0 - Getting a Portal Page wo
                    Thomas Heute Master

                    terroene,
                    you can contribute to the project and i can only encourage you to do so.

                    At the moment i don't have time to look at it.

                    You have the complete sources, so you can look at the sources and check what the NPE is about.

                    You may have missed something that ended up in that non-clear NPE, or you faces a bug you could contribute a patch so that it's clearer for the next one who will do the same.

                    That said it works fine in simple portal, so why not looking at it ?