Tuesday, January 6, 2015

Error 'java.lang.ClassNotFoundException: javax.faces.context.FacesContextFactory' when debugging ADF Faces application

Described error can be observer when you try to run ADF application on built-in Weblogic. Error message can look:

2015-01-02 16:28:33 CET> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1420212508286' for task '0'. Error is: 'java.lang.ClassNotFoundException: javax.faces.context.FacesContextFactory'
java.lang.ClassNotFoundException: javax.faces.context.FacesContextFactory
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassNotFoundException: javax.faces.context.FacesContextFactory
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    Truncated. see log file for complete stacktrace
>

As you can suppose cause of this issue does not lie in lack of JSF libraries. The main cause is your inattention. Sorry:)

The error occurs when in Model project you put any part of ViewController descriptors, especially web.xml. This can occur when by example you mistakenly change the technology scope of Model project.

To recover this error simply remove all undesired files from Model project.