Tomcat con Jakarta EE

Guia:

Dependencias

<!-- Get the API JARs for Java EE 8 -->
<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-web-api</artifactId>
    <version>8.0</version>
</dependency>

<!-- Weld  -->
<dependency>
    <groupId>org.jboss.weld.servlet</groupId>
    <artifactId>weld-servlet-core</artifactId>
    <version>3.0.5.Final</version>
</dependency>

<!-- RESTEasy -->
<dependency>
    <groupId>org.jboss.resteasy</groupId>
    <artifactId>resteasy-cdi</artifactId>
    <version>3.6.1.Final</version>
</dependency>
<dependency>
    <groupId>org.jboss.resteasy</groupId>
    <artifactId>resteasy-servlet-initializer</artifactId>
    <version>3.6.1.Final</version>
</dependency>

<!-- Bean Validation -->
<dependency>
    <groupId>org.jboss.resteasy</groupId>
    <artifactId>resteasy-validator-provider-11</artifactId>
    <version>3.6.1.Final</version>
</dependency>

<!-- MVC + Eclipse Krazo for RESTEasy-->
<dependency>
    <groupId>javax.mvc</groupId>
    <artifactId>javax.mvc-api</artifactId>
    <version>1.0.0</version>
</dependency>
<dependency>
    <groupId>org.eclipse.krazo</groupId>
    <artifactId>krazo-resteasy</artifactId>
    <version>1.1.0-M1</version>
</dependency>

Configuration files

Make sure to add an empty beans.xml file in your /src/main/webapp/WEB-INF folder:

Note that the metadata-complete isn’t strictly necessary. It works around an an issue in RESTEasyarrow-up-right that would otherwise cause RESTEasy (and thus Krazo) to start twice.

Please also add a file called context.xml to src/main/resources/META-INF:

This file context.xml is essential for the operation of the CDI in Tomcat as described in the Weld documentationarrow-up-right.

The file to create is called web.xml and should be placed in the src/main/webapp/WEB-INF directory:

Last updated

Was this helpful?