Curious-Bear
Curious-Bear

Reputation: 1

How to natively build a servlet based Quarkus application using a web.xml as the deployment descriptor?

I'm setting up a simple servlet application using Quarkus. Where should I place the web.xml file and how should I deploy the application using the native build feature of Quarkus?

I have tried placing web.xml in project-name/src/main/resources/WEB-INF folder and natively built it using GraalVM docker image, but the built is not working. Dockerfile I used for the build is as of below.

Stage 1 : build with maven builder image with native capabilities

FROM quay.io/quarkus/centos-quarkus-maven:19.1.1 AS build

COPY src /usr/src/app/src

COPY pom.xml /usr/src/app

USER root

RUN chown -R quarkus /usr/src/app

USER quarkus

RUN mvn -f /usr/src/app/pom.xml -Pnative clean package

Stage 2 : create the docker final image

FROM registry.access.redhat.com/ubi8/ubi-minimal

WORKDIR /work/

COPY --from=build /usr/src/app/target/*-runner /work/application

RUN chmod 775 /work

EXPOSE 8080

CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]

I expected the output to be "Welcome", but the actual output is "Not Found".

Upvotes: 0

Views: 753

Answers (1)

You can place web.xml file in the project-name/src/main/resources/META-INF directory to get it working.

Upvotes: 0

Related Questions