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.
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:
JBWEB000287: Exception sending context initialized event to listener instance of class c.n.b.s.ServletContextListener: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
I fixed the issue by adding this dependency:
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.1</version>
</dependency>
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.