Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Ben Liu

Greenhorn
+ Follow
since Feb 01, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ben Liu

Hi,

I'm working on a Struts/Tiles web app with Websphere 5.1.2 and Struts 1.2.4

I'm getting exceptions when trying to use the Validator framework.

After debugging, it almost seems as if the strut-config.xml is not being properly digested.

The property maps of the Plug-Ins are always null.

Thus, the ValidatorPlugIn does not know that I've specified a "pathnames" property.

Here's my struts-config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!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>

<!-- Data Sources -->
<data-sources>
</data-sources>

<!-- Form Beans -->
<form-beans>
<form-bean name="reconWorkqueueActionForm" type="com.sscims.palms.gui.workqueue.recon.ReconWorkqueueActionForm">
</form-bean>
<form-bean name="reconActionForm" type="com.sscims.palms.gui.recon.ReconActionForm">
</form-bean>
<form-bean name="progressActionForm" type="com.sscims.palms.gui.recon.progress.ProgressActionForm">
</form-bean>
<form-bean name="loginActionForm" type="com.sscims.palms.gui.LoginActionForm">
</form-bean>
<form-bean name="tmvDetailsActionForm" type="com.sscims.palms.gui.recon.tmvdetails.TMVDetailsActionForm">
</form-bean>
<form-bean name="analysisActionForm" type="com.sscims.palms.gui.recon.analysis.AnalysisActionForm">
</form-bean>
<form-bean name="cashActionForm" type="com.sscims.palms.gui.recon.cash.CashActionForm">
</form-bean>
<form-bean name="positionActionForm" type="com.sscims.palms.gui.recon.cash.PositionActionForm">
</form-bean>
<form-bean name="checklistActionForm" type="com.sscims.palms.gui.recon.cash.ChecklistActionForm">
</form-bean>
</form-beans>

<!-- Global Exceptions -->
<global-exceptions>
</global-exceptions>

<!-- Global Forwards -->
<global-forwards>
<!-- Default forward to "Welcome" action -->
<!-- Demonstrates using index.jsp to forward -->
<forward name="loginPage" path="/showLogin.do" redirect="true">
</forward>
</global-forwards>

<!-- Action Mappings -->
<action-mappings>
<!-- Default "Welcome" action -->
<!-- Forwards to Welcome.jsp -->
<action path="/PALMSBase" type="com.sscims.palms.gui.PALMSBaseAction">
</action>
<action path="/login" type="com.sscims.palms.gui.LoginAction" input="/pages/login/login.jsp" name="loginActionForm" scope="request" validate="true">
<forward name="success" path="/defaultPageDispatcher.do" redirect="false">
</forward>
</action>
<action path="/logout" type="com.sscims.palms.gui.LogoutAction" >
<forward name="success" path="/showLogin.do" redirect="true">
</forward>
</action>
<action path="/showLogin" type="com.sscims.palms.gui.ShowLoginAction" validate="false">
<forward name="success" path="/pages/login/login.jsp" >
</forward>
</action>
<action path="/recon/showWorkqueue" type="com.sscims.palms.gui.workqueue.recon.ShowReconWorkqueueAction">
<forward name="success" path="/pages/workqueue/workqueue.jsp">
</forward>
</action>
<action path="/recon/showReconWorkqueue" type="com.sscims.palms.gui.workqueue.recon.ShowReconWorkqueueAction" name="reconWorkqueueActionForm" scope="request" input="/pages/workqueue/recon/recon.jsp">
<forward name="success" path="/pages/workqueue/recon/recon.jsp">
</forward>
</action>
<action path="/recon/showProgress" type="com.sscims.palms.gui.recon.progress.ShowProgressAction" name="progressActionForm" scope="request" input="/pages/recon/progress/progress.jsp">
<forward name="success" path="/pages/recon/progress/progress.jsp">
</forward>
</action>
<action path="/recon/showTMVDetails" type="com.sscims.palms.gui.recon.tmvdetails.ShowTMVDetailsAction" name="tmvDetailsActionForm" input="/pages/recon/tmvDetails/tmvDetails.jsp" scope="request" validate="false" >
<forward name="success" path="/pages/recon/tmvDetails/tmvDetails.jsp">
</forward>
</action>
<action path="/recon/showAnalysis" type="com.sscims.palms.gui.recon.analysis.ShowAnalysisAction" name="analysisActionForm">
<forward name="success" path="/pages/recon/analysis/analysis.jsp">
</forward>
</action>
<action path="/recon/showCash" type="com.sscims.palms.gui.recon.cash.ShowCashAction" name="cashActionForm" scope="request" input="/pages/recon/cash/cash.jsp">
<forward name="success" path="/pages/recon/cash/cash.jsp">
</forward>
</action>
<action path="/recon/showPosition" type="com.sscims.palms.gui.recon.position.ShowPositionsAction">
<forward name="success" path="/pages/recon/position/position.jsp">
</forward>
</action>
<action path="/recon/showChecklist" type="com.sscims.palms.gui.recon.checklist.ShowChecklistAction">
<forward name="success" path="/pages/recon/checklist/checklist.jsp">
</forward>
</action>
<action path="/recon/processTMVDetails" type="com.sscims.palms.gui.recon.tmvdetails.ProcessTMVDetailsAction" input="/pages/recon/tmvDetails.jsp" name="tmvDetailsActionForm" scope="request">
<forward name="success" path="/pages/recon/tmvDetails/tmvDetails.jsp">
</forward>
<forward name="progress" path="/recon/showProgress.do">
</forward>
</action>
<action path="/recon/processAnalysis" type="com.sscims.palms.gui.recon.analysis.ShowAnalysisAction" name="analysisActionForm">
<forward name="success" path="/pages/recon/anlysis/analysis.jsp">
</forward>
</action>
<action path="/defaultPageDispatcher" type="com.sscims.palms.gui.DefaultPageDispatcherAction">
<forward name="recon_default" path="/recon/showWorkqueue.do" redirect="true">
</forward>
</action>
<action path="/recon/reconDefaultPageDispatcher" type="com.sscims.palms.gui.recon.ReconDefaultPageDispatcherAction">
<forward name="analysis" path="/recon/showAnalysis.do" redirect="true">
</forward>
<forward name="mktvalues" path="/recon/showTMVDetails.do" redirect="true">
</forward>
<forward name="progress" path="/recon/showProgress.do" redirect="true">
</forward>
</action>
<action path="/testPA" type="com.sscims.palms.sample.PATestAction">
<forward name="success" path="/pages/basicPage.jsp">
</forward>
</action>
</action-mappings>

