Comment From: wilkinsona

Given the lack of description, I'm guessing this was opened in error.

Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback. Wed May 31 23:17:56 IST 2017 There was an unexpected error (type=Not Found, status=404).

This is the default content of a 404 response when a page isn't found for the request's URL.

Comment From: Arrsoya

make sure you are requestiong the right URl. For example if in your Restcontroller you have defined this : @RequestMapping("/") public String index() { return "Greetings from Spring Boot!"; }

your URL must be like "http://localhost:8080/" because of the @RequestMapping("/")

I hope this was helpful

Comment From: varun-vijayarao

ive got the same error. i'm trying to display a greeting on my localhost. the codes are greetingcontroller: package com.example.Mydemo;

import java.util.concurrent.atomic.AtomicLong;

import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam;

public class GreetingController {

private static final String template = "Hello, %s!";
private final AtomicLong counter = new AtomicLong();

@RequestMapping("/greeting")
public Greeting greeting(@RequestParam(value="name", defaultValue="World") String name) {
    return new Greeting(counter.incrementAndGet(),
                        String.format(template, name));
}

}

greeting: package com.example.Mydemo;

public class Greeting {

    private final long id;
    private final String content;

    public Greeting(long id, String content) {
        this.id = id;
        this.content = content;
    }

    public long getId() {
        return id;
    }

    public String getContent() {
        return content;
    }
}

my pom is

      <?xml version="1.0" encoding="UTF-8"?>

-

4.0.0

com.example

Mydemo

0.0.1-SNAPSHOT

jar

Mydemo

Demo project for Spring Boot

-

org.springframework.boot

spring-boot-starter-parent

1.5.9.RELEASE

-

UTF-8

UTF-8

1.8

-

-

org.springframework.boot

spring-boot-starter-web

-

org.springframework.boot

spring-boot-starter-test

test

-

-

-

org.springframework.boot

spring-boot-maven-plugin

Comment From: snicoll

@varun-vijayarao we don't use the tracker for questions. Please ask on StackOverflow or join us on Gitter.

Comment From: ghost

make sure we have to specify the package where SpringApplication.run(DemoApplication.class, args) available.Then it is working fine

Comment From: kvh44

I have found the problem. When you execute the generated jar file of spring boot. You need to execute the command out of the folder target like this

" mvn clean package && java -jar target/mmm-0.0.1-SNAPSHOT.jar".

Otherwise it can't find the folder WEB-INF which located in "/src/main/webapp/".

Comment From: wilkinsona

@kvh44 Thanks for trying to help, but if you are building a jar file you shouldn't be using src/main/webapp. There's a note about this in the documentation:

Do not use the src/main/webapp directory if your application is packaged as a jar. Although this directory is a common standard, it works only with war packaging, and it is silently ignored by most build tools if you generate a jar.

Comment From: BynuLorenz

@kvh44 Thank you for your solution. took me days to figure it out. Any suggetion why application can't find WEB-INF which located in "/src/main/webapp/" while running on IDE.

Comment From: davidecherubini

@kvh44 I'm new to programming and I encountered the same problem mentioned above, when I run the application via SpringBoot. Where should I write that line out of the destination?

Comment From: jmdopereiro

I got this problem running from the IDE in the examples of https://spring.io/guides/tutorials/spring-security-and-angular-js

Comment From: Alpiniatechnologies

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Wed Aug 04 21:50:06 IST 2021 There was an unexpected error (type=Not Found, status=404).

this my error please solve

Comment From: snicoll

@Alpiniatechnologies please ask questions on StackOverflow.

Comment From: pankajkumarsingh123

Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback.

Tue Aug 01 10:38:46 IST 2023 There was an unexpected error (type=Not Found, status=404). No message available