I have created a servlet.java file for my application and added it in web.xml as follows:
servlet:
public class CheckServlet extends HttpServlet implements Servlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try (PrintWriter out = response.getWriter()) {
response.setContentType("text/html");
out.print("<html><body>");
out.printf("Application '%s' is active", getServletContext().getServletContextName());
out.print("</body></html>");
out.flush();
}catch(IOException e) {
logger.error("IO Exception");
}
}
}
web.xml
<servlet>
<servlet-name>CheckServlet</servlet-name>
<servlet-class>com.adapter.CheckServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CheckServlet</servlet-name>
<url-pattern>/check.html</url-pattern>
</servlet-mapping>
I have liberty server in my local(UT environment, local host) and I am getting successful response.
after this I used udeploy to deploy the application to another WAS server(WebSphere application server) of higher environment.But when i hit the URL there, it is throwing error as
Error 404:
com.ibm.ws.webcontainer.servlet.exception.NoTargetForURIException: No target servlet configured for uri: /check.html
context root and URL is correct.
How can i solve this issue?