Suspend after `HHH000204: Processing PersistenceUnitInfo` - java

I'm using SpringBoot and Hibernate, but the application stops after log HHH000204: Processing PersistenceUnitInfo at start up.
What does it mean?
Full stack:
:: Spring Boot :: (v2.0.5.RELEASE)
2019-01-19 17:30:40.343 INFO 23942 --- [ main] com.mafengwo.Application : Starting Application on sunxingbindeMacBook-Pro.local with PID 23942 (/Users/sunxingbin/IdeaProjects/contentrepojob/target/classes started by sunxingbin in /Users/sunxingbin/IdeaProjects/contentrepojob)
2019-01-19 17:30:40.347 INFO 23942 --- [ main] com.mafengwo.Application : No active profile set, falling back to default profiles: default
2019-01-19 17:30:40.470 INFO 23942 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#cd3fee8: startup date [Sat Jan 19 17:30:40 CST 2019]; root of context hierarchy
2019-01-19 17:30:41.910 INFO 23942 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-01-19 17:30:42.208 INFO 23942 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$86296a04] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-01-19 17:30:42.750 INFO 23942 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 10086 (http)
2019-01-19 17:30:42.788 INFO 23942 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-01-19 17:30:42.788 INFO 23942 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.34
2019-01-19 17:30:42.801 INFO 23942 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/Users/sunxingbin/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
2019-01-19 17:30:43.028 INFO 23942 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-01-19 17:30:43.028 INFO 23942 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2561 ms
2019-01-19 17:30:43.130 INFO 23942 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2019-01-19 17:30:43.135 INFO 23942 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2019-01-19 17:30:43.136 INFO 23942 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2019-01-19 17:30:43.136 INFO 23942 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2019-01-19 17:30:43.137 INFO 23942 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2019-01-19 17:30:43.200 INFO 23942 --- [ main] o.s.j.d.DriverManagerDataSource : Loaded JDBC driver: com.mysql.jdbc.Driver
2019-01-19 17:30:43.402 INFO 23942 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2019-01-19 17:30:43.433 INFO 23942 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2019-01-19 17:30:43.549 INFO 23942 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.2.17.Final}
2019-01-19 17:30:43.550 INFO 23942 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2019-01-19 17:30:43.599 INFO 23942 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
Sat Jan 19 17:30:43 CST 2019 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
2019-01-19 17:30:44.423 INFO 23942 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
Sat Jan 19 17:30:45 CST 2019 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
2019-01-19 17:30:45.251 INFO 23942 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2019-01-19 17:30:45.271 INFO 23942 --- [ main] o.s.j.d.DriverManagerDataSource : Loaded JDBC driver: com.mysql.jdbc.Driver
2019-01-19 17:30:45.276 INFO 23942 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2019-01-19 17:30:45.276 INFO 23942 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]

Related

My h2 working, but i cant connect inside of h2-console

