Sun GlassFish Enterprise Server 

Samples Main Page

The JSF 2.0 Complete Sample Application

This is a series of simple programs intended to illustrate some of the new Ajax features that are contained in JSF 2.0. Many of these programs have blog postings associated with them, with further explanations contained there.

Building, Deploying, and Running the Application

Perform the following steps to build, deploy, and run the application:

  1. Set up your build environment and configure the application server with which the build system has to work by following the common build instructions.
  2. app_dir is the sample application base directory:samples_install_dir/javaee6/web/jsf/scrumtoys/.
  3. Change directory to app_dir.
  4. Build, deploy, and run the sample application using the all target.
  5. app_dir> ant all

    You can replace the ant all command with the following set of commands:

    app_dir> ant default compiles and packages the application

    app_dir> ant deploy deploys it to application server

    app_dir> ant run runs the test java client

  6. Use the target clean to undeploy the sample application and to remove the temporary directories such as build and dist.

    app_dir> ant clean

Troubleshooting

In case of receiving "Error on try to save Project" check if database is up.
The domains/domain1/log/server.log file may contain the following errors:

[#|2009-05-14T23:23:17.140-0700|SEVERE|glassfish|org.eclipse.persistence.session
.file:/C:/sdk/glassfish/samples/javaee6/web/jsf/scrumtoys/build/web/WEB-INF/clas
ses/-scrumtoysPU.ejb|_ThreadID=18;_ThreadName=Thread-1;|
Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.0.v20090424-r40
50): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cau
se: Connection could not be allocated because: java.net.ConnectException : Error
 connecting to server localhost on port 1527 with message Connection refused: co
nnect.

or

[#|2009-05-14T16:37:52.578-0700|WARNING|glassfish|org.eclipse.persistence.sessio
n.file:/C:/sdk/glassfish/domains/domain1/applications/scrumtoys/WEB-INF/classes/
-scrumtoysPU|_ThreadID=15;_ThreadName=Thread-1;|
Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.0.v20090424-r40
50): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: Table/View 'PROJECTS' does
 not exist.
Once the scrumtoys application is deployed while database is down, bringing database up will not fix the problem. Restarting glassfish does not help either. The only way to get the scrumtoys application working properly is to have the database up before *deploying* the application. Thus to remedy the problem with not being able to save a project one needs to do the following:

  1. asadmin start-database
  2. ant clean
  3. ant run

If you still have problems when running the application, refer the troubleshooting document.


Copyright © 2009 Sun Microsystems, Inc. All rights reserved.