Sunday, May 17, 2009

Liferay deployment problem: "Deployment will start in a few seconds" ....

One more thing I learned today:

After migrating to the 5.2.2 and from JBoss to tomcat (see my migration entry ) I noticed, that I could not deploy portlets anymore.
(Why did I not fix that earlier? In the beginning I used the workaround to copy the full unzipped folders to the server and restarted the server :) )

So as we started a big "Theme" project today (Note: Watch out for upcoming blog entries about themes! :) ) that problem got annoying.

The result I always got was:

... was copied successfully. Deployment will start in a few seconds.
What I finally found out:

The new control panel is great. Really! Also good to install plugins. (Control Panel->Server->Plugin Installation)
What I did forget though: I still had the good old "Plugin Installer" portlet up and running - from the good old JBoss days.

And there it was. The setting:
Plugin Installer -> Configurations -> Destination Directory

still contained old JBoss setting. (Of course - they were still in the DB).
Removing that column solved my problem - deploying works perfectly now.


Hibernate problem: "MESSAGE: Broken pipe"

Hi all,

short update - after a long while of running smoothly, the portlet with the hibernate DB connection had a small problem (again).

This time the error was:
04:12:22,792 ERROR [JDBCExceptionReporter:101] Communications link failure due to underlying exception:

MESSAGE: Broken pipe

STACKTRACE: Broken pipe
at Method)
at com.mysql.jdbc.MysqlIO.send(
at com.mysql.jdbc.MysqlIO.sendCommand(
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(
at com.mysql.jdbc.Connection.execSQL(
at com.mysql.jdbc.PreparedStatement.executeInternal(
at com.mysql.jdbc.PreparedStatement.executeQuery(
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(
at org.hibernate.jdbc.AbstractBatcher.getResultSet(
at org.hibernate.loader.Loader.getResultSet(
at org.hibernate.loader.Loader.doQuery(
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(
at org.hibernate.loader.Loader.doList(
at org.hibernate.loader.Loader.listIgnoreQueryCache(
at org.hibernate.loader.Loader.list(
at org.hibernate.hql.classic.QueryTranslatorImpl.list(
at org.hibernate.engine.query.HQLQueryPlan.performList(
at org.hibernate.impl.SessionImpl.list(
at org.hibernate.impl.QueryImpl.list(
at com.liferay.portal.dao.orm.hibernate.QueryImpl.list(
at com.liferay.portal.dao.orm.hibernate.QueryImpl.list(
A short webresearch pointed out a problem with transaction handling and hinted at two possible solutions:
  1. Wrong coding regarding "commit" of transactions
  2. Usage of a parameter to "autocommit"

Trying not to focus on hibernate problems but rather on other topics I'm trying solution 2 at the moment.
I will let you know how it worked out. :)

Sunday, May 10, 2009

JSF: Refresh Bean AND get different Language bundle per host (Properties)

Hi again,

two small gadgets for you:

1. Get and default bean attributes for different websites or different languages

Sometimes you have the same portlet-code for different websites. I use multiple properties files and select the same within the bean with the following code:

private void initBeanData() {
FacesContext fCtx = FacesContext.getCurrentInstance();

ResourceBundle bundle =
ResourceBundle.getBundle( this.getBundleByHost() , fCtx.getViewRoot().getLocale());
_name = bundle.getString("name_default");
_entryText = bundle.getString("text_default");

FacesContext fCtx = FacesContext.getCurrentInstance();
String host = ((PortletRequest)fCtx.getExternalContext().getRequest()).getServerName();
if (host.contains("localhost"))
return "LocalBundle";

2. Refresh (backing) Bean

After submitting some input I asked myself how to refresh the backing bean? After some research I found a LOT of people having the same problem.
That seems pretty funny in the meanwhile to me as I realized now how easy that is. Maybe there are some people like me that didn't get it the first time. ;)

Here is the code:

public void reset(ActionEvent actionEvent) {


(For the init method: see above :) )

Then of course you have to call the method as always from the view (here: JSP):

Saturday, May 9, 2009

Portal default languange (spanish)

Short note:

There still seems to be a bug at setting the default language for a specific instance/company.

The known trick (thanks to luca) is to change the entry


in the database table


for the user with the flag

defaultUser = 1

In addition I just learned that for spanish the code "es_ES" does not work - however the code "es" does work.

Maybe it helps somebody.

Friday, May 1, 2009

Error at uploading logo: Caused by: Unable to retreive rendered image from input stream with type na

Small update:

Today I tried to use the standard "logo" functionality of liferay (Control Panel-> Communitiey-> manage pages -> settings -> logo)

Strangely I got the following confusing errors after uploading a logo (JPG - created with Adopbe Photoshop):

com.liferay.portal.SystemException: Unable to retreive rendered image from input stream with type na
Caused by: Unable to retreive rendered image from input stream with type na

If I remember correctly I used JPG before (created by GIMP) and it worked. Anyway - I changed the format to GIF and then it worked.

If anybody has a better advice / explanation please let me know. :)