Internationalizing JSF Portlets

May 10, 2012 By Neil Griffin

There are at least two ways for handing internationalization with JSF and Liferay:

  1. Using the standard JSF mechanism to create your own i18n keyword, as shown in the jsf2-portlet demo.
  2. Using the built-in i18n keyword provided by the Liferay Faces Portal project, as shown in the jsf2-registration-portlet demo. I think this is a very nice integration point for JSF+Liferay, because it is able to "hook" into the thousands of existing internationalized keys that ship with Liferay Portal, as well as add your own. For more information on this approach, see the section titled "i18n" in the Liferay Faces documentation.

Migrating to Liferay Faces

April 10, 2012 By Neil Griffin

The Liferay Faces Reference Documentation has a new chapter titled "Migration Guide" that discusses migration issues that you may encounter when migrating from portletfaces.org projects to Liferay Faces. By way of preview, here are a list of topics discussed:

  • BridgeRequestAttributeListener
  • Configuration Option Names
  • File Upload
  • Facelet Tag Library Namespaces
  • GenericFacesPortlet
  • LiferayFacesContext
  • Logging
  • Portlet Preferences

For more information, you can download the latest version of the PDF from the following page:

http://www.liferay.com/community/liferay-projects/liferay-faces/documentation

If anyone encounters additional migration issues, please comment below and we'll try to get the documentation updated accordingly. Thanks everyone!

New Liferay Faces project at liferay.com

April 3, 2012 By Neil Griffin

Press Release

On April 3, 2012 a press release was issued announcing that Liferay will be assuming leadership for the portletfaces.org community. I'm very excited about this development and wanted to take a moment to provide some additional details.

Background

The portletfaces.org community was formed by Liferay Platinum Partner Triton Services, Inc. and Silver Partner Mimacom AG in order to provide support for JSF 2 inside of Liferay Portal. Here at Liferay, we have seen strong demand for JSF portlets from Liferay’s community and customers. Triton and Mimacom recently contributed the projects from portletfaces.org to liferay.com and Liferay has committed to moving the technology forward.

Liferay Faces

Liferay FacesThe portletfaces.org website is being transitioned to its new home at liferay.com:

http://www.liferay.com/community/liferay-projects/liferay-faces

The projects at portletfaces.org have been repackaged under a new umbrella project called Liferay Faces along with some name changes:

Additionally, the java packaging namespace has been refactored: org.portletfaces -> com.liferay

Upcoming Release

The first release of Liferay Faces is version 3.0.0-BETA1 and is scheduled for Friday April 6, 2012. The 3.0.x branch is designed to be used with Liferay 6.0.x based portals. After the release, work will begin on the 3.1.x branch which will target Liferay 6.1.x based portals.

In this first release, the Liferay Faces Alloy and Liferay Facs Portal projects have received some minor bug fixes, but Liferay Faces Bridge has undergone significant development since the last release of PortletFaces Bridge 2.0.2. Specifically, we've focussed on developing the remaining features of JSR 329 and have made great progress towards getting the bridge to pass all of the tests in the JSR 329 Test Compatibility Kit (TCK).

Liferay IDE

Features and support for developing portlets with Liferay Faces will be included in upcoming releases of Liferay IDE and Liferay Developer Studio.

Forums

The forums at portletfaces.org were migrated on April 3, 2012 to their new home at liferay.com:

http://www.liferay.com/community/forums/-/message_boards/category/13289027

If your account at www.portletfaces.org was created prior to January 19, 2012 had the same email address as your account at liferay.com then the posts you made at portletfaces.org should still be authored with your name. Otherwise the author will appear as "PortletFaces Community Member." If you're waiting on an answer on a particular forum post, I recommend that you make a comment on that post in order to make sure you get email alerts. Also, I recommend subscribing to the Liferay Faces forum in general.

JIRA

The issues at jira.portletfaces.org will be consolidated into a single JIRA project called FACES and will soon be migrated to their new home at liferay.com:

http://issues.liferay.com/browse/FACES

If your account at jira.portletfaces.org had the same username as your account at issues.liferay.com then issues you created (or commented on) should continue to be authored with your name. If you didn't have an account at issues.liferay.com then a new account will automatically be created once the migration is complete. If that's the case, then you will probably have to use the "forgot my password" feature in order to setup your password in the new system.

Twitter

I renamed my @portletfaces account at twitter to @liferayfaces. If you were following @portletfaces then you will automatically be following @liferayfaces.

Enterprise Subscription & Support

As soon as Liferay Faces 3.0.0 and 3.1.0 reach their first production release, Liferay EE customers will enjoy support for Liferay Faces according to the Service Level Agreement (SLA) associated with Liferay Enterprise Subscription & Support (ESS).

License Change

The projects at portletfaces.org were released under the Apache 2 license, but the Liferay Faces project will be released under the LGPL 2.1 license which is already used by Liferay on other projects.

Thank You

I wanted to extend my personal thanks to my dear friends at Triton and Mimacom for making this contribution, and to Liferay for taking the lead moving forward. I also want to thank the faithful members of the portletfaces.org community for their support and kind words of encouragement.

 

Utilizing instance storage (ephemeral storage) with RHEL on Amazon EC2

September 2, 2011 By Neil Griffin

Introduction

I recently had the opportunity to launch an Amazon EC2 instance and setup Liferay & MySQL. There were a couple of hurdles that I had to overcome, so I thought I would share the solutions I came up with.

 

Storage: Ephemeral or EBS?

