0
votes

I try to do API webservice by Spring-boot but I get an error "Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback.

Sun Apr 21 13:42:49 ICT 2019 There was an unexpected error (type=Not Found, status=404). No message available"

ArrestGetByConApplication.java : 

package com.arrestbycon.arrestGetByCon;
import org.springframework.boot.SpringApplication; 
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@ComponentScan
public class ArrestGetByConApplication {

public static void main(String[] args) {
    SpringApplication.run(ArrestGetByConApplication.class, args);
}

}

and some of my controller :

package com.arrestbycont.arrestGetByCon;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.sql.*;
import java.util.ArrayList;
import com.arrestbycon.arrestGetByCon.Result;

@RestController
public class GetByCon {

    @RequestMapping(value = "/test", method = RequestMethod.GET)   
    public ArrayList<Result> getResult() {
      Integer arr_id;
      Integer off_id;
      String arr_code;
      String off_code;
      String off_name;

      ArrayList<Object> myArrlist = new ArrayList<Object>();
1
Can you be more precise ? You want to customize the error page ? Or you do not understand why you have this answer ? - Alexandre Cartapanis

1 Answers

0
votes

"White Label Page" is not an error of itself, but rather the template that Spring returns in case there's an error that does not have some other custom handling.

In this specific case mentioned the error is obviously is that the controller endpoint you are trying to hit doesn't exist (hence the 404 code). Just make sure that you are making the API call to the correct endpoint with the correct HTTP method.