I want to use OmniFaces 1.7 in my Jave EE 7 application. My application is an EAR that contains JARs and a skinny WAR. Some of my JARs have a dependency to OmniFaces, so the OmniFaces artifact must be in the EAR but not in WEB-INF/lib
in the WAR.
Here is how my EAR looks like:
EAR
+-- lib
| +-- [some 3rd party JARs]
| `-- omnifaces.jar
+-- myEJBs.jar
`-- myWAR.war
When I put it this way, OmniFaces converters (like GenericEnumConverter
) are not registered with JSF and won't work. The reason for this is discussed here and here. Basically according to the JSF 2.0 Spec (section 11.5.1 Requirements for scanning of classes for annotations), only the WARs WEB-INF/lib
directory is scanned.
So my question is: how should I include OmniFaces in my application?
Including it twice (in EAR/lib
and WARs WEB-INF/lib
) could possibly work but feels clumsy. I tried it some time ago with RichFaces 4.3.5 (same problem) which didn't work but led to IllegalArgumentException: duplicate key: class javax.faces.convert.ByteConverter
.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…