TOTD #47: Getting Started with Mojarra 2.0 nightly on GlassFish v2


Java Server Faces 2.0 specification (JSR 314, EDR2) and implementation (soon to be EDR2) are brewing. This blog shows how to get started with Mojarra - Sun's implementation of JSF.

GlassFish v2 comes bundled with Mojarra 1.2_04 which allows you to deploy a JSF 1.2 application. This blog explains how you can update GlassFish v2 to use Mojarra 2.0 nightly. And then it deploys a simple JSF 1.2-based application on this updated GlassFish instance, there by showing that your existing JSF 1.2 apps will continue to work with Mojarra 2.0-enabled GlassFish. This is an important step because it ensures no regression, unless it was a compatibility fix :)
  1. Re-create a simple JSF 1.2 application as described in TOTD #42, TOTD #45 and TOTD #46. This application allows to create a list of cities and store them in a backend database. It uses JSF Extensions to show suggestions, using Ajax, based upon the cities already entered and also uses Facelets as the view technology. Alternatively you can use any pre-existing JSF 1.2 application.
  2. Download Mojarra 2.0 latest nightly.
  3. Follow Release Notes to install the binary, the steps are summarized here for convenience (GlassFish installed in GF_HOME):
    1. Backup "GF_HOME/lib/jsf-impl.jar".
    2. Copy the new "jsf-api" and "jsf-impl" JARs from the unzipped Mojarra distribution to "GF_HOME/lib".
    3. Edit "GF_HOME/domains/<domain-name>/config/domain.xml" and add (or update the existing "classpath-prefix") 'classpath-prefix="${com.sun.aas.installRoot}/lib/jsf-api.jar" in the java-config element.
    4. Restart your server.
  4. Deploy the application on Mojarra 2.0-enabled GlassFish, that's it!
The application is accessible at "http://localhost:8080/Cities/faces/welcome.xhtml". Some of the screen captures are shown below.

If only "S" is entered in the city name, then the following output is shown:



Now with "San" ...



And another one with "De" ...



With JSF 2.0, Ajax capabilities and Facelets are now part of the specification and have already been integrated in Mojarra. A follow up blog entry will show how to use that functionality.

The downloaded Mojarra bundle has some samples (in "samples" folder) to get you started, have a look at them as well!

File JSF related bugs here using "2.0.0 EDR1" version and ask your questions on webtier@glassfish.dev.java.net.

Please leave suggestions on other TOTD (Tip Of The Day) that you'd like to see. A complete archive of all tips is available here.

Technorati: totd javaserverfaces glassfish mojarra netbeans
Comments:

[Trackback] TOTD #47 showed how to deploy a JSF 1.2 application (using Facelets and Ajax/JSF Extensions) on Mojarra 2.0-enabled GlassFish. &nbsp;In this blog we'll use new features added in JSF 2.0 to simplify our application: Use integrated Facelets and resource...

Posted by Arun Gupta's Blog on October 14, 2008 at 10:40 PM PDT #

[Trackback] Yaaay, 50th tip!! The previous 49 tips are available here. Mojarra EDR2 is now available - download binary and/or source bundle! GlassFish v2 UR2 ships with Mojarra 1.2.0_04 and v3 prelude comes with 1.2.0_10. The Mojarra binaries in both...

Posted by Arun Gupta's Blog on October 23, 2008 at 01:35 AM PDT #

thanks.

Posted by izolasyon on November 02, 2008 at 03:29 PM PST #

webtier@glassfish.dev.java.net. get me back failure mail please check it.

Posted by Disney Wallpapers on March 08, 2009 at 07:31 AM PDT #

thank u. nice..

Posted by sinema izle on March 18, 2009 at 12:00 AM PDT #

I have made all the speps to make Glassfish v 2.1.1 mojarra 2.0.2 enabled.
But I get error trying to log in to admin panel:

INFO: Application server startup complete.

INFO: Initializing Mojarra 2.0.2 (FCS b10) for context ''

INFO: Unsanitized stacktrace from failed start...
java.lang.IllegalArgumentException: javax.faces.context.ExceptionHandlerFactory
at javax.faces.FactoryFinder.validateFactoryName(FactoryFinder.java:578)
at javax.faces.FactoryFinder.setFactory(FactoryFinder.java:264)
at com.sun.faces.config.processor.FactoryConfigProcessor.setFactory(FactoryConfigProcessor.java:292)
at com.sun.faces.config.processor.FactoryConfigProcessor.processFactories(FactoryConfigProcessor.java:247)
at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:198)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:335)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:223)
at com.sun.enterprise.tools.admingui.servlet.DelayedInitFacesServlet.init(DelayedInitFacesServlet.java:72)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1100)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:848)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:291)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:666)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:597)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:872)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:264)
at com.sun.enterprise.web.connector.grizzly.WorkerThreadImpl.run(WorkerThreadImpl.java:117)

INFO: PWC1412: WebModule[] ServletContext.log():PWC1409: Marking servlet FacesServlet as unavailable

Also a I get error when trying to deploy my application (jsf 1.2 application - worked well with mojarra jsf 1.2_14 on the same glassfish):

INFO: Initializing Mojarra 2.0.2 (FCS b10) for context '/app1'

INFO: Unsanitized stacktrace from failed start...
java.lang.IllegalArgumentException: javax.faces.context.ExceptionHandlerFactory
at javax.faces.FactoryFinder.validateFactoryName(FactoryFinder.java:578)
at javax.faces.FactoryFinder.setFactory(FactoryFinder.java:264)
...

SEVERE: WebModule[/app1]PWC1275: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! javax.faces.context.ExceptionHandlerFactory
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:354)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:223)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:465
....

SEVERE: PWC1306: Startup of context /app1 failed due to previous errors
SEVERE: Unexpected exception when attempting to tear down the Mojarra runtime
java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:725)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:239)
at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:104)
at com.sun.faces.c
...

Posted by Sergey on January 14, 2010 at 04:56 PM PST #

Sergey, can you please post your question to users@glassfish for a broader audience ?

Posted by Arun Gupta on February 19, 2010 at 09:14 AM PST #

@Sergey That error implies that the API being used is 1.2 and not 2.0. I would double check that you've properly configured the server's classpath prefix per the release notes for 2.0.x.

Posted by Ryan Lubke on February 24, 2010 at 04:43 AM PST #

Most people just don't know how to use the tools to make them scale. E.g. developers and system administrators are mistaken for DBAs, and the other way around, sometimes.

Posted by kabin on August 11, 2010 at 02:49 AM PDT #

Themes. If you have any suggestions or changes please post a comment.
Here is the ChangeLog for the Theme listing all the changes that I made compared to the original theme.
http://www.sudeposu.eu

Posted by su_deposu on November 08, 2010 at 07:57 PM PST #

developers and system administrators are mistaken for DBAs, and the

Posted by 2. el eşya on March 07, 2011 at 05:01 PM PST #

Thank u for posting.

Posted by söve on May 10, 2011 at 09:57 PM PDT #

thanks you very much, good luck

Posted by lidyana on August 25, 2012 at 04:42 AM PDT #

Post a Comment:
Comments are closed for this entry.
About

profile image
Arun Gupta is a technology enthusiast, a passionate runner, author, and a community guy who works for Oracle Corp.


Java EE 7 Samples

Stay Connected

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today