We Are Going To Discuss About Issue With Spring: There was an unexpected error (type=Not Found, status=404). So lets Start this Java Article.
Issue With Spring: There was an unexpected error (type=Not Found, status=404)
- Issue With Spring: There was an unexpected error (type=Not Found, status=404)
I believe your issue is related to packages. Your application is defined in
com.organization_name.webservices.application
. - Issue With Spring: There was an unexpected error (type=Not Found, status=404)
I believe your issue is related to packages. Your application is defined in
com.organization_name.webservices.application
.
Solution 1
I believe your issue is related to packages. Your application is defined in com.organization_name.webservices.application
. I am guessing your other classes are in a different package that is not a child of com.organization_name.webservices.application
. Spring will automatically load controllers that are in the same package or sub-packages, for example:
com.organization_name.webservices.application
com.organization_name.webservices.application.controllers
But not packages like this:
com.organization_name.webservices.controllers
You can fix this by either moving your controller (or application), or adding ComponentScan
to your Application:
@SpringBootApplication
@ComponentScan(basePackageClasses=GreetingController.class)
public class Application {
You should be seeing this in your log:
Mapped "{[/greeting]}" onto public com.organization_name.webservices.xxx.Greeting com.organization_name.webservices.xxx.GreetingController.greeting(java.lang.String)
Original Author markwatsonatx Of This Content
Solution 2
seems like you are missing thymleaf dependency. Put this inside your pom.xml dependencies
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
Original Author bula Of This Content
Solution 3
in pom.xml add the following dependency
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
Original Author SAN Of This Content
Solution 4
Adding these dependencies helped me :
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.6.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.6.1</version>
<scope>compile</scope>
</dependency>
@EnableSwagger2
@Configuration
public class swagger {
public Docket productApi() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("com.example.Mongo"))
.paths(regex("/mongo.*"))
.build();
}
}
Original Author Vikram S Of This Content
Conclusion
So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.