Disable Web-sphere portlet container

Websphere 6.1 and above comes with in-built portlet container. Websphere load portlet api with all web application. There is no settings in adminstraive console to disable portlet container, it is an over-ahead on memory. This specifically make an problem or java based portal server e.g  jetspeed-2 , Liferay etc. There is only one way to disable it. You add the following context param to disable portlet container for your web application. This also saves the memory foot print.

  <context-param>
     <param-name>com.ibm.websphere.portletcontainer.PortletDeploymentEnabled</param-name>
     <param-value>false</param-value>
   </context-param>

Wicket Form validation on Ajax

Form validation in Wicket is very simple. Just add the feedback panel in your mark-up and put validation on your form fields.
Wicket form can be summited by Ajax too, but in that case validation become different.

Wicket Logo

Wicket Ajax is based on target rule, so need to pass on your request to next component. Same thing happen in case of form validation

If you need to do form Validation in Wicket Ajax form don’t forget to override “onError” in your form. Other wise Wicket will keep on giving the warining message
that Feedback panel not found.

                @Override
protected void onError(AjaxRequestTarget target, Form form)
{
target.addComponent(feedback);
}

Above code will redirect the Ajax response to feedback panel to show Error messages.

Java OutOfMemory Error

We all would faced the OutOfMemory error some times in our projects. Some times it make some confusion to us that
we all thought  in college that Java manage it memory its own. Still there are some parameters by which you can tweak
you memory.
There are three basic reason which causes the OutOfMemory

  • Heap size
  • PermGen Space
  • Threads

Heap Size

Java always defines default heap size, it also varies with different version of jvm

java 1.5 has default 2mb minimum and 64 mb max heap size.

It always good to define your own heap size based on your application, other wise  GC overhead limit would exceed and throw the OutofMemory error

There can have some of following reasons and solution

  • Requested array size exceeds VM limit
  • Heap too small
  • Excessive use of finalizes
  • Monitor objects pending finalization
  • look for logic error in array allocation code
  • Memory leak

To avoid above error you should

  • Adjust maximum heap size (-Xms<size>)
  • Analyze heap dump(MemoryMXBean, jmap, jconsole)

I would be covering remaining topics in coming days.