I am new to Java EE development. I downloaded Payara micro-server 6.2023.8 and generated a simple Java EE application through the maven archetype com.airhacks:javaee8-essentials-archetype:0.0.4
(https://github.com/AdamBien/javaee8-essentials-archetype).
However, when I deploy the war
file (generated through mvn clean package
) on the server through the command:
java -jar 'G:\Workspace\payara-micro-6.2023.8.jar' --deploy .\target\javaee-demo.war --port 8080
, the REST endpoint (http://localhost:8080/javaee-demo/resources/ping
) is not exposed and generates a 404
error when accessed via a browser. The only URL present in the logged output against 'Payara Micro URLs
' is http://localhost:8080/javaee-demo
.
Here's my resource (generated automatically from the archetype used):
@Path("ping")
public class PingResource {
@Inject
@ConfigProperty(name = "message")
String message;
@GET
public String ping() {
return this.message + " Jakarta EE with MicroProfile 2+!";
}
}
Here's my JAX-RS configuration file:
@ApplicationPath("resources")
public class JAXRSConfiguration extends Application {
}
And, here's the (partial) output of running the above command:
"Deployed": [
{
"Name": "javaee-demo",
"Type": "war",
"Context Root": "/javaee-demo"
}
]
pom.xml
file for reference:
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>in.mydemoprojects</groupId>
<artifactId>javaee-demo</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile</groupId>
<artifactId>microprofile</artifactId>
<version>2.0.1</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>javaee-demo</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<failOnMissingWebXml>false</failOnMissingWebXml>
</properties>
</project>
I looked into the other stackoverflow questions about this, but to no avail. Can someone please help me debug?