title: How to correctly use OmniFaces in an EAR
body: <p>I want to use <a href="http://omnifaces.org" rel="nofollow noreferrer">OmniFaces</a> 1.7 in my Jave EE 7 application. My application is an EAR that contains JARs and a <a href="https://maven.apache.org/plugins/maven-war-plugin/examples/skinny-wars.html" rel="nofollow noreferrer">skinny WAR</a>. Some of my JARs have a dependency to OmniFaces, so the OmniFaces artifact must be in the EAR but not in <code>WEB-INF/lib</code> in the WAR.</p>
  
  <p>Here is how my EAR looks like:</p>
  
  <pre><code>EAR
   +-- lib
   |    +-- [some 3rd party JARs]
   |    `-- omnifaces.jar
   +-- myEJBs.jar
   `-- myWAR.war
  </code></pre>
  
  <p>When I put it this way, OmniFaces converters (like <a href="http://showcase.omnifaces.org/converters/GenericEnumConverter" rel="nofollow noreferrer"><code>GenericEnumConverter</code></a>) are not registered with JSF and won't work. The reason for this is discussed <a href="https://stackoverflow.com/questions/15907290/omnifaces-ear-deployment-issue-on-glassfish-3-1-2-2">here</a> and <a href="https://stackoverflow.com/questions/2987266/why-doesnt-jsf-2-0-ri-mojarra-scan-my-class-annotations">here</a>. Basically according to the <a href="http://jcp.org/en/jsr/detail?id=314" rel="nofollow noreferrer">JSF 2.0 Spec</a> (section <em>11.5.1 Requirements for scanning of classes for annotations</em>), only the WARs <code>WEB-INF/lib</code> directory is scanned.</p>
  
  <p>So my question is: <strong>how should I include OmniFaces in my application</strong>?</p>
  
  <p>Including it twice (in <code>EAR/lib</code> and WARs <code>WEB-INF/lib</code>) 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 <code>IllegalArgumentException: duplicate key: class javax.faces.convert.ByteConverter</code>.</p>