locked
New web service methods not being mapped on a tomcat instance on Azure RRS feed

  • Question

  • I have a web service running on tomcat 8.5, however whenever I try to update the version, the new methods do not map properly, and 404 as a result.  

    For example, if a prior version had a method such as host/ContextPath/HelloWorld/, that'd run completely fine, no issues there.  
    However if I were to add a new method, host/ContextPath/AnotherMethod/, this method would 404. 

    It's not a case of the newer versions aren't being run on Azure, as you can look at the deployment history and see that it's pulling the latest versions from github, and apparently deploys them successfully. 

    I am unsure of how to progress from here, as what I have *should* be working, eg the new versions are on the server, server is running and healthy etc, yet it isn't.  

    Additionally, by viewing what files are on the server through site\wwwroot\[project files], I can actually see that the most up to date versions of the files are on the server.  

    https://i.stack.imgur.com/JHte9.png

    However, the methods are not being exposed, so I am at a loss as to what is happening.

    For example, consider the AdministrationService, which you can see the code for below: 
        package services;

        import controllers.DatabaseController;
        import controllers.EmailController;
        import controllers.ProgrammeController;
        import entities.Programme;
        import java.io.InputStream;
        import javax.json.Json;
        import javax.json.JsonArray;
        import javax.json.JsonException;
        import javax.json.JsonObject;
        import javax.json.JsonReader;
        import javax.ws.rs.Consumes;
        import javax.ws.rs.GET;
        import static javax.ws.rs.HttpMethod.POST;
        import javax.ws.rs.POST;
        import javax.ws.rs.Path;
        import javax.ws.rs.Produces;
        import javax.ws.rs.QueryParam;
        import javax.ws.rs.core.MediaType;
        import utilities.SQLQuery;

        @Path("/Admin")
        public class AdministrationService {
            ProgrammeController pc = new ProgrammeController();

            /**
             * A simple method for testing if our service is online.
             * -> GET /API/Admin/Health
             * If true is returned, we will have configured our service properly.
             * @return 
             */
            @GET
            @Path("/Health")
            public Boolean getHealthy(){
                return true;
            }

            @GET
            @Path("/TestEmail")
            public void testEmail(@QueryParam("target")String target){
                EmailController ec = EmailController.getInstance();

                String messageBody = "Hello world";
                String recipient = target;
                String messageSubject = "Test email";

                ec.sendEmail(recipient, messageBody, messageSubject);
            }
        }

    The /Health method is an old method. It runs just fine if I access it through  
    myazurehost.net/ContextPath/Admin/Health

    However if I attempt to do the same with  
    myazurehost.net/ContextPath/Admin/TestEmail?target=testemail@gmail.com

    I receive a 404 error. It's not a case of the method being incorrectly called, as the error is a 404, not a 400 bad request, 405 wrong type etc. As far as the server is concerned, the method does not exist and it's baffling.

    I've tried server reboots, reinitialising the project, to no avail. Any help is greatly appreciated.


                                                    
    Monday, April 24, 2017 7:11 PM