title: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct on JBoss and JAAS
body: <p>We have a Guice based web application that we deploy to JBoss EAP 6.4.0. This application uses Netflix Governator library, which provides support for the PostConstruct annotation.</p>
  
  <p>This application starts without any problem on JBoss, until we add some JAAS configuration files provided by our client. With those files, the application does not start and throws this exception:</p>
  
  <pre><code>JBWEB000287: Exception sending context initialized event to listener instance of class c.n.b.s.ServletContextListener: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
  </code></pre>
  
  <p>I fixed the issue by adding this dependency: </p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;javax.annotation&lt;/groupId&gt;
      &lt;artifactId&gt;javax.annotation-api&lt;/artifactId&gt;
      &lt;version&gt;1.3.1&lt;/version&gt;
   &lt;/dependency&gt;
  </code></pre>
  
  <p>But I am wondering if it's the correct solution. I am not familiar with JBoss nor JAAS and I was wondering if it shouldn't be fixed in a better way, in a module configuration for instance. I do not understand why I don't have this error all the time, but only with the JAAS XML files.</p>