[opencms-dev] Re: Websphere & OpenCms & Struts: do you modified according to that paper?

Georg Raffer georg.nc at gmail.com
Tue Jun 27 09:21:33 CEST 2006


Hello,

these are all things required for the Offline System. In online mode no
changes are required. The code modification described was already done
in OpenCms 6.02 Also the current OpenCms version uses JSTL 1.0


What you should do:

1 Check out the current OpenCms version and compile with java 1.4; for
jar creation disable compression.

2 enforce UTF-8 encoding: Server->Process Definition->JVM-> Generic JVM
arguments: -Dclient.encoding.override=UTF-8 (elese some problems wih
german Umlaute)

3 some cache settings have to be done in OpenCms: set cache property to
"bypass" for the following pages:
system/workplace/commons/property*.jsp, /editors/editor_main.jsp


For debugging I need more information:
Is the application installed as default application? I guess with
contextPath opencms?
What is a sample URL for OpenCms Index:

http://localhost:9080/opencms/opencms


In web.xml I am currently loading the action servlet before the opencms
servlet with load-on-startup 1:

<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet>
<servlet-name>OpenCmsServlet</servlet-name>
<description>
The main servlet that handles all requests to the OpenCms VFS.
</description>
<servlet-class>org.opencms.main.OpenCmsServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>OpenCmsServlet</servlet-name>
<url-pattern>/opencms/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>OpenCmsServletErrorHandler</servlet-name>
<url-pattern>/opencms-errorhandler/*</url-pattern>
</servlet-mapping>

If .do URLs are not handled by your Struts action servlet, you have an
error in web.xml Are there any important log entries in SystemOut.log /
SystemErr.log?

For improved debugging:

extend a new class my.domain.struts.action.ActionServlet from
org.apache.struts.action.ActionServlet

overwrite method

public void init() throws ServletException{
System.out.println("Before init action servlet .....");
super.init();
System.out.println("After init action servlet .....");
}

change

<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
to

<servlet-class>my.domain.struts.action.ActionServlet</servlet-class>

the initialized servlet must log to the SystemOut.log when the
application is started.


Moreover check your Websphere log file for:

Unable to initialize Struts ActionServlet due to an unexpected exception
or error thrown, so marking the servlet as unavailable. Most likely,
this is due to an incorrect or missing library dependency.

This is what struts writes to the error log when init failed. Maybe a
struts dependend library is missing on Websphere?

hope that helps ;)

bye, Georg

Huang Zhibin wrote:
> Hi, Georg,
> After comparsion, now I just wonder how your was going? What is your
> was version?
> I read one info
> (http://www.nabble.com/OpenCms6.0.0-on-IBM-WebSphere-5.1-t384256.html#a1060458),
> it said "modification in
> org.opencms.workplace.CmsWorkplace.sendCmsRedirect: changed Redirect
> to Forward . If you do not change this, some pages will not be
> displayed, such as advanced properties. The reason behind is, that
> WebSphere does not do Redirects from included pages". Do your modified
> it and recompiled? If you recompile this java class, what you set
> parameter of "param" of sendForward method, set it to null? or
> anything else?
> And in
> (http://www.nabble.com/OpenCms6.0.0-on-IBM-WebSphere-5.1-t384256.html#a1060458),
> do you modified all things that paper refered? Can you give me some
> hints about that?
> Thanks for your services.
> Zhibin
>
>
>> From: Georg Raffer <georg.nc at gmail.com>
>> To: Huang Zhibin <zbhuang2002 at hotmail.com>
>> Subject: Re: why my struts demo working in tomcat but not in was?
>> Date: Mon, 26 Jun 2006 09:38:17 +0200
>>
>> Hi,
>>
>> Struts works very fine in our application on WAS (with OpenCms 6.2).
>> What is the problem / exception on WAS?
>> Your config seems to be ok.
>>
>> I never use the short version of <action>
>>
>> <action path="/jump" forward="/opencms/strutsTest/success.jsp">
>> </action>
>>
>> try to implement a "more complex" action:
>>
>> <action
>> path="/jump"
>> type="my.domain.struts.LoginAction"
>> validate="false"
>> input="/opencms/strutsTest/success.jsp"/>
>>
>> Extend LoginAction from org.apache.struts.Action
>>
>> add execute method:
>> return mapping.getInputForward();
>>
>> try to add loggings to each class ....
>>
>> hope that helps ...
>> bye, Georg
>>
>>
>> Huang Zhibin wrote:
>> > Hi Georg,
>> > How about you these days?
>> > I made one strut demo to test how to integrate struts app in opencms.
>> > Now it works on tomcat+mysql+jdk1.4, but not working on
>> > was+mysql+jdk1.4!? All files are the same. So can you point out what I
>> > have done wrong? Any suggestions are appreciated! If you think what I
>> > did totally wrong, can you give me some suggestons about creating one
>> > simple struts demo in opencms?(I searched long time, but not very 
> useful)
>> > I will describe what I did below.
>> > Copy struts tag
>> > files(struts-bean.tld/struts-html.tld/struts-logic.tld) in
>> > \opencms_war.ear\opencms.war\WEB-INF, and struts-config.xml and 
> web.xml.
>> > I also in opencms(http://localhost:8080/opencms/opencms/system/login)
>> > create one folder of "strutsTest", create two files(index.jsp and
>> > success.jsp) to test whether system can find action and implement it.
>> > -----------------------------
>> > 1. index.jsp
>> > <%@ page contentType="text/html;charset=UTF-8" language="java" %>
>> > <%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
>> > <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
>> > <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
>> > <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
>> >
>> > <%
>> > response.setHeader("Cache-Control","no-store"); //HTTP 1.1
>> > response.setHeader("Pragma","no-cache"); //HTTP 1.0
>> > response.setDateHeader ("Expires", 0); //prevents caching at the proxy
>> > server
>> > response.addHeader("Cache-control", "max-age=0");
>> > %>
>> >
>> > <html:html>
>> > <head>
>> > <title>Hello - A first Struts program</title>
>> > <html:base/>
>> > </head>
>> >
>> > <body bgcolor="white"><p>
>> > <a href="/opencms/jump.do">testAction</a>
>> > </body>
>> > </html:html>
>> > -------------------------------
>> > 2. success.jsp
>> > <%@ page contentType="text/html;charset=UTF-8" language="java" %>
>> > <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
>> > <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
>> > <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
>> >
>> > <html:html locale="true">
>> > <head>
>> > <title>Hello - A first Struts program</title>
>> > <html:base/>
>> > </head>
>> >
>> > <body bgcolor="white"><p>
>> > success!!!
>> > </body>
>> > </html:html>
>> > ------------------------------
>> > 3. struts-config.xml
>> > <?xml version="1.0" encoding="iso-8859-1"?>
>> > <!DOCTYPE struts-config PUBLIC
>> > "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
>> > "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
>> >
>> > <struts-config>
>> >
>> > <action-mappings>
>> > <action path="/jump" forward="/opencms/strutsTest/success.jsp">
>> > </action> </action-mappings>
>> >
>> > </struts-config>
>> > --------------------------------
>> > 4. Content added in file of web.xml
>> > <!-- Struts Action Servlet Configuration -->
>> > <servlet>
>> > <servlet-name>action</servlet-name>
>> > <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
>> > <init-param>
>> > <param-name>config</param-name>
>> > <param-value>/WEB-INF/struts-config.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>
>> >
>> > <!-- struts action-->
>> > <servlet-mapping>
>> > <servlet-name>action</servlet-name>
>> > <url-pattern>*.do</url-pattern>
>> > </servlet-mapping>
>> >
>> > <!-- Struts Tag Library Descriptors -->
>> > <taglib>
>> > <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
>> > <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
>> > </taglib>
>> >
>> > <taglib>
>> > <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
>> > <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
>> > </taglib>
>> >
>> > <taglib>
>> > <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
>> > <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
>> > </taglib>
>> > --------------------------------------------------------------
>> >
>> >
>> >
>>
>
>
>




More information about the opencms-dev mailing list