aspose file tools*
The moose likes Portals and Portlets and the fly likes problems showing a very simple portlet in pluto Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "problems showing a very simple portlet in pluto" Watch "problems showing a very simple portlet in pluto" New topic
Author

problems showing a very simple portlet in pluto

Daniel Amadei
Ranch Hand

Joined: Mar 29, 2005
Posts: 94
Hi All,

I'm getting the following exception when trying to show a very simple helloworldportlet in pluto. Any ideas?

java.lang.NullPointerException
at org.apache.pluto.invoker.impl.PortletInvokerImpl.invoke(PortletInvokerImpl.java:109)
at org.apache.pluto.invoker.impl.PortletInvokerImpl.load(PortletInvokerImpl.java:80)
at org.apache.pluto.PortletContainerImpl.portletLoad(PortletContainerImpl.java:218)
at org.apache.pluto.portalImpl.core.PortletContainerWrapperImpl.portletLoad(PortletContainerWrapperImpl.java:94)
at org.apache.pluto.portalImpl.aggregation.PortletFragment.service(PortletFragment.java:120)
at org.apache.jsp.WEB_002dINF.aggregation.ColumnFragment_jsp._jspService(org.apache.jsp.WEB_002dINF.aggregation.ColumnFragment_jsp:65)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)


Daniel
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

There's not alot of data here to go on. Perhaps you've set the content type to null?

Show some code, maybe we can help you.

-Cameron McKenzie
Daniel Amadei
Ranch Hand

Joined: Mar 29, 2005
Posts: 94
Hi Cameron,

This is the portlet. BTW, I'm deploying it in Pluto.


public class HelloWorldPortlet extends GenericPortlet {

protected void doView(RenderRequest request,
RenderResponse response)
throws PortletException, IOException {

response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<h1>Hello World</h1>");
}
}

[]s
Daniel
Daniel Amadei
Ranch Hand

Joined: Mar 29, 2005
Posts: 94
Hi Cameron,

This is my portlet.xml as you asked.

<?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>This is my first portlet.</description>
<portlet-name>HelloWorldPortlet</portlet-name>
<display-name>Hello World Portlet</display-name>
<portlet-class>hwp.HelloWorldPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
</supports>
<portlet-info>
<title>HelloWorld</title>
</portlet-info>
</portlet>

</portlet-app>
Daniel Amadei
Ranch Hand

Joined: Mar 29, 2005
Posts: 94
Hi Cameron,

I found out why I was in trouble. Pluto requires the definition of a Servlet for each portlet in the webapp. So I had to add the following to my web.xml:

<servlet>
<servlet-name>HelloWorldPortlet</servlet-name>
<servlet-class>org.apache.pluto.core.PortletServlet</servlet-class>
<init-param>
<param-name>portlet-name</param-name>
<param-value>HelloWorldPortlet</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>HelloWorldPortlet</servlet-name>
<url-pattern>/PlutoInvoker/HelloWorldPortlet</url-pattern>
</servlet-mapping>
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

I remember having to do that with the old JetSpeed API, but not with JSR168. Of course, I've never used Pluto, so I'm a bit over my head in that regard.

I'm glad you fixed it.

-Cameron
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problems showing a very simple portlet in pluto
 
Similar Threads
Does doView() calls service() method?
RE: How to display simple jsp ( it is not processing anything ) into portlet window?
What are portlets
New on portal
WA #1.....word association