Yoo coder, have one issue with h2-console.When i created some entitys on start,my h2 worked and i could open my h2-console and saw there tables ,but after some time i want connect again and doesn't work now.Meanwhile i added some lines and classes,but idk why doesn't work my h2-console,cause i don't touch application properties.
After lick on conect or testconect i got this error
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Mon Mar 14 19:12:33 CET 2022
There was an unexpected error (type=Forbidden, status=403).
My github project: https://github.com/Wynnyy/bookingdoctor-project.git
logs
2022-03-14 19:12:16.222 INFO 23108 --- [ main] s.w.b.BookingdoctorApplication : Starting BookingdoctorApplication using Java 17.0.2 on DESKTOP-K3O8I67 with PID 23108 (C:\Users\Patrik Severín\IdeaProjects\bookingdoctor\target\classes started by Wynny in C:\Users\Patrik Severín\IdeaProjects\bookingdoctor)
2022-03-14 19:12:16.224 INFO 23108 --- [ main] s.w.b.BookingdoctorApplication : No active profile set, falling back to 1 default profile: "default"
2022-03-14 19:12:16.928 INFO 23108 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-03-14 19:12:16.986 INFO 23108 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 47 ms. Found 2 JPA repository interfaces.
2022-03-14 19:12:17.670 INFO 23108 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2022-03-14 19:12:17.682 INFO 23108 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-03-14 19:12:17.682 INFO 23108 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.58]
2022-03-14 19:12:17.780 INFO 23108 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-03-14 19:12:17.780 INFO 23108 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1503 ms
2022-03-14 19:12:17.829 INFO 23108 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2022-03-14 19:12:18.068 INFO 23108 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2022-03-14 19:12:18.080 INFO 23108 --- [ main] o.s.b.a.h2.H2ConsoleAutoConfiguration : H2 console available at '/h2-console'. Database available at 'jdbc:h2:mem:wynny'
2022-03-14 19:12:18.277 INFO 23108 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2022-03-14 19:12:18.331 INFO 23108 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.6.5.Final
2022-03-14 19:12:18.497 INFO 23108 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2022-03-14 19:12:18.627 INFO 23108 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2022-03-14 19:12:19.225 INFO 23108 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2022-03-14 19:12:19.232 INFO 23108 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2022-03-14 19:12:19.540 WARN 23108 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2022-03-14 19:12:19.708 INFO 23108 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Will not secure any request
2022-03-14 19:12:20.112 INFO 23108 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2022-03-14 19:12:20.211 INFO 23108 --- [ main] s.w.b.BookingdoctorApplication : Started BookingdoctorApplication in 4.362 seconds (JVM running for 4.745)
2022-03-14 19:12:24.415 INFO 23108 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2022-03-14 19:12:24.415 INFO 23108 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2022-03-14 19:12:24.417 INFO 23108 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 2 ms
By default, spring-security will protect each and every end-point - So, for /error you need to manually configure like the following -
#EnableWebSecurity
public class AppSecurityConfig extends WebSecurityConfigurerAdapter {
#Override
public void configure(HttpSecurity auth) {
auth.csrf().disable()
.authorizeRequests()
.antMatchers("/error/**").permitAll() // permit-all for /error page
.anyRequest().authenticated();
}
}
For future reference:
In Spring Boot 3.0 / Spring Security 6.0 http.antMatcher() is not longer available and was replaced with http.securityMatcher().
So Subham's answer would look like that:
#Configuration
public class SecurityConfiguration {
#Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.authorizeHttpRequests((authz) -> authz.anyRequest().permitAll())
.csrf().disable()
.securityMatcher("/error/**")
.httpBasic(withDefaults());
return http.build();
}
}

why I see this when compiling my project in bootstrap? "Found 0 JPA repository interfaces."

I have created a Bootstrap project in which I have 3 repositories. When I compile the project I do not receive any errors but unfortunately I can not see my controllers in Swagger!!!
I have found out that line 4 says:
Finished Spring Data repository scanning in 4 ms. Found 0 JPA
repository interfaces.
I think this the reason that I can not see the controllers. Any idea to solve this? Thank you in advance.
2021-12-14 00:26:13.768 INFO 5472 --- [ main] WBSthesis.rotab.RotabApplication
: No active profile set, falling back to default profiles: default
2021-12-14 00:26:14.648 INFO 5472 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-12-14 00:26:14.661 INFO 5472 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : ***Finished Spring Data repository scanning in 4 ms. Found 0 JPA repository interfaces.***
2021-12-14 00:26:15.592 INFO 5472 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2021-12-14 00:26:15.609 INFO 5472 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-12-14 00:26:15.609 INFO 5472 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.54]
2021-12-14 00:26:15.718 INFO 5472 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-12-14 00:26:15.718 INFO 5472 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1885 ms
2021-12-14 00:26:15.975 INFO 5472 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2021-12-14 00:26:16.051 INFO 5472 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.32.Final
2021-12-14 00:26:16.226 INFO 5472 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2021-12-14 00:26:16.356 INFO 5472 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2021-12-14 00:26:16.562 INFO 5472 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2021-12-14 00:26:16.580 INFO 5472 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL55Dialect
2021-12-14 00:26:16.856 INFO 5472 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2021-12-14 00:26:16.866 INFO 5472 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2021-12-14 00:26:17.090 WARN 5472 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2021-12-14 00:26:17.225 INFO 5472 --- [ main] pertySourcedRequestMappingHandlerMapping : Mapped URL path [/v2/api-docs] onto method [springfox.documentation.swagger2.web.Swagger2Controller#getDocumentation(String, HttpServletRequest)]
2021-12-14 00:26:17.490 INFO 5472 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2021-12-14 00:26:17.491 INFO 5472 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
2021-12-14 00:26:17.511 INFO 5472 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s)
2021-12-14 00:26:17.544 INFO 5472 --- [ main] s.d.s.w.s.ApiListingReferenceScanner : Scanning for api listing references
2021-12-14 00:26:17.698 INFO 5472 --- [ main] WBSthesis.rotab.RotabApplication : Started RotabApplication in 4.468 seconds (JVM running for 4.958)
More info of your project would be helpful, but maybe your interfaces are not inside the right package. I was facing this once...
Here is an example.
Notice that all sub-packages are on the same level as the #SpringBootApplication.

