0 Replies Latest reply on Oct 27, 2012 7:40 AM by Jose K

    Defining JSF exception handler in common EAR/lib fails while keeping in WAR/Web-Inf/lib works

    Jose K Newbie

      I’ve got a web app with `faces-config.xml` defined with a custom

       

          <exception-handler-factory> 

                      com.mydomain.exception.CustomExceptionHandlerFactory 

          </exception-handler-factory>

       

      This deploys and **works fine when this class is part of the WEB-INF/classes of the war**.

       

      Now when I move this class to a common.jar which is deployed in the Jboss EAR/lib – the EAR fails to deploy with the errors below – because the WAR cannot see the class

       

      `java.lang.ClassNotFoundException: javax.faces.context.ExceptionHandlerWrapper` which is found in the JBoss modules "jboss\runtimes\jboss-eap\modules\javax\faces\api\main\jboss-jsf-api_2.1_spec-2.0.2.Final-redhat-1.jar"

       

      By default the WAR should see classes in the EAR/lib.

       

      I’ve tried setting a classpath in the WAR Manifest but it didn’t work.

       

          16:10:09,935 WARN  [org.jboss.modules] (MSC service thread 1-7) Failed to define class com.mydomain.exception.CustomExceptionHandler in Mod ule "deployment.app.ear:main" from Service Module Loader: java.lang.LinkageError: Failed to link com/mydomain/exception/CustomExceptionHandler (Module "deployment.app.ear:main" from Service Module Loader)

              at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396)

              at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)

              at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)

              at org.jboss.modules.Module.loadModuleClass(Module.java:527)

          ...    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_37]

          Caused by: java.lang.NoClassDefFoundError: javax/faces/context/ExceptionHandlerWrapper

              at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.6.0_37]

              at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [rt.jar:1.6.0_37]

              at java.lang.ClassLoader.defineClass(ClassLoader.java:615) [rt.jar:1.6.0_37]

              at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) [rt.jar:1.6.0_37]

              at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)

              at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391)

              ... 21 more

          Caused by: java.lang.ClassNotFoundException: javax.faces.context.ExceptionHandlerWrapper from [Module "deployment.app.ear:main" from Service Module Loader]

              at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

              at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

              ... 27 more

       

       

      does anyone have experience in keeping this class in the EAR/lib and working? Something else I need to define?