Showing posts with label jsf. Show all posts
Showing posts with label jsf. Show all posts

Sunday, January 18, 2009

Meanwhile: different JSF Versions on JBoss.. (Exception regarding org.jboss.web.jsf.integration.config.JBossJSFConfigureListener)

Hi,

before finishing my post on the user generated contend I want to put something very technical in between.

While deploying my final solution for the anonymous comments (EasyComment-Portlet) I stumpled for the tenth time about an issue regarding the various JSF Versions - and how compatible they are with the different Containers.

So once and for all I want to persist this topic here. :)

As you might be aware JBoss (at least version 4.2) brings its own JSF libraries - and dislikes the deployment of other JSF implementation libraries within an .war file. However as not all versions seem to harminize with liferay properly (I plan to publish a matrix on this one soon if there is interest) its sometimes easier to just bundle the JSF implementation of choice.

In my case I use the myfaces JSP (JSF 1.1) - based on the example portlet "Sample JSF 1.1 (MyFaces JSP)"

So as some times before I got the following error at deployment:
2009-01-17 12:58:29,454 WARN [org.jboss.web.jsf.integration.config.JBossJSFConfigureListener] MyFaces JSF implementation found! This version of JBoss AS ships with the java.net implementation of JSF. There are known issues when mixing JSF implementations. This warning does not apply to MyFaces component libraries such as Tomahawk. However, myfaces-impl.jar and myfaces-api.jar should not be used without disabling the built-in JSF implementation. See the JBoss wiki for more details.
2009-01-17 12:58:29,908 FATAL [javax.enterprise.resource.webcontainer.jsf.config] null MessageFactory
2009-01-17 12:58:29,908 ERROR [STDERR] java.lang.ClassCastException: org.apache.myfaces.renderkit.html.util.ExtensionsPhaseListener
2009-01-17 12:58:29,909 ERROR [STDERR] at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:825)


2009-01-17 12:58:29,927 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/EasyComments-portlet]] Exception sending context initialized event to listener instance of class org.jboss.web.jsf.integration.config.JBossJSFConfigureListener
javax.faces.FacesException: java.lang.ClassCastException: org.apache.myfaces.renderkit.html.util.ExtensionsPhaseListener
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:387)
at org.jboss.web.jsf.integration.config.JBossJSFConfigureListener.contextInitialized(JBossJSFConfigureListener.java:69)

(It was especially annoying because in my local version the portlet worket (on tomcat) - whereas on my productive server (JBoss) it didn't...)

After some time I remebered what this error was about: I had to tell JBoss to take my war included libraries.

So I set the according parameter in the Web.xml of my portlet as shown below:


Here the parameter again:


<context-param>

<param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>

<param-value>true</param-value>

</context-param>

I hope this helps all the people that find this.

Friday, December 26, 2008

User generated content with liferay -for anonymous users (part 1)




If you are creating a "Web 2.0" site you might want to allow the users to generate content by themselves. Unfortunately there is no real "out of the box" support for this by liferay -except the discussion forum, which is way to limited in it's functionalitites or better: flexibility.

So to achieve this functionality lets first define the requirements a bit further:

  1. User shall be able to create content (entries)
  2. It shall be possible to comment and rate these entries
  3. It shall be possible to display the content in various ways (aggregated, isolated, pre-view,..)
  4. The entries should be stored search engine friendly
  5. Optimized for external users and internet (simple + user friendly, captcha support, evtl key word/html code blocking,...)

From my perspective there are three ways to achieve this:

  1. Complete custom coding
  2. Use API: Page, Journal articles, page comments, ...
  3. Use API: Blog

As I chose to use liferay to use a lot out of the box functionalties and not to do everything on my own (especially to be able to benefit from ongoing updates and improvements) I chose to go for option 2 or 3.

As 3 seemed to be easier and more comprehensive I chose to go for that option first...

Regarding the requirements:
There are still a lot of open questions which I will address in the following posts - but one thing already: Requirement 5 (simplicity, captcha, etc.) is of course not very much build in for guest.

So I will do that for my own based on JSF-portlets. Details on this will also come in the next posts. To give you an impression how my "API-wrapper" looks like - see the screenshot above