You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Phillips, Bruce A" <bp...@ku.edu> on 2008/12/05 15:50:11 UTC
Deploying Struts 2 Portlet Into Pluto 1.1.6 Portlet Container
We have been using the Pluto 1.1.6 Portlet container
(http://portals.apache.org/pluto/) to test our JSR-168 portlets. Our
team needs help learning the correct way to setup a Struts 2 portlet to
run within the Pluto 1.1.6 portlet container. We've studied the Struts
2 example portlet tutorial
(http://struts.apache.org/2.0.11.1/docs/struts-2-portlet-tutorial.html )
in the Struts 2 documentation. However, that portlet is deployed using
maven, jetty, and Pluto; which unfortunately is not our development
environment.
We recently have begun using Struts 2 to create the Portlets. However,
we cannot get the Struts 2 portlets to run correctly in the Pluto
portlet container. When Pluto tries to render the Struts 2 portlet we
get the following error:
INFO: Registering 1 portlets for context /StrutsExample
Dec 5, 2008 8:36:36 AM org.apache.pluto.core.PortletContextManager
getPortletConfig
INFO: Unable to locate portlet config
[applicationId=/StrutsExample]/[null].
Dec 5, 2008 8:36:36 AM org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
java.lang.NullPointerException
at
org.apache.pluto.core.PortletServlet.init(PortletServlet.java:106)
Our non-Struts 2 portlets that we've built and deployed in the Pluto
container work fine.
We have developed a very simple Struts 2 portlet as a test. Here is its
struts.xml file:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<include file="struts-portlet-default.xml"/>
<package name="view" extends="struts-portlet-default"
namespace="/view">
<action name="index" class="DefaultAction">
<result name="success">/jsp/index.jsp</result>
</action>
</package>
</struts>
Here is its portlet.xml file:
<?xml version='1.0' encoding='UTF-8' ?>
<portlet-app
xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_1_0.x
sd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd'
version='1.0'>
<portlet id="StrutsExamplePortlet">
<description xml:lang="EN">Simple hello world portlet using
Struts 2</description>
<portlet-name>StrutsExamplePortlet</portlet-name>
<display-name xml:lang="EN">StrutsExample</display-name>
<portlet-class>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</p
ortlet-class>
<!-- The namespace for the actions configured for view mode
-->
<init-param>
<name>viewNamespace</name>
<value>/view</value>
</init-param>
<!-- The default action to invoke in view mode. -->
<init-param>
<name>defaultViewAction</name>
<value>index</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
</supports>
<supported-locale>en</supported-locale>
<portlet-info>
<title>StrutsExample</title>
</portlet-info>
</portlet>
</portlet-app>
Here is the project's web.xml:
<?xml version="1.0"?>
<!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>StrutsExample</display-name>
<filter>
<filter-name>struts</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-cla
ss>
</filter>
<filter-mapping>
<filter-name>struts</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>StrutsExample</servlet-name>
<servlet-class>org.apache.pluto.core.PortletServlet</servlet-class>
<init-param>
<param-name>portlet-class</param-name>
<param-value>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</par
am-value>
</init-param>
<init-param>
<param-name>portlet-guid</param-name>
<param-value>
StrutsExample.StrutsExamplePortlet
</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>StrutsExample</servlet-name>
<url-pattern>/PlutoInvoker/StrutsExample/*</url-pattern>
</servlet-mapping>
</web-app>
Here is the relevant part of the pluto-portal-driver-config.xml file
that we added to have the Struts 2 portlet added to a page in the Pluto
container:
<page name="Struts Portlet Example"
uri="/WEB-INF/themes/pluto-default-theme.jsp">
<portlet context="/StrutsExample" name="StrutsExample"/>
</page>
I think the problem is with the code we are adding to the
pluto-portal-driver-config.xml file. Though the above syntax works for
standard Portlets, it's not working for a Struts 2 portlet.
I'd welcome any feedback from developers who have built Portlets using
Struts 2 and then successfully deployed the portlet to the Pluto
container.
Bruce
Re: Deploying Struts 2 Portlet Into Pluto 1.1.6 Portlet Container
Posted by phillips1021 <bp...@ku.edu>.
Well - after hours of trouble-shooting I finally figured out what my problem
was. The error was in my web.xml:
<servlet>
<servlet-name>StrutsExample</servlet-name>
<servlet-class>org.apache.pluto.core.PortletServlet</servlet-class>
<init-param>
<param-name>portlet-class</param-name>
<param-value>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</param-value>
</init-param>
<init-param>
<param-name>portlet-guid</param-name>
<param-value>
StrutsExample.StrutsExamplePortlet
</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>StrutsExample</servlet-name>
<url-pattern>/PlutoInvoker/StrutsExamplePortlet</url-pattern>
</servlet-mapping>
I was missing the portlet-name init-param. I didn't need the portlet-guid
init-param. So using this servlet and servlet-mapping configuration in my
web.xml I was able to successfully get my portlet to render using the Pluto
1.1.6 container:
<servlet>
<servlet-name>StrutsExample</servlet-name>
<servlet-class>org.apache.pluto.core.PortletServlet</servlet-class>
<init-param>
<param-name>portlet-class</param-name>
<param-value>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</param-value>
</init-param>
<init-param>
<param-name>portlet-name</param-name>
<param-value>StrutsExamplePortlet</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>StrutsExample</servlet-name>
<url-pattern>/PlutoInvoker/StrutsExamplePortlet</url-pattern>
</servlet-mapping>
Bruce
phillips1021 wrote:
>
> Thanks for the quick reply. I changed:
>
> <page name="Struts Portlet Example"
> uri="/WEB-INF/themes/pluto-default-theme.jsp">
> <portlet context="/StrutsExample" name="StrutsExamplePortlet"/>
> </page>
>
> per your suggestion. I still get the same error:
>
> INFO: Portlet Context '/StrutsExample' registered.
> Dec 5, 2008 9:48:48 AM org.apache.pluto.core.PortletContextManager
> register
> INFO: Registered portlet application with application id '/StrutsExample'
> Dec 5, 2008 9:48:48 AM org.apache.pluto.core.PortletContextManager
> register
> INFO: Registering 1 portlets for context /StrutsExample
> Dec 5, 2008 9:48:48 AM org.apache.pluto.core.PortletContextManager
> getPortletConfig
> INFO: Unable to locate portlet config
> [applicationId=/StrutsExample]/[null].
> Dec 5, 2008 9:48:48 AM org.apache.catalina.core.ApplicationContext log
> SEVERE: StandardWrapper.Throwable
> java.lang.NullPointerException
> at org.apache.pluto.core.PortletServlet.init(PortletServlet.java:106)
>
> when trying to render the portlet in Pluto 1.1.6. If you have an example
> of a Struts 2 portlet that you've successfully deployed into Pluto 1.1.6
> I'd love to see your struts.xml, portlet.xml, web.xml, and
> pluto-portal-driver-config.xml files to see if I've missed some setting.
>
> Bruce
>
>
> Nils-Helge Garli wrote:
>>
>> On Fri, Dec 5, 2008 at 3:50 PM, Phillips, Bruce A <bp...@ku.edu>
>> wrote:
>>> We have been using the Pluto 1.1.6 Portlet container
>>> (http://portals.apache.org/pluto/) to test our JSR-168 portlets. Our
>>> team needs help learning the correct way to setup a Struts 2 portlet to
>>> run within the Pluto 1.1.6 portlet container. We've studied the Struts
>>> 2 example portlet tutorial
>>> (http://struts.apache.org/2.0.11.1/docs/struts-2-portlet-tutorial.html )
>>> in the Struts 2 documentation. However, that portlet is deployed using
>>> maven, jetty, and Pluto; which unfortunately is not our development
>>> environment.
>>>
>>
>> It's a very efficient development environment. You should try it out.
>>
>>>
>>> <portlet id="StrutsExamplePortlet">
>>>
>>> <description xml:lang="EN">Simple hello world portlet using
>>> Struts 2</description>
>>>
>>> <portlet-name>StrutsExamplePortlet</portlet-name>
>>>
>>
>>
>> <snip>
>>
>>>
>>> </init-param>
>>>
>>> <init-param>
>>>
>>> <param-name>portlet-guid</param-name>
>>>
>>> <param-value>
>>>
>>> StrutsExample.StrutsExamplePortlet
>>>
>>> </param-value>
>>>
>>> </init-param>
>>>
>>
>> <snip>
>>
>>
>>
>>> <portlet context="/StrutsExample" name="StrutsExample"/>
>>>
>>
>>
>>
>> From what I can understand, your portlet name is StrutsExamplePortlet,
>> not StrutsExample (which is your context). So try this:
>>
>> <portlet context="/StrutsExample" name="StrutsExamplePortlet"/>
>>
>> I'm using pluto for all my portlet development and have never had any
>> issues with Struts 2 support.
>>
>> Nils-H
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Deploying-Struts-2-Portlet-Into-Pluto-1.1.6-Portlet-Container-tp20855416p20863164.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Deploying Struts 2 Portlet Into Pluto 1.1.6 Portlet Container
Posted by phillips1021 <bp...@ku.edu>.
Thanks for the quick reply. I changed:
<page name="Struts Portlet Example"
uri="/WEB-INF/themes/pluto-default-theme.jsp">
<portlet context="/StrutsExample" name="StrutsExamplePortlet"/>
</page>
per your suggestion. I still get the same error:
INFO: Portlet Context '/StrutsExample' registered.
Dec 5, 2008 9:48:48 AM org.apache.pluto.core.PortletContextManager register
INFO: Registered portlet application with application id '/StrutsExample'
Dec 5, 2008 9:48:48 AM org.apache.pluto.core.PortletContextManager register
INFO: Registering 1 portlets for context /StrutsExample
Dec 5, 2008 9:48:48 AM org.apache.pluto.core.PortletContextManager
getPortletConfig
INFO: Unable to locate portlet config [applicationId=/StrutsExample]/[null].
Dec 5, 2008 9:48:48 AM org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
java.lang.NullPointerException
at org.apache.pluto.core.PortletServlet.init(PortletServlet.java:106)
when trying to render the portlet in Pluto 1.1.6. If you have an example of
a Struts 2 portlet that you've successfully deployed into Pluto 1.1.6 I'd
love to see your struts.xml, portlet.xml, web.xml, and
pluto-portal-driver-config.xml files to see if I've missed some setting.
Bruce
Nils-Helge Garli wrote:
>
> On Fri, Dec 5, 2008 at 3:50 PM, Phillips, Bruce A <bp...@ku.edu>
> wrote:
>> We have been using the Pluto 1.1.6 Portlet container
>> (http://portals.apache.org/pluto/) to test our JSR-168 portlets. Our
>> team needs help learning the correct way to setup a Struts 2 portlet to
>> run within the Pluto 1.1.6 portlet container. We've studied the Struts
>> 2 example portlet tutorial
>> (http://struts.apache.org/2.0.11.1/docs/struts-2-portlet-tutorial.html )
>> in the Struts 2 documentation. However, that portlet is deployed using
>> maven, jetty, and Pluto; which unfortunately is not our development
>> environment.
>>
>
> It's a very efficient development environment. You should try it out.
>
>>
>> <portlet id="StrutsExamplePortlet">
>>
>> <description xml:lang="EN">Simple hello world portlet using
>> Struts 2</description>
>>
>> <portlet-name>StrutsExamplePortlet</portlet-name>
>>
>
>
> <snip>
>
>>
>> </init-param>
>>
>> <init-param>
>>
>> <param-name>portlet-guid</param-name>
>>
>> <param-value>
>>
>> StrutsExample.StrutsExamplePortlet
>>
>> </param-value>
>>
>> </init-param>
>>
>
> <snip>
>
>
>
>> <portlet context="/StrutsExample" name="StrutsExample"/>
>>
>
>
>
> From what I can understand, your portlet name is StrutsExamplePortlet,
> not StrutsExample (which is your context). So try this:
>
> <portlet context="/StrutsExample" name="StrutsExamplePortlet"/>
>
> I'm using pluto for all my portlet development and have never had any
> issues with Struts 2 support.
>
> Nils-H
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Deploying-Struts-2-Portlet-Into-Pluto-1.1.6-Portlet-Container-tp20855416p20856962.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Deploying Struts 2 Portlet Into Pluto 1.1.6 Portlet Container
Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
On Fri, Dec 5, 2008 at 3:50 PM, Phillips, Bruce A <bp...@ku.edu> wrote:
> We have been using the Pluto 1.1.6 Portlet container
> (http://portals.apache.org/pluto/) to test our JSR-168 portlets. Our
> team needs help learning the correct way to setup a Struts 2 portlet to
> run within the Pluto 1.1.6 portlet container. We've studied the Struts
> 2 example portlet tutorial
> (http://struts.apache.org/2.0.11.1/docs/struts-2-portlet-tutorial.html )
> in the Struts 2 documentation. However, that portlet is deployed using
> maven, jetty, and Pluto; which unfortunately is not our development
> environment.
>
It's a very efficient development environment. You should try it out.
>
> <portlet id="StrutsExamplePortlet">
>
> <description xml:lang="EN">Simple hello world portlet using
> Struts 2</description>
>
> <portlet-name>StrutsExamplePortlet</portlet-name>
>
<snip>
>
> </init-param>
>
> <init-param>
>
> <param-name>portlet-guid</param-name>
>
> <param-value>
>
> StrutsExample.StrutsExamplePortlet
>
> </param-value>
>
> </init-param>
>
<snip>
> <portlet context="/StrutsExample" name="StrutsExample"/>
>
>From what I can understand, your portlet name is StrutsExamplePortlet,
not StrutsExample (which is your context). So try this:
<portlet context="/StrutsExample" name="StrutsExamplePortlet"/>
I'm using pluto for all my portlet development and have never had any
issues with Struts 2 support.
Nils-H
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org