1

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?

Gopal Bhuva
  • 654
  • 2
  • 13
  • 20
Harsha
  • 87
  • 1
  • 14

2 Answers2

0

If you are trying to access using http, try changing the URL to https with proper port for https as configured in the server.

This is only if you are 100% sure that context root is correct with proper case.

highhope
  • 148
  • 10
  • Thank you for your answer, i have tried doing that ,but now I have found the solution which i have posted below. thanks:) – Harsha May 07 '18 at 06:14
0

I have found that http server was not properly configured, so it was showing the error

Harsha
  • 87
  • 1
  • 14