Hi,

This weekend I read almost all of the documentation on Shale and wanted to get started with a new project that uses view controller and clay. When I started trying to create a project created in NetBeans 5.5, I ran into some trouble. First I created a new web project (not visual web), added the Java Server Faces 1.2 framework (Sun RI) to the project, then added Shale jars to the library dependencies screen. Next I edited faces-config.xml. Based on shale-framework-1.0.4\shale-view\src\main\resources\META-INF\faces-config.xml, I get the impression that I need ALL of it to make the view controller work. Is that true? There doesn't seem to be much documentation on faces-config.xml for shale except for some sample files. When I copy this data into my faces-config.xml and deploy the project, I get a long stack dump:


Initializing Sun's JavaServer Faces implementation (1.2_02-b03-FCS) for context '/ShaleTest' Cant instantiate class: phase-listener: org.apache.shale.view.faces.ViewPhaseListener. java.lang.ClassNotFoundException: org.apache.shale.view.faces.ViewPhaseListener at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1511) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1292)
...

I noticed that NetBeans put all of the jar files into WEB-INF/classes/. I removed the jars from the project Libraries, and manually copied them into WEB-INF/lib/. When I redeploy the project, that error is gone and I get a different one:

WEB0100: Loading web module [ShaleTest] in virtual server [server] at [/ShaleTest]
Initializing org.apache.shale.view.faces.LifecycleListener
Initializing org.apache.shale.view.faces.LifecycleListener
Initializing Sun's JavaServer Faces implementation (1.2_02-b03-FCS) for context '/ShaleTest'
Instantiating DialogPhaseListener()
Instantiating DialogNavigationHandler (wrapping instance '[EMAIL PROTECTED]') Installed the Tiger VariableResolverImpl wrapping original instance [EMAIL PROTECTED]
Loading Clay View Handler
Completed initializing Sun's JavaServer Faces implementation (1.2_02-b03-FCS) for context '/ShaleTest'
Initializing Dialog SCXML Implementation
No dialog configuration information present. No default configuration found at: /WEB-INF/dialog-config.xml. No embedded configuration found at: META-INF/dialog-config.xml
Initializing Validator Integration
Begin loading config files.
Loading file "file:/D:/dev/ShaleTest/build/web/WEB-INF/lib/shale-clay-1.0.4.jar!/META-INF/clay-config.xml".
Loading digester rules.
Begin resolving inheritance @:-<
Finding parents ?:-[
Checking for circular inheritance %:-{
Realizing heritage $:-<
Inheritance resolved @:-)
Done loading config file(s).
Starting up Shale Tiger extensions
Parse Error at line 8 column 118: Document root element "faces-config", must match DOCTYPE root "null". org.xml.sax.SAXParseException: Document root element "faces-config", must match DOCTYPE root "null". at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)

I noticed that the faces-config.xml that NetBeans 5.5 generated (for JSF 1.2) starts like this:

<?xml version='1.0' encoding='UTF-8'?>

<!-- =========== FULL CONFIGURATION FILE ================================== -->
<faces-config version="1.2"
   xmlns="http://java.sun.com/xml/ns/javaee";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd";>

and the faces-config.xml that came in the shale-framework-1.0.4\shale-view\src\main\resources\META-INF\ directory starts like this:

<?xml version="1.0"?>
<!DOCTYPE faces-config PUBLIC
 "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
 "http://java.sun.com/dtd/web-facesconfig_1_1.dtd";>
<!-- ====================== SHALE CONFIGURATION FILE ======================= -->
<faces-config>

So I copied the DOCTYPE part into my faces-config.xml even though it looks wrong (for 1.1 not 1.2?). I put it just before the <faces-config ...> line.

now the exception is:

WEB0100: Loading web module [ShaleTest] in virtual server [server] at [/ShaleTest]
Initializing org.apache.shale.view.faces.LifecycleListener
Initializing org.apache.shale.view.faces.LifecycleListener
Initializing Sun's JavaServer Faces implementation (1.2_02-b03-FCS) for context '/ShaleTest' Completed initializing Sun's JavaServer Faces implementation (1.2_02-b03-FCS) for context '/ShaleTest' WebModule[/ShaleTest]Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener javax.faces.FacesException: Can't parse configuration file: jndi:/server/ShaleTest/WEB-INF/faces-config.xml: Error at line 12 column 118: Attribute "version" must be declared for element type "faces-config". at com.sun.faces.config.ConfigureListener.parse(ConfigureListener.java:1587) at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:491)

Version is already declared. Changing it from 1.2 to 1.1 does not make a difference.


From the documentation I get the impression that I don't need to use the application controller unless I want to. When I look at the sample faces-config.xml for shale-view I see application controller stuff in there. Does the view controller depend on the application controller? I just want a minimal config where I get my AbstractViewController events such as init and prerender.

I also noticed that there isn't much real documentation on Clay other than the good overview and a sample usecase project (which also has no documentation). Maybe that is all the documentation I should need but I have questions about the xml configs , can I use the same jsfid on different pages to refer to different components, etc... We won't get into those questions just yet.


And lastly there is a https://nbshalesupport.dev.java.net/ project with no information whatsoever. I'm curious what kind of support it will add to NetBeans. Will make Shale a "Framework" you add to a web project? Will it somehow integrate with Visual Web Pack?

I'm excited about JSF + Shale View Controller + Clay. The testing module looks very good too. I don't quite understand the need for the application controller module yet, and will have to read the overview again.

I have a program that I'd like to switch from Visual Web Pack to Shale so that I have more control over the HTML/CSS and can have mobile web users access the app without having to download heavy theme files.


Thanks,
Ryan de Laplante

Reply via email to