<!-- ============================================= Controller Configuration -->
<controller
processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>

<!-- Message Resources -->
<message-resources parameter="ApplicationResources" 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/tileDefinitions.xml"/>
<set-property property="moduleAware" value="true" />
<set-property property="definitions-parser-validate" value="true" />
</plug-in>
<!-- =================================================== Validator plugin -->

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml"/>
</plug-in>

</struts-config>

My ActionForm:

package com.sscims.palms.gui;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.validator.ValidatorActionForm;
import org.apache.struts.validator.ValidatorForm;

/**
* Form bean for a Struts application.
* @version 1.0
* @author
*/
public class LoginActionForm extends ValidatorActionForm {

private String username;
private String password;

/**
* Constructor
*/
public LoginActionForm() {

super();

}
public void reset(ActionMapping mapping, HttpServletRequest request) {

// Reset values are provided as samples only. Change as appropriate.

}

public ActionErrors validate(
ActionMapping mapping,
HttpServletRequest request) {


ActionErrors errors = super.validate(mapping, request);
if (errors == null) {
errors = new ActionErrors();
}

// Validate the fields in your form, adding
// adding each error to this.errors as found, e.g.

// if ((field == null) || (field.length() == 0)) {
// errors.add("field", new ActionError("error.field.required"));
// }
return errors;

}

/**
* Returns the password.
* @return String
*/
public String getPassword() {
return password;
}

/**
* Returns the username.
* @return String
*/
public String getUsername() {
return username;
}

/**
* Sets the password.
* @param password The password to set
*/
public void setPassword(String password) {
this.password = password;
}

/**
* Sets the username.
* @param username The username to set
*/
public void setUsername(String username) {
this.username = username;
}

}

My validation.xml file:

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN"
"http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd">;

<form-validation>

<global>

<constant>
<constant-name>postalCode</constant-name>
<constant-value>^\d{5}\d*$</constant-value>
</constant>

</global>

<formset>

<!-- An example form -->
<form name="/login">
<field
property="username"
depends="required">
<arg key="login.username"/>
</field>
<field
property="password"
depends="required,mask">
<arg key="login.password"/>
<var>
<var-name>mask</var-name>
<var-value>^[0-9a-zA-Z]*$</var-value>
</var>
</field>
</form>

</formset>

</form-validation>

Thanks in advance!
-Ben



[4/20/05 13:37:53:965 PDT] 63d4584b WebGroup E SRVE0026E: [Servlet Error]-[action]: java.lang.IllegalArgumentException: Resources cannot be null.
at org.apache.commons.validator.Validator.<init>(Validator.java:188)
at org.apache.struts.validator.Resources.initValidator(Resources.java:299)
at org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:106)
at com.sscims.palms.gui.LoginActionForm.validate(LoginActionForm.java:40)
at org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:921)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:206)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:983)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:564)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)


