Board index JavaServer Faces General PrimeFaces Showcase is not working in GlassFish 2.1

PrimeFaces Showcase is not working in GlassFish 2.1

Components, Ajax Framework, Utilities and More.


Posts: 26
I've downloaded and installed showcase WAR. The server is GlassFish 2.1.
I'm getting 503 and the following exception:

javax.faces.FacesException: Can't parse configuration file: jndi:/server/primefaces/WEB-INF/faces-config.xml: Error at line 20 column 23: cvc-complex-type.2.4.a: Invalid content was found starting with element 'managed-bean-class'. One of '{"http://java.sun.com/xml/ns/javaee":description, "http://java.sun.com/xml/ns/javaee":display-name, "http://java.sun.com/xml/ns/javaee":icon, "http://java.sun.com/xml/ns/javaee":managed-bean-name}' is expected.
   at com.sun.faces.config.ConfigureListener.parse(ConfigureListener.java:1438)
   at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:376)
   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4632)
   at org.apache.catalina.core.StandardContext.start(StandardContext.java:5312)
...
[skipped]


Looks like a simple XML validation problem.


Posts: 26
I've decided to try and fix faces-config.xml in showcase-1.0.0-SNAPSHOT.war. The fix was relatively simple - just changing the order of elements to make XML valid.
Now application starts, but I get the following error on the index page:
com.sun.jsftemplating.layout.LayoutDefinitionException: No LayoutDefinitionManager available for '../templates/ui.xhtml'.  This may mean the file cannot be found, or is unrecognizable.
   at com.sun.jsftemplating.layout.LayoutDefinitionManager.getLayoutDefinitionManager(LayoutDefinitionManager.java:348)
   at com.sun.jsftemplating.layout.LayoutDefinitionManager.getLayoutDefinition(LayoutDefinitionManager.java:150)
   at com.sun.jsftemplating.layout.LayoutViewHandler.buildUIComponentTree(LayoutViewHandler.java:492)
   at com.sun.jsftemplating.layout.LayoutViewHandler.createView(LayoutViewHandler.java:237)
...skipped...


Any ideas?


Posts: 15074
Location: Cybertron

I've fixed the order of managed-bean configurations but not really sure where com.sun.jsftemplating.layout.LayoutDefinitionManager comes from as showcase uses Facelets instead of JSFTemplating project. Also showcase ships with it's own JSF jars with no sun-web.xml. So can't say it is tuned for glassfish.

Why not Tomcat if you'd like to just play with it.
PrimeFaces Lead


Posts: 26
Thanks for your response!

I've been using GlassFish for local development to have a full Java EE 5 compliant server matching target deployment environment - IBM WebSphere AS (WAS) 7.0. My application that was using RichFaces is working fine in GlassFish 2.1. I'm evaluating the switch from RichFaces to PrimeFaces.

I can indeed switch locally to Tomcat - no big deal, but before I jump the ship, I want to understand whether the problems can be fixed.

So, my next troubleshooting step was changing class loading order from Parent First (default in GlassFish) to Parent Last. I've created WEB-INF/sun-web.xml that looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 8.1 Servlet 2.4//EN"
  "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
<sun-web-app>
  <class-loader delegate="false"/>
</sun-web-app>


That did seem to fix the exception I was getting before. You might want to include this file into prime-showcase, it should not hurt deployments on any other servers. The next problem was index page blowing out on <h:head> (see templates/ui.xhtml). It should be <head> in the default XHTML namespace. After I had fixed that, the index page rendered!

My next problem is that, apparently, some of resources are not rendering. For example, if I go to the showcase page for the Wizard component, the top of the page renders like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml">

  <head>
    <title>PrimeFaces - ShowCase</title>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
    <link type="text/css" rel="stylesheet" href="/PrimeShowcase/css/default.css" />
    <link type="text/css" rel="stylesheet" href="/PrimeShowcase/syntaxhighlighter/styles/syntaxhighlighter.css" />
    <style type="text/css">
       .yui-skin-sam .yuimenu .bd {
        background-color: #000000;
      }
 


At the same time, online Showcase renders a whole bunch of resources between syntaxhighlighter.css and embedded CSS. As a result, I don't see wizard box with heading and next/previous arrows in my environment.

Any thoughts on what might be causing it? I don't see any exceptions in the server log. A whole bunch of JavaScript errors occur which is understandable given that resources are missing.


Posts: 15074
Location: Cybertron

I don't think showcase is the best app for this.

I'd suggest creating your own proof of concept application when evaluating PrimeFaces instead of using showcase.
PrimeFaces Lead


Posts: 26
Well, I do have my own POC app to work on - that's my ultimate target. I ran into the problems with it as well - wizard component in particular at the moment. My thought was to start with something working like a showcase. I'll guess I'll move discussion to separate thread(s) about issues with POC app.


Return to General