Hi everyone:
I'm a spanish developer and I have an application made with struts "Atril",
and I need that this application work like a portlet. I have followed the
instructions which I read at
https://clearinghouse.ja-sig.org/wiki/display/PLT/Struts+Bridge. I use
Jetspeed2, and I deploy my application into deploy folder and in the default
page of jetspeed I see a tab with Atril, but when I click on it I receive
this error:
java.lang.StackOverflowError
java.util.HashMap.hash(HashMap.java:264)
java.util.HashMap.containsKey(HashMap.java:342)
org.apache.jetspeed.om.page.psml.ContentFragmentImpl.getContentFragment(Cont
entFragmentImpl.java:422)
org.apache.jetspeed.om.page.psml.ContentFragmentImpl$ContentFragmentList.dup
licateList(ContentFragmentImpl.java:666)
org.apache.jetspeed.om.page.psml.ContentFragmentImpl$ContentFragmentList.ite
rator(ContentFragmentImpl.java:552)
org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRender(Pa
geAggregatorImpl.java:238)
org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRender(Pa
geAggregatorImpl.java:244)
org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRender(Pa
geAggregatorImpl.java:244)
org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRender(Pa
geAggregatorImpl.java:244)
org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRender(Pa
geAggregatorImpl.java:244)
org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRender(Pa
geAggregatorImpl.java:244)
org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRender(Pa
geAggregatorImpl.java:244)
org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRender(Pa
geAggregatorImpl.java:244)
org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRender(Pa
geAggregatorImpl.java:244)
org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRender(Pa
geAggregatorImpl.java:244)
org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRender(Pa
geAggregatorImpl.java:244)
org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRender(Pa
geAggregatorImpl.java:244)
org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRender(Pa
geAggregatorImpl.java:244)
org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRender(Pa
geAggregatorImpl.java:244)
org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRender(Pa
geAggregatorImpl.java:244)
org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRender(Pa
geAggregatorImpl.java:244)
org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRender(Pa
geAggregatorImpl.java:244)
org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRender(Pa
geAggregatorImpl.java:244)
These are my files which I modified:
1.- WEB.XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<listener>
<listener-class>
atril.core.listener.ContextListener
</listener-class>
</listener>
<!-- Standard Action Servlet Configuration (with debugging) -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.portals.bridges.struts.PortletServlet</servlet-cla
ss>
<init-param>
<!-- struts-config's configuration in the application scope-->
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml,/WEB-INF/struts-config-repository.xm
l,/WEB-INF/struts-config-evaluations.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>JetspeedContainer</servlet-name>
<display-name>Jetspeed Container</display-name>
<description>MVC Servlet for Jetspeed Portlet Applications</description>
<servlet-class>org.apache.jetspeed.container.JetspeedContainerServlet</servl
et-class>
<init-param>
<param-name>contextName</param-name>
<param-value>atril</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<!-- constraint for not access directly to a JSP file-->
<!--
<security-constraint>
<web-resource-collection>
<web-resource-name>no_access</web-resource-name>
<url-pattern>*.jsp</url-pattern>
</web-resource-collection>
<auth-constraint/>
</security-constraint>
-->
<!-- Establish the default list of welcome files -->
<welcome-file-list>
<welcome-file>modules/common/themes/default/html/index.html</welcome-file>
</welcome-file-list>
<!-- Standard Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!-- filter export added so that Display tag solve his problems with -->
<!-- the options of export-->
<filter>
<filter-name>ResponseOverrideFilter</filter-name>
<filter-class>org.displaytag.filter.ResponseOverrideFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ResponseOverrideFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>ResponseOverrideFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<!-- Environment variables -->
<!-- Applications Path -->
<env-entry>
<env-entry-name>atrilPath</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>C:/j2/jakarta-tomcat-5.5.9/webapps/atril</env-entry-value>
</env-entry>
<!-- Name of environment-->
<env-entry>
<env-entry-name>environment</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>local</env-entry-value>
</env-entry>
</web-app>
2.- In the STRUTS-CONFIG.XML I have added:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 1.2//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
<struts-config>
<!-- ============== Form Bean Definitions ===============================
-->
<form-beans>
<form-bean name="modules.common.loginForm"
type="org.apache.struts.action.DynaActionForm">
<form-property name="name" type="java.lang.String"/>
<form-property name="pass" type="java.lang.String"/>
<form-property name="select" type="java.lang.String"/>
</form-bean>
<form-bean name="modules.common.themeForm"
type="org.apache.struts.action.DynaActionForm">
<form-property name="themeName" type="java.lang.String"/>
</form-bean>
</form-beans>
<!-- ===== Global Exception Definitions ================================
-->
<global-exceptions>
<!-- AtrilFileNoFoundException -->
<exception key="error.file" path="modules.common.exception"
type="atril.common.serverclasses.exceptions.AtrilFileNoFoundException"
bundle="org.apache.struts.action.MESSAGE"/>
<!-- AtrilAuthenticationException -->
<exception key="error.user.noauthorized" path="modules.common.exception"
type="atril.common.serverclasses.exceptions.AtrilAuthenticationException"
bundle="org.apache.struts.action.MESSAGE"/>
<!-- AtrilAuthorizationException -->
<exception key="error.user.noauthorization"
path="modules.common.exception"
type="atril.common.serverclasses.exceptions.AtrilAuthorizationException"
bundle="org.apache.struts.action.MESSAGE"/>
<!-- AtrilBadParameterException -->
<exception key="error.form.parameters" path="modules.common.exception"
type="atril.common.serverclasses.exceptions.AtrilBadParameterException"
bundle="org.apache.struts.action.MESSAGE"/>
<!-- AtrilKernelException -->
<exception key="error.kernel" path="modules.common.exception"
type="atril.common.serverclasses.exceptions.AtrilKernelException"
bundle="org.apache.struts.action.MESSAGE"/>
<!-- AtrilException -->
<exception key="error.general.atril" path="modules.common.exception"
type="atril.common.serverclasses.exceptions.AtrilException"
bundle="org.apache.struts.action.MESSAGE"/>
<!-- Exception -->
<exception key="error.general" path="modules.common.exception"
type="java.lang.Exception"
bundle="org.apache.struts.action.MESSAGE"/>
</global-exceptions>
<!-- Action for User operation -->
<action-mappings>
<action path="/modules.common.LanguageChange"
type="atril.common.serverclasses.actions.LanguageChangeAction"
scope="request">
<forward name="success" path="/modules.common.Initiation.do"/>
<forward name="failure" path="modules.common.exception"/>
</action>
<!-- Used for Tiles baseTemplate -->
<action path="/modules.common.BaseTemplateTiles"
type="atril.common.serverclasses.actions.BaseTemplateTilesAction"
scope="request"/>
<!-- Used for chage of thema in body path -->
<action path="/modules.common.PutBodyTilesController"
type="atril.common.serverclasses.actions.PutBodyTilesController"
scope="request"/>
<action path="/modules.common.Initiation"
type="atril.common.serverclasses.actions.InitiationAction" scope="request">
<forward name="success" path="modules.common.initiation"/>
<forward name="failure" path="modules.common.exception"/>
</action>
<action path="/modules.common.Login"
type="atril.common.serverclasses.actions.LoginAction" scope="request"
name="modules.common.loginForm">
<forward name="success" path="/modules.common.Initiation.do"/>
<forward name="failure" path="modules.common.exception"/>
</action>
<action path="/modules.common.Index"
forward="/modules/common/themes/default/jsp/login.jsp"/>
<action path="/modules.common.CheckAuthentication"
type="atril.common.validation.controllers.CheckAuthenticationController"/>
<action path="/modules.common.ChangeTheme"
type="atril.common.serverclasses.actions.ChangeThemeAction" scope="request"
name="modules.common.themeForm">
<forward name="success" path="/modules.common.Initiation.do"/>
<forward name="failure" path="modules.common.exception"/>
</action>
<action path="/modules.common.*.ChooseLogin"
forward="/modules/common/themes/{1}/jsp/login.jsp"/>
</action-mappings>
<controller pagePattern="$M$P" inputForward="true"
processorClass="org.apache.portals.bridges.struts.PortletRequestProcessor"/>
<!-- Message Resources for common packages of the application -->
<message-resources
factory="net.sf.reloadable.resource.messageresources.MessageResourcesOsidDic
tionaryFactory"
parameter="common|86400000"
null="false"/>
<!-- ==== Plug Ins Configuration ==== -->
<!-- ======== Tiles plugin ========== -->
<!--
This plugin initialize Tiles definition factory. This later can takes
some
parameters explained here after. The plugin first read parameters from
web.xml, thenoverload them with parameters defined here. All parameters
are optional.
The plugin should be declared in each struts-config file.
- definitions-config: (optional)
Specify configuration file names. There can be several comma
separated file names (default: ?? )
- moduleAware: (optional - struts1.1)
Specify if the Tiles definition factory is module aware. If true
(default), there will be one factory for each Struts module.
If false, there will be one common factory for all module. In this
later case, it is still needed to declare one plugin per module.
The factory will be initialized with parameters found in the
first
initialized plugin (generally the one associated with the
default
module).
true : One factory per module. (default)
false : one single shared factory for all modules
- definitions-parser-validate: (optional)
Specify if xml parser should validate the Tiles configuration file.
true : validate. DTD should be specified in file header (default)
false : no validation
Paths found in Tiles definitions are relative to the main context.
-->
<plug-in className="org.apache.struts.tiles.TilesPlugin">
<set-property property="definitions-config"
value="/WEB-INF/tiles-defs-themes.xml,/WEB-INF/tiles-defs-repository.xml,/WE
B-INF/tiles-defs-evaluations.xml"/>
<set-property property="moduleAware" value="true"/>
</plug-in>
<!-- ==== Plug Ins Configuration ==== -->
<!-- ======== Struts-Menu plugin ========== -->
<plug-in className="net.sf.navigator.menu.MenuPlugIn">
<set-property property="menuConfig" value="/WEB-INF/menu-config.xml"/>
</plug-in>
</struts-config>
3.- This is my PORTLET.XML:
<?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" version="1.0"
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>
<portlet-name>AtrilPortlet</portlet-name>
<portlet-class>org.apache.portals.bridges.struts.StrutsPortlet</portlet-clas
s>
<init-param>
<name>ServletContextProvider</name>
<value>ca.mun.portal.bridges.PortalServletContextProvider</value>
</init-param>
<init-param>
<name>ViewPage</name>
<value>/modules/common/themes/default/html/index.html</value>
</init-param>
<init-param>
<name>HelpPage</name>
<value>/modules.common.Login</value>
</init-param>
<expiration-cache>-1</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
<portlet-mode>HELP</portlet-mode>
</supports>
<portlet-info>
<title>Atril</title>
<keywords>Struts</keywords>
</portlet-info>
</portlet>
</portlet-app>
4.- STRUTS-PORTLET-CONFIG-XML
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2000-2004 Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
$Id: struts-portlet-config.xml,v 1.1 2005/01/20 01:42:21 ate Exp $
-->
<config>
<!-- backwards compatability setting with Struts Bridge 0.1
which defaulted html:link and html:rewrite urls to be action type
Could rewrite the struts-config definitions but don't feel like it.
The JPetstore example provides a much better definition.
-->
<portlet-url-type default="action"/>
</config>
5.- My psml file (ATRIL.PSML):
<?xml version="1.0" encoding="UTF-8"?>
<page id="atril">
<defaults
skin="orange"
layout-decorator="tigris"
portlet-decorator="tigris"/>
<title>Atril</title>
<fragment id="atril" type="layout"
name="jetspeed-layouts::VelocityOneColumn">
<fragment id="atril" type="portlet" name="atril::atrilPortlet"/>
</fragment>
<security-constraints>
<security-constraints-ref>public-view</security-constraints-ref>
</security-constraints>
</page>
I not sure whether in the atril.psml the id are OK and I don't know how to
use the file struts-portlet-config.xml. I follow the steps to migrate an
struts application to a portlet but I doný know whai I'm doing wrong.
Thanks and I hope that someone help me.
Alberto Moreno.