Starting With Liferay development environment setup

Posted: December 3, 2013 by Narendra Shah in Liferay
Tags: , ,

This post is for first time java developer, who would like to use and setup Liferay.

The steps required to start liferay in your localsystem is easy.

1. Get portal.zip with tomcat from liferay download link

2. Unzip to any folder, unzipped folder contains portal within that there is tomcat within.

3. You can open tomcat/bin folder from portal folder, and then run startup.bat(in linux it is startup.sh).

4. This will start liferay with default configuration,h  so once server started, you can open the server hostname:8080, and you will see wizard for configuration of jdbc configuration for database and default user setup.  Here one thing is, you need to create blank database in your favourate RDBMS tool, and once liferay starts it will create all required tables,indexed etc.

5. Thats it, your liferay instance is started in your local.

6. Now you can play with your instance.

Will post more advanced stuff in next post.

When ever we have integration with webservices or other server, where java/tomcat process interacts using https protocol, we need to install certificate for the same. This is common requirement where certificate expires or not able to find valid certificates, We get below like below exception. To fix this issue we can use keytool utility to register certificate.

Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target        at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:174)
        at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:238)        at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:318)

Steps to install certificate in java store.

1. Get certificate files(usually .crt file.). We can open the url in firefox / chrome and then click on https/certificate, it will display more information-> Security tab-> View Certificate button -> Details Tab->export and save file with some name with .crt extension(example.crt).

2. As an example java is installed on (/usr/jdk), run following command to see already existing certificates.

/usr/jdk/bin/keytool -list -keystore “/usr/jdk/jre/lib/security/cacerts”

It will ask password, default password is changeit

2. Install certificate with following command.

/usr/jdk/bin/keytool -import -noprompt -trustcacerts -alias mysite -file  example.crt -keystore  “/usr/jdk/jre/lib/security/cacerts”  -storepass changeit

Thats it certificate will be installed in your java process. and restart the server, every thing will be good now.

Make your Eclipse Faster

Posted: February 11, 2013 by Narendra Shah in Java Box, Reserch And Development

Once we start working on Eclipse, After some time, it usually became slow. To make it fast, there is way to clean up history and indexes which eclipse has created. (if both are not important to you). This helped me to speed up eclipse, and decrease RAM and HDD usage on my system

Here are the 2 folders, which should be cleanup

Index info
C:\Users\<YOUR-USERNAME>\workspace\.metadata\.plugins\org.eclipse.jdt.core
History
C:\Users\<YOUR-USERNAME>\workspace\.metadata\.plugins\org.eclipse.core.resources\.history

Delete the files under both the folder. This is big impact on eclipse performance.

Note: Both folder are part of your Eclipse workspace and not of your Projet source or eclipse installation. You can view workspace location information under Windows->Preferences->(General->Startup and Shutdown->workspaces).

You can even follow below links, if you running slow machine

http://eclipse.dzone.com/articles/faster-eclipse-on-slower-machi

There some good part ref: http://stackoverflow.com/questions/316265/tricks-to-speed-up-eclipse

1.  Add following in eclipse.ini

-Xverify:none

2. Configure Xmx and Xms and permsize according to your system. I have configured mine with following in eclipse.ini

-Dosgi.requiredJavaVersion=1.6
-Xms256m
-Xmx796m
-XX:PermSize=512m
-XX:MaxPermSize=512M
-Xverify:none

This are all working parameters.

In JDBC application, one and foremost question either to use stored procedure or java Preparedstatement. To search this it took around 2 days and finally understood the concept.

In JDBC when ever we use PreparedStatement  it would be compiled for that particular connection, so once you close the connection and open new connection PrepareStatement would be recompiled. So here if you want to leverage preparestatement then you it should be on single connection, or else if we are performing multiple connection object and using preparedstatement will reduce performance for that statement/query because there will be precompilation process happens at each connection level.  I hope this will be much clear in terms of using PreparedStatement

