You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-user@portals.apache.org by Roberto Rios <bo...@yahoo.com.br> on 2004/03/07 16:57:50 UTC
Not able to deploy a portlet
Hi,
I've got Pluto and have successfully deployed it. I'm
able to run the testsuit without no problem (just to
let you know that I am using WIN2K + J2SDK1.4.2_03 +
TOMCAT4.1.29).
So I decided to build my first porlet, and off course,
I build a HelloWorldPortlet...
It's basically a copy of the TestPortlet.java, as you
can see below.
The problem it's that I am not able to execute it. I
have (I think) followed all the steps. But when I try
to run it, I just receice a SEVERE: Error in Porlet.
I also changed pageregistry.xml and
portletentityregistry.xml. I'm posting just the
fragments that I have changed.
Any help is welcome.
TIA,
Bob Rivers - Brazil
HelloWorldPortlet.java
======================
package myportlets;
import javax.portlet.*;
import java.io.IOException;
public class HelloWorldPortlet extends GenericPortlet
{
public void doDispatch(RenderRequest request,
RenderResponse response) throws PortletException,
IOException {
response.setTitle("HelloWorld");
WindowState state = request.getWindowState();
if (!state.equals(WindowState.MINIMIZED)) {
response.setContentType("text/html");
String jspName = request.getParameter("jspName");
if (jspName == null) {
PortletSession session =
request.getPortletSession(false);
if (session != null) {
jspName = (String)
session.getAttribute("jspName",
PortletSession.PORTLET_SCOPE);
}
if (jspName == null)
jspName = "helloworld.jsp";
} else {
PortletSession session =
request.getPortletSession(false);
if (session != null) {
session.setAttribute("jspName", jspName,
PortletSession.PORTLET_SCOPE);
}
}
PortletContext context = getPortletContext();
PortletRequestDispatcher rd =
context.getRequestDispatcher("/jsp/" + jspName);
rd.include(request, response);
}
}
}
helloworld.jsp
==============
<%@ page session="true" %>
<%@ taglib uri='/WEB-INF/tld/portlet.tld'
prefix='portlet'%>
<%@ page import="javax.portlet.*"%>
<%@ page import="java.util.*"%>
<portlet:defineObjects/>
<%
System.out.print("HelloWorld");
%>
portlet.xml
===========
<?xml version="1.0" encoding="UTF-8"?>
<portlet-app
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
version="1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd
http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
<portlet>
<description>MyPortletsDescription</description>
<portlet-name>HelloWorldPortlet1</portlet-name>
<display-name>HelloWorld Portlet
#1</display-name>
<portlet-class>myportlets.HelloWorldPortlet</portlet-class>
<init-param>
<name>dummyName</name>
<value>dummyValue</value>
</init-param>
<expiration-cache>-1</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
<portlet-mode>EDIT</portlet-mode>
<portlet-mode>HELP</portlet-mode>
</supports>
<supported-locale>en</supported-locale>
<portlet-info>
<title>HelloWorld Portlet #1</title>
<short-title>Hello1</short-title>
<keywords>Hello, HelloWorld</keywords>
</portlet-info>
<portlet-preferences>
<preference>
<name>dumnmyName</name>
<value>dummyValue</value>
<read-only>false</read-only>
</preference> <preference>
<name>dummyName2</name>
<value>dummyValue2</value>
</preference>
<preferences-validator>org.apache.pluto.core.impl.PreferencesValidatorImpl</preferences-validator>
</portlet-preferences>
</portlet>
</portlet-app>
web.xml
=======
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems,
Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>myportlets</display-name>
<description>Automated generated Application
Wrapper</description>
<servlet>
<servlet-name>HelloWorldPortlet1</servlet-name>
<display-name>HelloWorldPortlet
Wrapper</display-name>
<description>Automated generated Portlet
Wrapper</description>
<servlet-class>org.apache.pluto.core.PortletServlet</servlet-class>
<init-param>
<param-name>portlet-guid</param-name>
<param-value>myportlets.HelloWorldPortlet</param-value>
</init-param>
<init-param>
<param-name>portlet-class</param-name>
<param-value>myportlets.HelloWorldPortlet</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorldPortlet1</servlet-name>
<url-pattern>/HelloWorldPortlet1/*</url-pattern>
</servlet-mapping>
<taglib>
<taglib-uri>http://java.sun.com/portlet</taglib-uri>
<taglib-location>/WEB-INF/tld/portlet.tld</taglib-location>
</taglib>
</web-app>
pageregistry.xml
================
<fragment name="p2" type="portlet">
<property name="portlet"
value="5.1"/>
</fragment>
portletentityregistry.xml
=========================
<application id="5">
<definition-id>myportlets</definition-id>
<portlet id="1">
<definition-id>myportlets.HelloWorldPortlet1</definition-id>
<preferences>
<pref-name>HelloWorldPortlet5</pref-name>
<pref-value>HelloWorldPortlet5</pref-value>
<read-only>true</read-only>
</preferences>
</portlet>
</application>
log
===
----- Root Cause -----
java.lang.NullPointerException
at
org.apache.pluto.portalImpl.aggregation.PortletFragment.service(PortletFragment.java:156)
at
org.apache.jsp.ColumnFragment_jsp._jspService(ColumnFragment_jsp.java:65)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
______________________________________________________________________
Yahoo! Mail - O melhor e-mail do Brasil! Abra sua conta agora:
http://br.yahoo.com/info/mail.html