0

1.What I am trying to do:

My question concerns the implementation of Dynamic Web Project on live server. How do I make a web application that works locally, will work on a live server?

2 What I did:

The steps I have taken:

  1. Create Java App in Eclipse (using Servlet, Tomcat)

    My very simple, test code:

    package com.test;    
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    
    @WebServlet("/HelloWorld")
    
    public class Test extends HttpServlet {
    private static final long serialVersionUID = 1L;
    
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        PrintWriter out = response.getWriter();
        out.print("Hello World");
    }
    

    }

  2. Export of the war file

  3. Uploaded my Java WAR package to my public_html directory. (I don't have access to any manager who could support my implementations, the only way is to connect to the server via SSH/FTP and upload a .war file to public_html)
  4. Run the unzip to extract the package.

  5. Added the. htaccess file with following text: SetHandler Jakar-servlet SetEnv JK_WORKER_NAME ajp13

3 What is not working?

By passing this url: http:///~(myusername)/Test/HelloWorld

ERROR: Not Found The requested URL /~(myusername)/Test/HelloWorld was not found on this server.

Apparently I don't fully understand the subject of implementation on the server, I swear that I tried to look for an answer, but now I'm in the trap, I can't move on.

Jack G.
  • 21
  • 4
  • As watching to your Servlet class there will no line gap between Servlet annotation and Servlet class name, also you can take a help from my recent answer on simple servlet example: https://stackoverflow.com/questions/48139947/404-error-servlet/48140320#48140320 – ArifMustafa Jan 08 '18 at 13:12
  • 1
    Are you sure the server is running a JEE web container? Your description of the deployment process does not sound like it would. – Henry Jan 08 '18 at 13:14
  • @Henry, how can i check it? In the application, everything works after (I mean locally): http: //localhost:8080/Test/HelloWorld – Jack G. Jan 08 '18 at 13:28
  • "how can i check it?": the easiest way is to ask the person or organization that runs the server. – Henry Jan 08 '18 at 13:38
  • @Henry: OP is using a so-called "cPanel" based host. This is at least not a programming problem and therefore off topic for Stack Overflow. – BalusC Jan 08 '18 at 17:43

0 Answers0