Spring Boot Not Deploying WAR From IntelliJ

I was trying to deploy my first Spring Boot application to WAR file but it's not working. There is no error showing but also not finding any WAR file.
I have followed all the steps found on Spring Boot documentation and all over StackOverflow. Here are these:
Step 1: I have extended SpringBootServletInitializer
#SpringBootApplication
public class SpringBoot1Application extends SpringBootServletInitializer
{
public static void main(String[] args) throws Exception
{
SpringApplication.run(SpringBoot1Application.class, args);
}
}
Step 2: Added apply plugin: 'war' and dependencies in the build.gradle file
buildscript {
ext {
springBootVersion = '2.0.3.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'war'
group = 'com.ranadepto'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-web')
runtime('org.springframework.boot:spring-boot-devtools')
runtime('mysql:mysql-connector-java')
testCompile('org.springframework.boot:spring-boot-starter-test')
provided 'org.springframework.boot:spring-boot-starter-tomcat'
providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
}
war {
baseName = 'SpringBoot1'
}
I am also including console output messages:
:: Spring Boot :: (v2.0.3.RELEASE)
2018-07-06 20:50:49.322 INFO 3489 --- [ restartedMain] c.r.SpringBoot1.SpringBoot1Application : Starting SpringBoot1Application on Rana-Depto-MacBook-Pro.local with PID 3489 (/Users/ranadepto/Desktop/SpringBoot1/out/production/classes started by ranadepto in /Users/ranadepto/Desktop/SpringBoot1)
2018-07-06 20:50:49.324 INFO 3489 --- [ restartedMain] c.r.SpringBoot1.SpringBoot1Application : No active profile set, falling back to default profiles: default
2018-07-06 20:50:49.375 INFO 3489 --- [ restartedMain] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#7acf6bce: startup date [Fri Jul 06 20:50:49 BDT 2018]; root of context hierarchy
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 (file:/Users/ranadepto/.gradle/caches/modules-2/files-2.1/org.springframework/spring-core/5.0.7.RELEASE/54b731178d81e66eca9623df772ff32718208137/spring-core-5.0.7.RELEASE.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2018-07-06 20:50:50.215 INFO 3489 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$f69149ff] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-07-06 20:50:50.461 INFO 3489 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2018-07-06 20:50:50.476 INFO 3489 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2018-07-06 20:50:50.477 INFO 3489 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.31
2018-07-06 20:50:50.480 INFO 3489 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/Users/ranadepto/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
2018-07-06 20:50:50.527 INFO 3489 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2018-07-06 20:50:50.527 INFO 3489 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1157 ms
2018-07-06 20:50:50.612 INFO 3489 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2018-07-06 20:50:50.615 INFO 3489 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-07-06 20:50:50.615 INFO 3489 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-07-06 20:50:50.615 INFO 3489 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-07-06 20:50:50.615 INFO 3489 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2018-07-06 20:50:50.710 INFO 3489 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2018-07-06 20:50:50.841 INFO 3489 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2018-07-06 20:50:50.866 INFO 3489 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2018-07-06 20:50:50.873 INFO 3489 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2018-07-06 20:50:50.908 INFO 3489 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.2.17.Final}
2018-07-06 20:50:50.909 INFO 3489 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2018-07-06 20:50:50.931 INFO 3489 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2018-07-06 20:50:50.995 INFO 3489 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
2018-07-06 20:50:51.305 INFO 3489 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2018-07-06 20:50:51.523 INFO 3489 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-07-06 20:50:51.682 INFO 3489 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#7acf6bce: startup date [Fri Jul 06 20:50:49 BDT 2018]; root of context hierarchy
2018-07-06 20:50:51.700 WARN 3489 --- [ restartedMain] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2018-07-06 20:50:51.722 INFO 3489 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/api/reports],methods=[GET]}" onto public java.util.List<com.ranadepto.SpringBoot1.ReportModel> com.ranadepto.SpringBoot1.ReportController.getAllReports()
2018-07-06 20:50:51.723 INFO 3489 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/api/reports/{id}],methods=[GET]}" onto public com.ranadepto.SpringBoot1.ReportModel com.ranadepto.SpringBoot1.ReportController.getReportById(java.lang.String)
2018-07-06 20:50:51.724 INFO 3489 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/api/reports],methods=[POST]}" onto public com.ranadepto.SpringBoot1.ReportModel com.ranadepto.SpringBoot1.ReportController.createReport(com.ranadepto.SpringBoot1.ReportModel)
2018-07-06 20:50:51.724 INFO 3489 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/api/reports/{id}],methods=[PUT]}" onto public com.ranadepto.SpringBoot1.ReportModel com.ranadepto.SpringBoot1.ReportController.updateReport(java.lang.String,com.ranadepto.SpringBoot1.ReportModel)
2018-07-06 20:50:51.724 INFO 3489 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/api/reports/{id}],methods=[DELETE]}" onto public org.springframework.http.ResponseEntity<?> com.ranadepto.SpringBoot1.ReportController.deleteReport(java.lang.String)
2018-07-06 20:50:51.726 INFO 3489 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-07-06 20:50:51.726 INFO 3489 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-07-06 20:50:51.746 INFO 3489 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-07-06 20:50:51.746 INFO 3489 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-07-06 20:50:51.921 INFO 3489 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2018-07-06 20:50:51.942 INFO 3489 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-07-06 20:50:51.943 INFO 3489 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'dataSource' has been autodetected for JMX exposure
2018-07-06 20:50:51.947 INFO 3489 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Located MBean 'dataSource': registering with JMX server as MBean [com.zaxxer.hikari:name=dataSource,type=HikariDataSource]
2018-07-06 20:50:51.972 INFO 3489 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2018-07-06 20:50:51.976 INFO 3489 --- [ restartedMain] c.r.SpringBoot1.SpringBoot1Application : Started SpringBoot1Application in 2.93 seconds (JVM running for 3.809)
And finally this is a screenshot of IntelliJ directory hierarchy:
I have been spending for hour on debugging and searching on the web and finally ended up here with a question. Please help me out with how can I get rid of this.

