java.lang.ClassNotFoundException: org.omnifaces.exceptionhandler.FullAjaxExceptionHandlerFactory

dmitriygg

When I publish an application on a server GlassFish 4.0, I am getting following exception:

Caused by: java.lang.RuntimeException: 
com.sun.faces.config.ConfigurationException: Factory 'javax.faces.context.ExceptionHandlerFactory' was not configured properly.     
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:273)
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:5362)
at com.sun.enterprise.web.WebModule.contextListenerStart(WebModule.java:743)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5898)
... 44 more Caused by: com.sun.faces.config.ConfigurationException:
Factory 'javax.faces.context.ExceptionHandlerFactory' was not configured properly.  
at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:330)
at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:236)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:435)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:214)
... 47 more Caused by: javax.faces.FacesException:
org.omnifaces.exceptionhandler.FullAjaxExceptionHandlerFactory  
at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java:710)
at javax.faces.FactoryFinder.getImplementationInstance(FactoryFinder.java:572)
at javax.faces.FactoryFinder.access$500(FactoryFinder.java:140)     
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1120)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:379)     
at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:328)
... 50 more Caused by: java.lang.ClassNotFoundException:
org.omnifaces.exceptionhandler.FullAjaxExceptionHandlerFactory  
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1761)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1611)
at java.lang.Class.forName0(Native Method)  
at java.lang.Class.forName(Class.java:270)  
at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java:685)
... 55 more

How do I fix the error?

BalusC

java.lang.ClassNotFoundException: org.omnifaces.exceptionhandler.FullAjaxExceptionHandlerFactory

The ClassNotFoundException means that the mentioned class, or at least the JAR file containing the mentioned class, isn't present in the current runtime classpath.

When deployed as a WAR file, the webapp's runtime classpath covers among others the following paths:

  • WAR's /WEB-INF/classes - for loose .class files (usually, IDE will do it automatically for source files in the src folder of the project).
  • WAR's /WEB-INF/lib - for JAR files (if you're not using a dependency management framework such as Maven, then you need to manually drop JARs there).
  • Server's /lib folder - for server-specific libraries, or for libraries which needs to be shared across all webapps (folder name depends on server used).
  • JRE's (or JDK's) /lib and /lib/ext folders - never ever put anything there, unless you need to fix some bugs in JRE/JDK itself.

Usually, you only go for the first two options. Do it in the WAR only and not elsewhere.

The package name of the mentioned class, org.omnifaces, hints that it's part of OmniFaces. You can download the JAR over there and according to its installation instructions, you need to drop it in /WEB-INF/lib.


As per your comment:

The problem was solved after I added in src/main/webapp/WEB-INF/lib several libraries - omnifaces-1.7.jar and primefaces-4.0.jar. Although these libraries were in classpath. Not sure about this decision optimal.

Sorry, but what you're stating there is just not true. The exception clearly tells that they were not in the classpath. ClassNotFoundException. Simple as that. At least not in the webapp's runtime classpath in any of the aforementioned paths. Most likely you incorrectly assumed the %CLASSPATH% environment variable, or the Build Path property of the project for the webapp's runtime classpath.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

java.lang.ClassNotFoundException: org.apache.commons.lang.UnhandledException

org.apache.commons.lang.SerializationException: java.lang.ClassNotFoundException

java.lang.NullPointerException at org.omnifaces.cdi.eager.EagerBeansWebListener.requestInitialized

Caused by: java.lang.ClassNotFoundException: org.threeten.bp.LocalTime

java.lang.ClassNotFoundException: org.jooq.util.JavaGenerator

java.lang.ClassNotFoundException: org.springframework.core.io.Resource

java.lang.ClassNotFoundException: org.apache.commons.digester.Rule

java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer

java.lang.ClassNotFoundException: org.apache.commons.fileupload.FileItemFactory

java.lang.ClassNotFoundException: org.codehaus.jackson.map.JsonSerializableWithType

java.lang.ClassNotFoundException: org.codehaus.jettison.json.JSONException

java.lang.ClassNotFoundException: org.apache.spark.sql.Dataset

java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlException

java.lang.ClassNotFoundException: org.openx.data.jsonserde.JsonSerDe

java.lang.ClassNotFoundException: org.mariadb.jdbc.Driver

java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication Maven

java.lang.ClassNotFoundException: org.apache.pdfbox.multipdf.PDFMergerUtility

java.lang.ClassNotFoundException: org.apache.catalina.core.ThreadLocalLeakPreventionListener

java.lang.ClassNotFoundException: org.springframework.context.ApplicationContextInitializer

java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlObject Error

java.lang.ClassNotFoundException: org.apache.commons.text.WordUtils

error: java.lang.ClassNotFoundException: org.postgresql.Driver

java.lang.ClassNotFoundException: org.eclipse.jetty.Server

Getting a java.lang.ClassNotFoundException: org.testng.TestNG Error

java.lang.ClassNotFoundException: org.h2.index.BaseIndex

java.lang.ClassNotFoundException: org.apache.commons.logging.Log

java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver

Robolectric: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.robolectric.android.internal.ParallelUniverse