I'm needing CDI functionality on a rest application in which I'm using RESTEASY. So I followed the manual's instruction to setup resteasy-cdi module on my app, that runs on JBoss AS7.
But when I start the server I get the following error:
13:48:08,631 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-4) Context [/MainService] startup failed due to previous errors: java.lang.IllegalArgumentException: Duplicate context initialization parameter resteasy.injector.factory
My web.xml is the following:
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<listener>
<listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
</servlet>
<context-param>
<param-name>resteasy.injector.factory</param-name>
<param-value>org.jboss.resteasy.cdi.CdiInjectorFactory</param-value>
</context-param>
<context-param>
<param-name>resteasy.scan</param-name>
<param-value>true</param-value>
</context-param>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
I've tried several combinations of parameters, and tried to configure it like in this thread also, but without success.
Specifying the javax.ws.rs.core.Application on the web.xml and desabling the resteasy.scan also didn't solve the problem.
My pom.xml has the following content:
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-cdi</artifactId>
<version>2.2.1.GA</version>
</dependency>
I've also tried testing with and without the artifact resteasy-jarxs together and with the declaration of the dependency like this article.
I'm really lost. Do you have any ideas? I need CDI or EJB for now to use JPA's EntityManager via injection. I know that I can use without it, but I'd prefer to so I can explore JTA's integration and CDI's functionality on the future.
Thanks.