Spring Boot - When I call API, its gives 404 error

I have created a spring boot application. When I deploy the jar file in embedded tomcat and called the test API it gives 404 error. May I know why it is giving the error?
Main class
package com.telematics.fleet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
#SpringBootApplication
#ComponentScan(basePackages={"com.telematics.fleet.controller", "com.telematics.fleet.repository",
"com.telematics.fleet.service","com.telematics.fleet.utility"})
public class TelematicsFleetApplication
{
public static void main(String[] args)
{
SpringApplication.run(TelematicsFleetApplication.class, args);
}
}
Controller class
package com.telematics.fleet.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
#RestController
#RequestMapping("/app")
public class FleetAppController
{
#RequestMapping(value="/test", method=RequestMethod.GET)
public String test()
{
System.out.println("Called test API");
return "Success";
}
}
Console
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/dell/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/dell/.m2/repository/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
The Class-Path manifest attribute in C:\Users\dell\.m2\repository\com\mchange\c3p0\0.9.5.2\c3p0-0.9.5.2.jar referenced one or more files that do not exist: file:/C:/Users/dell/.m2/repository/com/mchange/c3p0/0.9.5.2/mchange-commons-java-0.2.11.jar
08:22:29.726 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Included patterns for restart : []
08:22:29.738 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Excluded patterns for restart : [/spring-boot-starter/target/classes/, /spring-boot-autoconfigure/target/classes/, /spring-boot-starter-[\w-]+/, /spring-boot/target/classes/, /spring-boot-actuator/target/classes/, /spring-boot-devtools/target/classes/]
08:22:29.739 [main] DEBUG org.springframework.boot.devtools.restart.ChangeableUrls - Matching URLs for reloading : [file:/C:/Malya/Git_Homes/telematics-fleet/target/classes/]
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.0.RELEASE)
2018-03-22 08:22:31.881 INFO 252 --- [ restartedMain] c.t.fleet.TelematicsFleetApplication : Starting TelematicsFleetApplication on admin with PID 252 (C:\Malya\Git_Homes\telematics-fleet\target\classes started by dell in C:\Malya\Git_Homes\telematics-fleet)
2018-03-22 08:22:31.889 INFO 252 --- [ restartedMain] c.t.fleet.TelematicsFleetApplication : No active profile set, falling back to default profiles: default
2018-03-22 08:22:32.280 INFO 252 --- [ restartedMain] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#795b4bba: startup date [Thu Mar 22 08:22:32 IST 2018]; root of context hierarchy
2018-03-22 08:22:47.336 INFO 252 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$8c439cf8] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-03-22 08:22:51.865 INFO 252 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2018-03-22 08:22:52.015 INFO 252 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2018-03-22 08:22:52.016 INFO 252 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.28
2018-03-22 08:22:52.076 INFO 252 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jdk1.8.0_162\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre1.8.0_162/bin/server;C:/Program Files/Java/jre1.8.0_162/bin;C:/Program Files/Java/jre1.8.0_162/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\ARM GCC\bin\;C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\eclipse\jre\bin\;C:\Program Files (x86)\sbt\bin;C:\modeltech64_10.2c\win64;C:\Program Files (x86)\CodeBlocks\MinGW\bin;C:\Program Files (x86)\CodeBlocks\MinGW;C:\myrWork\ztex-160513\sp3anTest\aes220_win_files_160502-1\aes220_win_files\DLL;C:\myrWork\ztex-160513\sp3anTest\aes220_win_files_160502-1\aes220_win_files\libs\MS32;C:\myrWork\eMMCModel\ss_emmc\eMMC_vip\sdio\rlm\win_64;C:\workspace\eMMCModel\ss_emmc\eMMC_vip\sdio\sv\examples\sim;C:\Malya\tool\sts-bundle\sts-3.9.2.RELEASE;;.]
2018-03-22 08:22:52.790 INFO 252 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2018-03-22 08:22:52.791 INFO 252 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 20525 ms
2018-03-22 08:23:00.377 INFO 252 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2018-03-22 08:23:00.407 INFO 252 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-03-22 08:23:00.408 INFO 252 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-03-22 08:23:00.409 INFO 252 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-03-22 08:23:00.410 INFO 252 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2018-03-22 08:23:00.411 INFO 252 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpTraceFilter' to: [/*]
2018-03-22 08:23:00.412 INFO 252 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webMvcMetricsFilter' to: [/*]
2018-03-22 08:23:01.619 INFO 252 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2018-03-22 08:23:03.674 INFO 252 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2018-03-22 08:23:04.327 INFO 252 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2018-03-22 08:23:04.469 INFO 252 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2018-03-22 08:23:05.269 INFO 252 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.2.14.Final}
2018-03-22 08:23:05.284 INFO 252 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2018-03-22 08:23:05.721 INFO 252 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2018-03-22 08:23:08.342 INFO 252 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2018-03-22 08:23:16.185 INFO 252 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2018-03-22 08:23:34.747 INFO 252 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#795b4bba: startup date [Thu Mar 22 08:22:32 IST 2018]; root of context hierarchy
2018-03-22 08:23:36.160 WARN 252 --- [ restartedMain] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2018-03-22 08:23:37.239 INFO 252 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/app/test],methods=[GET]}" onto public java.lang.String com.telematics.fleet.controller.FleetAppController.test()
2018-03-22 08:23:37.380 INFO 252 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-03-22 08:23:37.383 INFO 252 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-03-22 08:23:38.325 INFO 252 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-03-22 08:23:38.326 INFO 252 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-03-22 08:23:39.279 INFO 252 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-03-22 08:23:40.156 WARN 252 --- [ restartedMain] ion$DefaultTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)
2018-03-22 08:23:46.453 INFO 252 --- [ restartedMain] org.quartz.impl.StdSchedulerFactory : Using default implementation for ThreadExecutor
2018-03-22 08:23:46.581 INFO 252 --- [ restartedMain] org.quartz.core.SchedulerSignalerImpl : Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
2018-03-22 08:23:46.582 INFO 252 --- [ restartedMain] org.quartz.core.QuartzScheduler : Quartz Scheduler v.2.3.0 created.
2018-03-22 08:23:46.588 INFO 252 --- [ restartedMain] org.quartz.simpl.RAMJobStore : RAMJobStore initialized.
2018-03-22 08:23:46.593 INFO 252 --- [ restartedMain] org.quartz.core.QuartzScheduler : Scheduler meta-data: Quartz Scheduler (v2.3.0) 'quartzScheduler' with instanceId 'NON_CLUSTERED'
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.
2018-03-22 08:23:46.595 INFO 252 --- [ restartedMain] org.quartz.impl.StdSchedulerFactory : Quartz scheduler 'quartzScheduler' initialized from an externally provided properties instance.
2018-03-22 08:23:46.595 INFO 252 --- [ restartedMain] org.quartz.impl.StdSchedulerFactory : Quartz scheduler version: 2.3.0
2018-03-22 08:23:46.596 INFO 252 --- [ restartedMain] org.quartz.core.QuartzScheduler : JobFactory set to: org.springframework.boot.autoconfigure.quartz.AutowireCapableBeanJobFactory#629a27c7
2018-03-22 08:23:47.067 INFO 252 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2018-03-22 08:23:47.271 INFO 252 --- [ restartedMain] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator/health],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.String>)
2018-03-22 08:23:47.274 INFO 252 --- [ restartedMain] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator/info],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.String>)
2018-03-22 08:23:47.279 INFO 252 --- [ restartedMain] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto protected java.util.Map<java.lang.String, java.util.Map<java.lang.String, org.springframework.boot.actuate.endpoint.web.Link>> org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping.links(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-03-22 08:23:48.079 INFO 252 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-03-22 08:23:48.086 INFO 252 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'dataSource' has been autodetected for JMX exposure
2018-03-22 08:23:48.130 INFO 252 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Located MBean 'dataSource': registering with JMX server as MBean [com.zaxxer.hikari:name=dataSource,type=HikariDataSource]
2018-03-22 08:23:48.207 INFO 252 --- [ restartedMain] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147483647
2018-03-22 08:23:48.208 INFO 252 --- [ restartedMain] o.s.s.quartz.SchedulerFactoryBean : Starting Quartz Scheduler now
2018-03-22 08:23:48.209 INFO 252 --- [ restartedMain] org.quartz.core.QuartzScheduler : Scheduler quartzScheduler_$_NON_CLUSTERED started.
2018-03-22 08:23:48.464 INFO 252 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2018-03-22 08:23:48.488 INFO 252 --- [ restartedMain] c.t.fleet.TelematicsFleetApplication : Started TelematicsFleetApplication in 78.687 seconds (JVM running for 81.635)
2018-03-22 08:24:55.653 INFO 252 --- [nio-8080-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
2018-03-22 08:24:55.654 INFO 252 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2018-03-22 08:24:55.755 INFO 252 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 101 ms
POSTMAN Response
{
"timestamp": "2018-03-22T03:06:40.138+0000",
"status": 404,
"error": "Not Found",
"message": "No message available",
"path": "/telematics-fleet/app/test"
}
Properties file
spring.jpa.hibernate.ddl-auto=update
spring.jpa.generate-ddl=true
spring.datasource.url=jdbc:mysql://localhost:3306/db_example
spring.datasource.username=springuser
spring.datasource.password=ThePassword
In the console server is running fine but i am getting 404 error when trying to access the api's
There are two important points to keep in mind while deploying a SpringBoot application to a container :
1.Starting point of application: If you are deploying a SprinBoot application to any servlet container(like Tomcat) your starter class must extend SpringBootServletInitializer, so that the container can find the starting point of your application
#SpringBootApplication
public class TelematicsFleetApplication extends SpringBootServletInitializer {
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(TelematicsFleetApplication .class);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(TelematicsFleetApplication .class, args);
}
}
After successful deployment on Tomcat you should prefix your application name before all resource URLs.
Example : localhost:8080/Application_Name/app/test
Extra tip: After Spring 4.3 you can replace #RequestMapping(method = RequestMethod.GET) by #GetMapping
Example : #Getmapping("/test")
You should change your controller to:
#RestController
#RequestMapping("/telematics-fleet/app")
public class FleetAppController
{
#RequestMapping(value="/test", method=RequestMethod.GET)
public String test()
{
System.out.println("Called test API");
return "Success";
}
}
The current call does not point to correct resource.
Note the log states that your server was started and pointing to / as root and not /telematics-fleet.
The other thing you could do is keep your controller as it is and add a new property in application.properties as:
server.contextPath=/telematics-fleet
Your postman requesting the path--- "path": "/telematics-fleet/app/test" but your controller the path should be "path": "/app/test" . So there is a missmatch.
Try removing context
http://localhost:8080/app/test
If you running it using spring boot plugin, and haven't configured context in meta file, spring boot run on default context
The project name is not automatically added to the context path in Spring Boot, it is / by default. If you do want to add it, set the following in your .properties file:
server.servlet.contextPath=/telematics-fleet
Or for pre-2.0 versions of Spring Boot:
server.contextPath=/telematics-fleet
If not, then just remove that part from your request, hitting /app/test directly.
In my project, it was because of the missing dependency in the pom.
spring-boot-starter-web
Look for Servlet dispatcherServlet mapped to [/] in the logs, if it is not there, it means the required dependencies are missing
Had a similar issue. For me, the project name in Eclipse was different from the one that was mentioned in the application.properties.
renaming the eclipse project to the same as the one in application.properties solved the issue

Camel - Can't access rest service

I'm running camel via spring and camel boot with embedded tomcat.
I have a simple camel route that is configuring correctly and consuming that I can see in the logs, but when i try to access it, it is giving 404 with localhost:8080/hi.
My Route
#Component
public class ServiceRoute extends RouteBuilder {
#Autowired
private SampleBean sampleBean;
#Override
public void configure() throws Exception {
from("rest:get:hi").to("bean:sampleBean");
}
}
My Main class
#Configuration
#SpringBootApplication
#ComponentScan(basePackages = { "routes", "service" },
excludeFilters = {#ComponentScan.Filter(value = Controller.class,
type = FilterType.ANNOTATION)})
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Gradle dependencies
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
compile 'org.apache.camel:camel-spring-boot-starter:2.17.0'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-
web', version: '1.4.2.RELEASE'
compile group: 'org.apache.camel', name: 'camel-servlet', version:
'2.18.1'
}
Logs
2016-12-12 12:37:39.860 INFO 24684 --- [ main] root.Application : Starting Application on ram.tscpt.local with PID 24684 (/Users/srikanth/emulya/build/classes/main started by srikanth in /Users/srikanth/emulya)
2016-12-12 12:37:39.865 INFO 24684 --- [ main] root.Application : No active profile set, falling back to default profiles: default
2016-12-12 12:37:39.979 INFO 24684 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#4facf68f: startup date [Mon Dec 12 12:37:39 SAST 2016]; root of context hierarchy
2016-12-12 12:37:41.866 INFO 24684 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.apache.camel.spring.boot.CamelAutoConfiguration' of type [class org.apache.camel.spring.boot.CamelAutoConfiguration$$EnhancerBySpringCGLIB$$a11fb1e5] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-12-12 12:37:42.597 INFO 24684 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2016-12-12 12:37:42.617 INFO 24684 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2016-12-12 12:37:42.618 INFO 24684 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.5
2016-12-12 12:37:42.756 INFO 24684 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2016-12-12 12:37:42.756 INFO 24684 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2782 ms
2016-12-12 12:37:42.959 INFO 24684 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2016-12-12 12:37:42.983 INFO 24684 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2016-12-12 12:37:42.984 INFO 24684 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2016-12-12 12:37:42.985 INFO 24684 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2016-12-12 12:37:42.985 INFO 24684 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2016-12-12 12:37:43.525 INFO 24684 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#4facf68f: startup date [Mon Dec 12 12:37:39 SAST 2016]; root of context hierarchy
2016-12-12 12:37:43.651 INFO 24684 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2016-12-12 12:37:43.653 INFO 24684 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2016-12-12 12:37:43.703 INFO 24684 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-12-12 12:37:43.707 INFO 24684 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-12-12 12:37:43.778 INFO 24684 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-12-12 12:37:44.557 INFO 24684 --- [ main] o.a.c.i.converter.DefaultTypeConverter : Loaded 196 type converters
2016-12-12 12:37:44.890 INFO 24684 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2016-12-12 12:37:44.970 INFO 24684 --- [ main] o.a.camel.spring.boot.RoutesCollector : Loading additional Camel XML routes from: classpath:camel/*.xml
2016-12-12 12:37:44.973 INFO 24684 --- [ main] o.a.camel.spring.boot.RoutesCollector : Loading additional Camel XML rests from: classpath:camel-rest/*.xml
2016-12-12 12:37:44.974 INFO 24684 --- [ main] o.a.camel.spring.SpringCamelContext : Apache Camel 2.18.1 (CamelContext: camel-1) is starting
2016-12-12 12:37:44.976 INFO 24684 --- [ main] o.a.c.m.ManagedManagementStrategy : JMX is enabled
2016-12-12 12:37:45.548 INFO 24684 --- [ main] o.a.c.i.DefaultRuntimeEndpointRegistry : Runtime endpoint registry is in extended mode gathering usage statistics of all incoming and outgoing endpoints (cache limit: 1000)
2016-12-12 12:37:45.871 INFO 24684 --- [ main] o.a.camel.spring.SpringCamelContext : StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
2016-12-12 12:37:46.023 INFO 24684 --- [ main] o.a.camel.spring.SpringCamelContext : Route: route1 started and consuming from: servlet:/hi?httpMethodRestrict=GET
2016-12-12 12:37:46.024 INFO 24684 --- [ main] o.a.camel.spring.SpringCamelContext : Total 1 routes, of which 1 are started.
2016-12-12 12:37:46.026 INFO 24684 --- [ main] o.a.camel.spring.SpringCamelContext : Apache Camel 2.18.1 (CamelContext: camel-1) started in 1.050 seconds
2016-12-12 12:37:46.147 INFO 24684 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2016-12-12 12:37:46.157 INFO 24684 --- [ main] root.Application : Started Application in 6.985 seconds (JVM running for 7.475)
It's not working, because the Camel HTTP Servlet is not registered. CamelAutoConfiguration just starts the camel context.
You need to register the servlet yourself. The default name of the camel servlet is CamelServlet. Change your Application class:
#SpringBootApplication
#ComponentScan(basePackages = { "routes", "service" },
excludeFilters = {#ComponentScan.Filter(value = Controller.class,
type = FilterType.ANNOTATION)})
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
#Bean
public ServletRegistrationBean servletRegistrationBean() {
ServletRegistrationBean registration = new ServletRegistrationBean(new CamelHttpTransportServlet(), "/service/*");
registration.setName("CamelServlet");
return registration;
}
}
And then try to access http://localhost/service/hi
Btw, you don't need to add #Configuration to the class annotated with #SpringBootApplication.

Categories