I get an error when I make a request to service using a Wildfly.21 server in a simple JAX-RS project without web.xml

I get an error when I make a request to the service using a Wildfly.21 server in a simple JAX-RS project without web.xml. But I can access index.html under the WebContent directory. Thank you.

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>Jpa-Hibernate-002</groupId>
    <artifactId>Jpa-Hibernate-002</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>Jpa-Hibernate-002</name>
    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-client</artifactId>
            <version>3.0.0-M6</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.1-api</artifactId>
            <version>1.0.2.Final</version>
        </dependency>
        <dependency>
            <groupId>com.oracle.database.jdbc</groupId>
            <artifactId>ojdbc8</artifactId>
            <version>19.8.0.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.3</version>
                <configuration>
                    <warSourceDirectory>WebContent</warSourceDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <warName>Tutorial002</warName>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

ServiceConfig.java


import jakarta.ws.rs.ApplicationPath;
import jakarta.ws.rs.core.Application;

@ApplicationPath("service")
public class ServiceConfig extends Application {
}

DebtWS.java

import entities.user.Account;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;

@Path("debt")
public class DebtWS {
    @GET
    @Path("/getDebt")
    @Produces("text/plain")
    public Double getDebt() {
        return null;
    }
}

Project hierarcial : enter image description here

I can access index.html: enter image description here

I can't access the getDebt service: enter image description here



Read more here: https://stackoverflow.com/questions/64954741/i-get-an-error-when-i-make-a-request-to-service-using-a-wildfly-21-server-in-a-s

Content Attribution

This content was originally published by Resul Zoroğlu at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: