views:

115

answers:

2

i have 3 war files with JSF installed, 3 faces config, when i make them all load into one class loader that is part of the EAR, it fails on initialization errors. like below. seems like JSF does not like to load multiple times in one classloader, has anyone tried this? to load a EAR with 3 JSF wars?

java.lang.NullPointerException
    at com.sun.faces.config.processor.ManagedBeanConfigProcessor.process(ManagedBeanConfigProcessor.java:241)
    at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:108) 
+1  A: 

This particular exception can be caused by either a missing jsf-api.jar file in the classpath, or a different versioned jsf-api.jar in the classpath as opposed to the WAR's jsf-impl.jar, possibly the appserver-provided one. In theory there are 3 ways to fix this problem:

  1. Get rid of all JSF JAR's (jsf-api.jar and jsf-impl.jar) in the WAR's and rely on the JSF libraries provided by the appserver.
  2. Get rid of all JSF JAR's in the WAR's and provide them in EAR only.
  3. Align all JSF JAR's in the WAR's out to be of exactly the same make/version/build.

Another cause can be that the WAR's include appserver-specific libraries which in turn contain the JSF classes, such as Glassfish's javaee.jar. All of those appserver-specific libraries needs to be removed from all WAR's and EAR's as well.

To the point: keep the classpath clean.

BalusC
A: 

thank you, i will try this and yes each war has jsf-api.jar in the web-inf/lib, i need to remove them and check, i believe there is a copy in the EAR's app-inf/lib too.

Venu
BalusC