I created a JavaEE project directly in Intellij and added the dependencies of JavaEE 8 via maven. The structure of the project is in this link .
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
</web-app>
beans.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
bean-discovery-mode="all">
</beans>
JerseyConfig:
@ApplicationPath("resources")
public class JerseyConfig extends Application {
// @Override
// public Set<Class<?>> getClasses()
// {
// Set<Class<?>> yourResources = new HashSet<Class<?>>();
// yourResources.add(MySimpleRest.class);
// return yourResources;
// }
}
MySimpleRest:
@Path("/info")
public class MySimpleRest {
@GET
public String get(){
return "Hello Word";
}
}
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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>JavaEE</groupId>
<artifactId>JavaEE</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>
</dependencies>
</project>
I'm trying to access the url http://localhost:9090/resources/info
and it returns me 404.
What am I doing wrong?