I visited Servlet not being mapped, java web.xml not being overridden in target folder and tried to implement.
My web.xml automatically created whenever Servlet added by using Neatbeans interface and resides in project_folder/src/main/webapp/WEB-INF/
and has follwing content like below (Default created by Netbeans)-
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" 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_3_1.xsd">
<servlet>
<servlet-name>AdminPathController</servlet-name>
<servlet-class>AdminPathController</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AdminPathController</servlet-name>
<url-pattern>/AdminPathController</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
</web-app>
But when i hit address localhost:8080/entry-dispatch/AdminPathController
returns an error HTTP Status 404 - Not Found
Later i put some plugin code in pom.xml
like below to map the web.xml
file like below -
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<webXml>${basedir}/src/main/webapp/WEB-INF/web.xml</webXml>
</configuration>
</plugin>