Thanks in advance!
-Ben
15 years ago
Real problem:

Indexed properties should be expressed as follows:

public class MyForm extends ActionForm {

public Object[] getIndexedProperty() {
}

public void setIndexedProperty(int i, Object property) {
}
}

// the following causes problems for JDK 1.4:
public Collection getIndexedProperty() {
}

public Object getIndexedProperty(int i) {
}

public void setIndexedProperty(int i, Object property) {
}

JSP as follows:

<nested:iterate property="indexedProperty" >
<nested:hidden property="subProperty" />
</nested:iterate>

Regards and thanks for the help,
-Ben
15 years ago
FYI. It seems to be an issue between JDK 1.3 and JDK 1.4 reflection.

The overloaded methods getMVBreakdowns() and getMVBreakdowns(int i) are causing problems.
15 years ago
Thanks. I confirmed that it is an overloaded method issue.

My JSP, however, is as follows:

<nested:iterate property="MVBrakdowns">
<nested:write property="MVBreakdowns.sectionId" />
</nested:iterate>

This needs both the Collection getMVBreakdowns() and the MarketValueBreakdown getMVBreakdowns(int i) methods to be named the same.

Is there another alternative or workaround for this?

I don't think WAS 5.1.2 is a JSP 2.0 container or else I could do something as follows:

<c:forEach items="${form.MVBreakdowns}" var="mvbreakdown" varStatus="breakdownStatus" >
<html:text property="MVBreakdowns[${breakdownStatus.index}].sectionId" />
</c:forEach>

I still want to avoid JSP scriptlets, but it seems that might be the best route.

Thanks in advance!
-Ben
15 years ago
Hi,

I'm having a problem with a web application that I'm developing. I'm using nested objects with Struts, JSTL and WASD 5.1.2

My code works fine in WASD 5.0, but breaks in WASD 5.1.2. The error says that it can't find a getter method for a property.

This is an indexed property.

My ActionForm is as follows:

Public class MyActionForm extends ActionForm {
private IndexedProperty MVBreakdowns; // a class that wraps around a HashMap

public Collection getMVBreakdowns() {
// returns as an ArrayList
}

public MarketValueBreakdown getMVBreakdowns(int i) {
// return the ith MarketValueBreakdown object
}

public void setMVBreakdowns(int i, MarketValueBreakdown breakdown) {
// sets the ith MarketValueBreakdown
}

My JSP is as follows:



...


I also tried using JSTL tags:




Both have similar issues with WASD 5.1.2, but works fine with WASD 5.0

Is this a known issue with Websphere?

is there a work around that does not include using straight JSP scriptlets?

Thanks in advance!
-Ben
15 years ago
Hi,

I'm having a problem with a web application that I'm developing. I'm using nested objects with Struts, JSTL and WASD 5.1.2

My code works fine in WASD 5.0, but breaks in WASD 5.1.2. The error says that it can't find a getter method for a property.

This is an indexed property.

My ActionForm is as follows:

Public class MyActionForm extends ActionForm {
private IndexedProperty MVBreakdowns; // a class that wraps around a HashMap

public Collection getMVBreakdowns() {
// returns as an ArrayList
}

public MarketValueBreakdown getMVBreakdowns(int i) {
// return the ith MarketValueBreakdown object
}

public void setMVBreakdowns(int i, MarketValueBreakdown breakdown) {
// sets the ith MarketValueBreakdown
}

My JSP is as follows:

<nested:iterate name="actionForm" property="MVBreakdowns" >
<nested:hidden property="sectionId" />
...
</nested:iterate>

I also tried using JSTL tags:

<c:forEach ...>
</c:forEach>

Both have similar issues with WASD 5.1.2, but works fine with WASD 5.0

Is this a known issue with Websphere?

is there a work around that does not include using straight JSP scriptlets?

Thanks in advance!
-Ben
15 years ago
I usually look for the tnsnames.ora file. Then I look for the SID.

All the information will be listed there.
15 years ago
Hi,

I have a simple MDB which is listening to an MQ Queue. When I try to start the listener port, it will not start.

What log file can I look at to debug/troubleshoot this issue?

I'm runing Websphere 5.x on a local queue manager. I configured an MQ JMS Queue Connection Factory and MQ JMS Queue via the console. They are all listening on port 1415.

The SystemOut.log file does not log any error messages.

Thanks in advance!
-Ben
15 years ago