Thursday, September 17, 2009

SpringMVCPortlets using JSR-286(Spring 3.0)

SpringMVC portlet framework that wish to make use of the JSR-286 features need to have Spring 3.0 jars and the relevant methods need to be implemented in the code.

All JSR-286 features are supported in Spring 3.0 Portlet WebMVC framework.


To Convert SpringWebMVC 2.0 portlet to SpringWebMVC3.0 portlet, the changes required are listed below.

1) portlet.xml , for changes to portlet 2.0 schema from portlet 1.o schema.

2) liferay-display.xml, for changes to DTD for liferay 5.2.*, as it was there for liferay 4.0 previously.(This is specific to liferay, requires no change on other servers)

3) liferay-portlet.xml for changes to DTD for liferay 5.2.*, as it was there for liferay 4.0 previously.(This is specific to liferay, requires no change on other servers)

4) removed spring 2.0 jars from WEB-INF/lib and added spring 3.0 jars to WEB-INF/lib

5) added portlet.jar in the WEB-INF/lib as it contains the support for Portlet 2.0 specification, excluded this jar during WAR creation as liferay contains duplicate jars.(This jar name is taken from liferay , may be different if the target server is diferent)

6) build.xml for excluding the portlet.jar during WAR creation.(This is required as the target server may contain duplicate jar with the same name and may fail the deployment).

7) common.xml for chages DTD for spring 3.0

8) *-portlet.xml for changes DTD for spring 3.0

9) Add new imports to the Controller classes and implement EventAwareController,ResourceAwareController interfaces and their methods

All of the Portlet2.0(JSR-286) features can be implemented by following the steps above.

Example code is coming soon.

SpringMVCPortlets

Spring Portlets can be built using spring portlet mvc framework.

The central controller for the portlet would be DispatcherPortlet, that handles all the requests and dispatches to the relevant views.

Wednesday, May 6, 2009

Running Multiple Operating Systems(Windows and Ubuntu Linux) on the same machine

VMWare Player is a freely downloadable VMWare.
Download VMWare player software and install it on your windows OS
download an image of the Ubuntu Linux Desktop version called Ubuntu from http://www.ubuntu.com/getubuntu/download
that in iso image format.
Then download VMWare configuration bundle that contains a list of files, extract those file to some folder like C:\OS\.
Then edit the file" os.vmx file and give the path of the .iso image in that file in the line like below.

ide1:0.fileName = C:\OS\ubuntu-8.10-desktop-i386.iso"

Now open the file os.vmx file using the vmware player, that will open the Ubuntu OS.

You will get a list of options in that select the option install Ubuntu without changing your current configuration of the system

Now that will start the Ubuntu OS in a window inside your windows OS.
Now you have a browser and all the applications inside the Ubuntu OS, you can start working on that.

Double click on this window/expand it to show in full screen.
To switch between the operating systems press alt+ctrl and you can work on both Windows as well as Ubuntu Linux on the same time. By default both the operating systems share half of your system RAM.

Friday, February 13, 2009

WebSphere Software not installed properly - .nfiregistry and vpd.properties

The installer program for WebSphere® Products use the InstallShield MultiPlatform (ISMP) program to install code. The .nifregistry and vpd.properties files list program components that are currently installed. The file helps ISMP and the installer programs of WebSphere products recognize previous installations of WebSphere products and control options for new installations.
Inorder to successfully install a websphere product after uninstalling another version of the same websphere product, you need to remove the .nfiregistry and vpd.properties files(vpd.properties). Without doing this the ISMP assumes that the same version of the websphere product exists and does not install the product and completes the process.

Location of the .nfiregistry fils on various platforms isThe location of the .nifregistry file varies per operating platform:
On AIX® platforms: The root directory /usr/.ibm/.nif/.nifregistry or the non-root directory /.ibm/.nif/.nifregistry

On HP-UX platforms: The root directory /opt/.ibm/.nif/.nifregistry or the non-root directory /.ibm/.nif/.nifregistry

On i5/OS® platforms: The root directory /QIBM/WAS/.ibm/.nif/.nifregistry

On Linux® platforms: The root directory /opt/.ibm/.nif/.nifregistry

On Solaris platforms: The root directory /opt/.ibm/.nif/.nifregistry or the non-root directory /.ibm/.nif/.nifregistry

On Windows® platforms: The root directory C:\Windows\.nifregistry

Delete this .nfiregistry file manually and the reinstallation of the websphere software works.

Sunday, January 18, 2009

Struts Exceptions during development

javax.servlet.ServletException: Wrapper cannot find servlet class org.apache.struts.action.ActionServlet or a class it depends on
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Unknown Source)

root cause
java.lang.ClassNotFoundException: org.apache.struts.action.ActionServlet
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1360)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Unknown Source)

To avoid these type of exceptions/erros place all the struts related jar files in the lib folder of your web application.

Saturday, January 17, 2009

Using Struts 1.x without tld files

These are the "tag library descriptor" files that describe the custom tags in the various Struts tag libraries. The tld file for any Struts taglibs that you use should be copied into the WEB-INF directory of your web application. (Applications under Servlet 2.3 containers can omit this step if the standard uri is referenced.)

That can be achieved as follows.
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>


For Servlet 2.3/2.4 containers only: The Servlet 2.3 and 2.4 specifications simplify the deployment and configuration of tag libraries. The instructions above will work on older containers as well as 2.3 and 2.4 containers (Struts only requires a servlet 2.2 container); however, if you're using a 2.3/2.4 container such as Tomcat 4.x/5.x, you can take advantage of a simplified deployment.
All that's required to install the Struts tag libraries is to copy struts.jar into your /WEB-INF/lib directory and reference the tags in your code like this:


Note that you must use the full uri defined in the various tlds so that the container knows where to find the tag's class files. You don't have to alter your web.xml file or copy tlds into any application directories.

Friday, January 16, 2009

ClassNotFoundException Dispatcher Servlet in SpringMVC

Some times we may get ClassNotFoundException- Dispatcher Servlet in Spring MVC , even though we keep the spring.jar and spring-webmvc.jar using configuring the build path. The root cause of this error is your IDE expects the jars to be located physically in the lib folder. So Copy all the required jars in the lib folder, that should solve the problem.