When you launch an RHEL instance on EC2, the disk storage that is provided is a VERY SMALL (7 GB or less) root partition that is contained within the instance itself. This type of storage is called ephemeral. The benefit of ephemeral storage is that it doesn't cost any extra money. The drawback is that it can't participate in the EBS backup solution provided by Amazon -- you'll need to backup files across the network instead. Depending on the size of the instance, you will be given additional ephemeral storage, which is where you can potentially store data or install an app server for Liferay. The Amazon documentation indicates that this will be mounted automatically on /ephemeral0 but I found that this wasn't the case. You will need to use the "fdisk -l" command to find out the device name of the additional ephemeral storage. In my case, I found that the device was named /dev/xvdj. However, there was no filesystem on it, and it wasn't mounted. So you'll need to execute commands like the following:
mkfs -t ext4 /dev/xvdj
mkdir /ephemeral0
echo "/dev/xvdj /ephemeral0 ext4 defaults 1 2" >> /etc/fstab
mount /ephemeral0
 
The alternative storage is called EBS. The benefit is that it can participate in the Amazon backup solution, but the drawback is that it costs extra money. If you want to use EBS instead of ephemeral, you can create EBS Volumes using the Amazon Management Console and then attach them to your instance. Bear in mind that you'll still need to discover the device with "fdisk -l", put a filesystem on it, mount it, etc.
 

Moving MySQL to the additional ephemeral storage

In order to utilize the larger ephemeral storage for database files, I needed to move the MySQL data files from /var/lib/mysql to a filesystem mounted on /ephemeral0. I tried to follow the instructions in section 10.4.1 of the HREL documentation titled "MySQL Changing Database Location" but when I restarted mysqld via "service mysqld start" it reported FAILED, and the following was found in /var/log/mysqld.log:
 
110902 11:35:42 mysqld_safe Starting mysqld daemon with databases from /opt/var/mysql
110902 11:35:42 [Warning] Can't create test file /opt/var/mysql/domU-12-31-39-09-AE-12.lower-test
110902 11:35:42 [Warning] Can't create test file /opt/var/mysql/domU-12-31-39-09-AE-12.lower-test
/usr/libexec/mysqld: Can't change dir to '/opt/var/mysql/' (Errcode: 13)
110902 11:35:42 [ERROR] Aborting
 
The irony here is that section 10.4.1 is meant to show you how to avoid this error.  So I had to find a different approach, and found inspiration in the following articles:
 
The strategy I used was to copy the MySQL files to /ephemeral0, and then mount the ephemeral storage directory back to /var/lib/mysql
 
Step 1: Stop the MySQL server and copy the data files over to /ephemeral0:
[root@server]# service mysqld stop
[root@server]# cd /var/lib
[root@server]# tar cf - mysql/ --selinux | (cd /ephemeral0/var/lib; tar xvfp -)
NOTE: It's really important to keep the --selinux switch so that the SELinux context for each file will be saved in the tarball. Also, it's really important to keep the "p" switch upon extraction, so that file permissions will be preserved.
 
Step 2: Determine the existing selinux settings and re-apply them on a similar var/lib folder structure on /ephemeral0:
[root@server]# ls -lZ / | grep var
drwxr-xr-x. root root system_u:object_r:var_t:s0       var
 
[root@server]# chcon -u system_u -r object_r -t var_t /ephemeral0/var
 
[root@server]# ls -lZ /var | grep lib
drwxr-xr-x. root   root   system_u:object_r:var_lib_t:s0   lib
 
[root@server]# chcon -u system_u -r object_r -t var_t /ephemeral0/var/lib
 
[root@server]# ls -lZ /var/lib | grep mysql
drwxr-xr-x. mysql     mysql    system_u:object_r:mysqld_db_t:s0 mysql
 
Step 3: Re-create the /var/lib/mysql mount point and preserve ownership/group/selinux settings:
[root@server]# cd /var/lib
[root@server]# mv mysql mysql.orig
[root@server]# mkdir mysql
[root@server]# chown mysql mysql
[root@server]# chgrp mysql mysql
[root@server]# chcon -u system_u -r object_r -t mysqld_db_t mysql
 
Step 4: Mount the directory that contains the MySQL data onto the /var/lib/mysql mount point and restart MySQL:
[root@server]# echo "/ephemeral0/var/lib/mysql /var/lib/mysql none bind bind" >> /etc/fstab
[root@server]# mount /var/lib/mysql
[root@server]# service mysqld start
 

Conclusion

The benefit of using this approach is that I didn't have to change any of the settings in the /etc/my.cnf configuration file. Also, I didn't have to fight the selinux security context problem. This approach can also be used for mounting other folders like /opt in order to utilize ephemeral storage.

Fixing SunCertPathBuilderException caused by Maven downloading from self-signed repository

August 11, 2011 By Neil Griffin

If you have a Maven repository running under https with a self-signed certificate, then building a Maven project can report the following error:

Error transferring file: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

There was an Oracle blog posted by Andreas Sterbenz back on Oct 09, 2006 that helped me diagnose the problem, but that blog is no longer available. Thankfully Andreas' blog was re-posted here. For additional information, I found another blog post that was helpful.

Anyways, I fixed this problem by downloading and compiling the source for InstallCert.java and running the following command:

java com.aw.ad.util.InstallCert myhostname.mydomain.com

This generated a file named jssecacerts in the current directory.

On Windows/Linux, this file needs to be copied to the JAVA_HOME/jre/lib/security/ directory.

On Mac needs to be copied to the JAVA_HOME/lib/security/ directory.

After I did this, Maven was able to download the artifacts from the self-signed repository.

 

 

Showing 1 - 5 of 21 results.
Items 5
of 5