Tuesday, November 01, 2011

WebSphere Commerce 7 feature packs - troubleshooting

I was getting below error while trying to install feature pack 1 for Websphere Commerce 7 developer edition (I selected "Enable all features" option in IBM installation manager at the final step of feature pack installation) There are two ways to resolve this :-
  1.  Try enabling the features one by one. Refer http://publib.boulder.ibm.com/infocenter/wchelp/v7r0m0/topic/com.ibm.commerce.install.doc/tasks/tigfepenable.htm

  2.  Try increasing the maximum heap size in enablefeature.bat 
  3.  
%RAD_HOME%\jdk\bin\java -cp "%CP%" -Xmx1536m -DLOGFILE=%LOG% org.eclipse.equinox.launcher.Main -application com.ibm.etools.j2ee.ant.RunAnt -logger com.ibm.commerce.config.internal.ant.loggers.FileLogger -data %WORKSPACE_DIR% -DWCInstallDir=%WCTOOLKIT% -DRADHome=%RAD_HOME% -Dworkspace=%WORKSPACE_DIR% -Dwashome=%WAS_HOME% -Dejbdir=%EJB_DIR% -buildfile %WCTOOLKIT%\components\common\xml\enableFeatureForToolkit.xml %*

Tuesday, May 29, 2007

Learning Struts 2 - Zero Configuration

Zero Configuration is a new feature introduced in Struts 2.

If you enable this,
  • No entry is required in struts.xml for defining new actions. Just write your action classes and they will be automatically mapped!!!!
  • Results (views) can be defined using annotations, no need to put entries in struts.xml
Mapping action classes

Modify web.xml and add the package names where your action classes can be located using actionPackages

<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
<init-param>
<param-name>actionPackages</param-name>
<param-value>com.mycompany.learning.struts2</param-value>
</init-param>

</filter>




Adding the above init-param will ensure that all actions classes in the package com.mycompany.learning.struts2 will be automatically mapped to the default URLs.

Mapping results views
Result views for an action should be specified using @Result & @Results annotations

For eg; Add the below annotation to your action class if you want to redirect to HelloWorld.jsp


@Result (name="success", value="/HelloWorld.jsp")
public class HelloWorldAction {
...code here...
}


Trouble-Shooting

1. How do I ensure my action class is automatically mapped?

You need to ensure the following:-
  • Check whether you package name is passed as to the FilterDispatcher in web.xml. If your action class is in x.y.z package, giving x.y is not sufficient for the automatic mapping to happen.
  • Your class should extend com.opensymphony.xwork2.ActionSupport or should end with the name Action

2. What will be the URL for my automatically mapped action classes?

If your action class name ends with Action, "Action" will be trimmed from the class name. And the remaining string will be formatted using java bean naming conventions.

Examples: (self-explanatory)
  • HelloAction.java - hello.action
  • HelloWorld.java - helloWorld.action
  • HelloWorldAction.java - helloWorld.action
  • HelloActionWorld.java - helloActionWorld.action

Wednesday, May 31, 2006

Struts Tips - Multi select list box "deselect all" problem

Problem
De-selecting all items from the multi select list box does not update the action form. Action form will still have the values pertaining to the previous selection.

Cause
When no items are selected from the list box, no data is sent for the parameter.

Solution
Add the below check in the action class:-

if (request.getParamter("list box name") == null) {
form.set(new String[]{});
}


This will clear the values of the earlier selection from the list box property

Saturday, April 01, 2006

JMS

Though I have used MQ Series in all the projects I have worked so far, i never got a chance to write a messaging program from scratch. Opportunity came when my ex-project mate requested me to take a training on JMS for his team members.

I started searching google for sample code that might help me write a simple "put" , "get" program, finally got one from Sun itself.

Assumptions
You are expected to have some basic understanding of messaging concepts.

H/W and S/W
This uses IBM MQ Series and the middleware, and tomcat servlet container.

What the program does




As shown above, this sample application has a text box where user can type something and on clicking "put" button, message will be send to a queue.

Clicking on "get" button will retrieve the first message in the queue and the message will be shown in the text box.

Logic for putting the message into queue