views:

32

answers:

1

I am running a webapp on a glassfish v3 server. I've just added richfaces to my application, but I get an error when i try running my project:

INFO: Initializing Mojarra 2.0.2 (FCS b10) for context '/WMC'
INFO: Unsanitized stacktrace from failed start...
java.lang.RuntimeException: WEB9033: Unable to load class with name [org.ajax4jsf.taglib.html.facelets.ActionParamHandler], reason: java.lang.NoClassDefFoundError: com/sun/facelets/tag/jsf/ComponentHandler
        at org.glassfish.web.loader.WebappClassLoader.findClass(WebappClassLoader.java:944)
        at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1420)
        at com.sun.faces.util.Util.loadClass(Util.java:203)
        at com.sun.faces.config.processor.AbstractConfigProcessor.loadClass(AbstractConfigProcessor.java:313)
        at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processComponent(FaceletTaglibConfigProcessor.java:568)
        at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processTags(FaceletTaglibConfigProcessor.java:361)
        at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processTagLibrary(FaceletTaglibConfigProcessor.java:314)
        at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.process(FaceletTaglibConfigProcessor.java:263)
        at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:337)
        at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:223)
        at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:4591)
        at com.sun.enterprise.web.WebModule.contextListenerStart(WebModule.java:535)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:5193)
        at com.sun.enterprise.web.WebModule.start(WebModule.java:499)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:928)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:912)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:694)
        at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1933)
        at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1605)
        at com.sun.enterprise.web.WebApplication.start(WebApplication.java:90)
        at org.glassfish.internal.data.EngineRef.start(EngineRef.java:126)
        at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:241)
        at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:236)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:339)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183)
        at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1224)
        at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365)
        at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204)
        at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
        at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NoClassDefFoundError: com/sun/facelets/tag/jsf/ComponentHandler
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
        at org.glassfish.web.loader.WebappClassLoader.findClass(WebappClassLoader.java:914)
        ... 50 more
Caused by: java.lang.ClassNotFoundException: com.sun.facelets.tag.jsf.ComponentHandler
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at org.glassfish.web.loader.WebappClassLoader.findClass(WebappClassLoader.java:949)
        at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1420)
        ... 55 more

My web.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 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-app_3_0.xsd"&gt;
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <context-param>
        <param-name>org.richfaces.SKIN</param-name>
        <param-value>blueSky</param-value>
    </context-param>
    <context-param>
        <param-name>org.richfaces.CONTROL_SKINNING</param-name>
        <param-value>enable</param-value>
    </context-param>
    <filter>
        <display-name>RichFaces Filter</display-name>
        <filter-name>richfaces</filter-name>
        <filter-class>org.ajax4jsf.Filter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>richfaces</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
    </filter-mapping>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet><servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping><session-config>
        <session-timeout>
            10
        </session-timeout>
    </session-config><welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    <resource-ref>
        <res-ref-name>mail/WMCMail_LogicalName</res-ref-name>
        <res-type>javax.mail.Session</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>
</web-app>

And I've added the following libs to my project

alt text

I've tried to include jsf-facelets.jar but this results in some version conflicts. Do you know what to do?

+2  A: 

Glassfish ships with builtin JSF 2.0 libraries. RichFaces 3.3.0 is not compatible with JSF 2.0.

You have 2 options:

  1. Downgrade JSF 2.0 to JSF 1.2. You need to supply your own (or RichFaces-provided) JSF 1.2 libraries in /WEB-INF/lib and instruct Glassfish to use the supplied JSF instead by setting useBundledJsf property in /WEB-INF/sun-web.xml to true:

    <sun-web-app>
        <class-loader delegate="false"/>
        <property name="useBundledJsf" value="true"/>
    </sun-web-app>
    
  2. Upgrade RichFaces 3.x to at least 3.3.3. It has partial JSF 2.0 support. How to get it to work is described in this document.

For full JSF 2.0 support by RichFaces, you've wait for RichFaces 4.0 to be final. As far now, PrimeFaces and OpenFaces are one of the few with full JSF 2.0 support.

BalusC
I think I will try OpenFaces then. It seems to be the easiest:). Don't really understand if my project is maven based ?
AnAmuser
OpenFaces has a nice website with awesome looking components, but IMO it has not so wide community support yet. For PrimeFaces the community support is better. I have handson experience with it and also at their [own forum](http://primefaces.prime.com.tr/forum/viewforum.php?f=3) the PF lead developer, Cagatay, will respond very well on problems. You might want to take this into consideration. A good community support is invaluable whenever you're encountering problems. BTW: PrimeFaces has awesome components as well. Did you find their [showcase](http://www.primefaces.org:8080/prime-showcase)?
BalusC
PrimeFaces is available by Maven as well: http://www.primefaces.org/downloads.html
BalusC
I found their showcase. They also have very nice components. I'll take PrimeFaces then. It doesn't matter to me as long as it works.
AnAmuser
And it does. Now I can select multiple rows in a datatable. Cool:)
AnAmuser
You're welcome.
BalusC