Using stored procedure is being standard procedure for join or big queries, it is definitely good idea, but it will restrict database portability in your application, once you decide to migrate  the database to another RDBMS system, you may need to rewrite the stored procedure again. In regards to performance benefit of stored procedure, it is giving performance benefit because database engine need not to recompile the sql statement again and again. This will affect microsecond  level, but if  some query is perform frequently or used widely, we should convert it to stored procedure.

Reviewed Liferay Portal system Development Book

Posted: March 18, 2012 by Narendra Shah in Liferay, Open Source World

This book contains lots of in depth content related to liferay inbuild functionality. This book is recommended for Java/J2EE and liferay basic knowledge person, who want to dig in Liferay book. I did not found this much ready mad material on liferay documentation also. For this book, rather to review whole content, i will add chapter by chapter review.

Chapter 1: Liferay Enterprise Portal: This chapter contains information related to different liferay solution, what are development methodologies, when to use where, development stages etc. It contains abstract information about Liferay and way of working with liferay.

Chapter 2: Service-Builder and Development Environment: This chapter specify development environment setup, portal and plugin structure, liferay very important feature called service builder and at last plugin development. This chapter lacking some examples but at the same time, provides very in depth knowledge on features.

Chapter 3: Generic MVC Portlets: Here all information related to plugin portlet is shown with very useful information like What’s Happening Here,  this section specifies very good information that what is happening the given codebase. This chapter contains all xml,xsd, database configuration related stuff in very nice way.  Here i found i am lacking some information related to spring portlet, it might be added and some database persistent model like hibernate/ JPA, and there is no information regarindg Inter portlet communication information.

Chapter 4: Ext Plugin and Hooks: This chapter specify where to use ext, where to use hook, some advanced tricks for liferay overriding(book specify overwriting but i think overriding is better word to use).

Chapter 5: Enterprise Content Management: This chapter starts with image management, permission, document management WebDav functionality, record management and ends with content authorizing. This chapter contains lots of reference material. It is not necessary that each part is important for an person, who is initial state to learn. Each part applies on different functionalists and could be used as and when needed. Great reference chapter to work with inbuilt content management portlet.

Chapter 6: DDL and WCM: DDL is not data defination language of sql, it is related to web content management related to dynamic data list and dynamic data mapping. I was little confuse when started, but in the first paragraph, understood this. This chapter is dedicated to WCM Funcationlity of liferay. and it also contains information related to localization, template, types of files used. Good to refer the chapter for some more indepth knowledge on liferay web content fictionality.

Chapter 7: Collaborative and Social API: This chapter related to blog, message boards,asset management, chat type portlet from liferay. It contains ready to use info to directly work with that functionality and backend modification if required framework information. Good to go thru this chapter before starting to use liferfay inbuilt collaberation and social media portlets.

Chapter 8: Staging, Scheduling,Publishing, and Cache Clustering: This chapter is useful after developing all required portlet, and running in staging environment, configuration for deployments like different cache configuration,  portal instance configuration, group, layout, stading and publishing, Nicely arranged information in this chapter is useful after development and before publishing server.

Chapter 10: Indexing, Search, and Workflow: This chapter relates to SEO, auto complete , open search, workflow stuff. It contains information for which i have very less knowledge :). I gone thru the chapter, i feel i need to revisit the chapter.

Chapter 11:Mobile Devices and Portlet Bridges: It includes information related to layout and themes, and many differenet technologies portlet creation.

Final thoughts: This book contains lots of in depth information related to liferay, which shows authers in depth knowledge on liferay. I dont think any good liferay developer also knowing all this stuff. At the same time, i found book lacks some examples.I loved this book at first time only. So it is obviously great book to have.

I am very thank ful to Team of Packt publication for giving chanse to review the book. I hope review will be helpful to auther and packt team.

I have already provided my initial reviews. Now writing final reviews about the book.

