Closed nitinpawar283 closed 7 years ago
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.
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
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"?>
-
-
-
@varun-vijayarao we don't use the tracker for questions. Please ask on StackOverflow or join us on Gitter.
make sure we have to specify the package where SpringApplication.run(DemoApplication.class, args) available.Then it is working fine
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/".
@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.
@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.
@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?
I got this problem running from the IDE in the examples of https://spring.io/guides/tutorials/spring-security-and-angular-js
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
@Alpiniatechnologies please ask questions on StackOverflow.
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