In Book Liferay Beginners Guide, at the first look itself, found that contents are well arranged, it contains little theory first and then example. So if person follows complete book.  He/she can learn liferay easily. I appreciate efforts by Cignex Datamatics Team. Good Luck.

Good content in Book

  •  For starting, learning and setting up liferay this book is the first choice.
  • Contains enough examples and exercises(Time for action contents)
  • It contains all liferay inbuilt portlet, which shows how they could be used in best way.
  • Contains initial setup and requirements related information

This book is for those person who do not know anything about liferay. and want to learn and searching for some good startup. Their searches ends here.

If one wants design a website based on liferay, he can easily create that after understanding and reading book.

Book contains lots of things which may be available in liferay documents, but i appreciate simplicity of the book.

Wishing All The Best to Book Authors and Publisher.

Since last one year, i am working with liferay projects. I was looking for some good startup book on liferay. There are lots of companies are moving towards Liferay. And at developer stand, it is really good to learn liferay. According to me why i like liferay, as such some of the built in tool are stable and good. and allmost with all of the java library and other library like php, .net, there is integration possible. So as a developer you are limitless to provide integration support for your application.

In Book Liferay Beginners Guide, at the first look found that contents are well arranged, it contains little theory first and then example. So if person follows complete book.  He can learn liferay easily. I appreciate efforts by Cignex Datamatics Team. Good efforts.

Good content in Book

  •  For starting, learning and setting up liferay this book is the first choice.
  • Contains enough examples and exercises(Time for action contents)
  • In built portlet knowledge.
  • Contains initial setup and requirements related information.

Lackings:

  • No development information, how to develop portalet with liferay.
  • Integration support is not added.
  • Liferay 6.1 is on a way, and as such it is paper print, so no information within book. And for older release also no information.
  • I may expect advance version of the book.

I will add more summary and reviews for the book in between of reading and completing reading book.

Create/Edit iso image in linux

Posted: May 21, 2009 by Narendra Shah in Linux Box
Tags: ,

It’s rather trivial task to make some changes into already burned installation or live CD. It may be performed to add some files to this CD or edit files on it. In any case it’s impossible to loop mount .iso file and then save it as iso9660 filesystem is read-only.

So, just mount your CD or iso image to some directory by commands:

sudo mkdir /mnt/image
sudo mount /dev/cdrom /mnt/image

or


sudo mount /path/to/your.iso /mnt/image -o loop

then copy it’s contents to some directory:

mkdir /tmp/newiso
cp -r /mnt/image /tmp/newiso

After this you can modify any files in /tmp/newiso, add files, delete them. After modifications are done, create new ISO image to be burned onto CD (or kept somewhere for a rainy day):

cd /tmp/newiso

and

sudo mkisofs -o /tmp/new.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -R -V “new iso name” .

After mkisofs is finished new ISO file will be created at /tmp directory.

Today i came to know how to set default webapplication. I mean that when you install tomcat in your system. When you open your-machine-ip:8080 then tomcat application is displayed but to configure your application on first page is really easy.

It is actually loading root application which comes with your tomcat free.

Just add following in your tomcat-dir/conf/server.xml

Search for host tag and put following lines in between.(search <host )

……
<Context path=”” docBase=”iview” debug=”0″ reloadable=”true”>
</Context>
………….

Now one more thing new tomcat(above v5.x) is preserving session between tomcat restart but to stop that you can change tomat-dir/conf/context.xml and un-comment following tag.

<Manager pathname=”” />

You can also change default port for your tomcat. Just change port attribute value to your custome port number in connector tag in server.xml. And you are done.

Apache Linux Tomcat configuration

Posted: April 30, 2009 by Narendra Shah in Java Box

Sharing here link only and not real content. Some times i am having problem to configure tomcat and apache. Each time i need to google but today i thought to put link for it.


HOWTO : Installing Web Services with

Linux / Tomcat / Apache / Struts / Postgresql / OpenSSL / JDBC / JNDI / DBCP


Apache 2.x + Tomcat 4.x + Load Balancing Tutor