Can't Start the Spring Boot Application - java

I am trying to connect the database in my spring boot project. I have already created a database using phpMyAdmin. The MySQL server is running on port 3307.
But I couldn't run the application.
Here are the related files
pom.xml file is as following
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>LMS</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>LMS</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
application.properties file is as following
spring.datasource.url=jdbc:mysql://localhost:3307/lms?useUnicode=true&useJDBCCompliantTimezone
Shift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
server.error.whitelabel.enabled=false
server.port=8080
spring.datasource.username=root
spring.datasource.password=pasindu
spring.main.web-application-type=none
spring.jpa.open-in-view=false
spring.thymeleaf.cache=false
api.base.path = http://localhost:8080
Here are the Logs in Spring Boot console
2022-12-08T00:23:21.986+05:30 INFO 27872 --- [ main] com.example.LMS.LmsApplication : Starting LmsApplication using Java 17.0.4.1 with PID 27872 (C:\Users\Pasindu_112247\eclipse-workspace\LMS.zip_expanded\LMS\target\classes started by Pasindu_112247 in C:\Users\Pasindu_112247\eclipse-workspace\LMS.zip_expanded\LMS)
2022-12-08T00:23:21.990+05:30 INFO 27872 --- [ main] com.example.LMS.LmsApplication : No active profile set, falling back to 1 default profile: "default"
2022-12-08T00:23:22.500+05:30 INFO 27872 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-12-08T00:23:22.568+05:30 INFO 27872 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 57 ms. Found 1 JPA repository interfaces.
2022-12-08T00:23:22.950+05:30 INFO 27872 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2022-12-08T00:23:23.157+05:30 INFO 27872 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl#3f0d6038
2022-12-08T00:23:23.160+05:30 INFO 27872 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2022-12-08T00:23:23.214+05:30 INFO 27872 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2022-12-08T00:23:23.260+05:30 INFO 27872 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 6.1.5.Final
2022-12-08T00:23:23.410+05:30 WARN 27872 --- [ main] org.hibernate.orm.deprecation : HHH90000021: Encountered deprecated setting [javax.persistence.sharedCache.mode], use [jakarta.persistence.sharedCache.mode] instead
2022-12-08T00:23:23.636+05:30 INFO 27872 --- [ main] SQL dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
2022-12-08T00:23:24.274+05:30 INFO 27872 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2022-12-08T00:23:24.282+05:30 INFO 27872 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2022-12-08T00:23:24.787+05:30 INFO 27872 --- [ main] com.example.LMS.LmsApplication : Started LmsApplication in 3.204 seconds (process running for 3.63)
2022-12-08T00:23:24.794+05:30 INFO 27872 --- [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2022-12-08T00:23:24.799+05:30 INFO 27872 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2022-12-08T00:23:24.811+05:30 INFO 27872 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
How do I fix this?

Related

GET/POST method is not reading data sent by Postman but the request is reaching backend and status code is 200

#RestController
#RequestMapping("/incident")
public class EncryptJsonString {
#GetMapping("/test")
public String getTest(String a) {
System.out.println("yuty "+a);
return a;
}
}
-----------------------------------------------Pom.xml----------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.incident_tool</groupId>
<artifactId>incdt_tool</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Incdt-Tracker</name>
<description>webservice for incident management tool</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
-------------------------------------------Logs----------------------------------------------------
2021-06-09 06:51:48.018 INFO 16256 --- [ main] c.incident.tool.IncdtTrackerApplication : Starting IncdtTrackerApplication using Java 15.0.2 on LAPTOP-03TT5H9L with PID 16256 (C:\Users\sk464\eclipse-workspace\Incdt-Tracker\target\classes started by sk464 in C:\Users\sk464\eclipse-workspace\Incdt-Tracker)
2021-06-09 06:51:48.021 INFO 16256 --- [ main] c.incident.tool.IncdtTrackerApplication : No active profile set, falling back to default profiles: default
2021-06-09 06:51:48.680 INFO 16256 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-06-09 06:51:48.733 INFO 16256 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 43 ms. Found 1 JPA repository interfaces.
2021-06-09 06:51:49.285 INFO 16256 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2021-06-09 06:51:49.296 INFO 16256 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-06-09 06:51:49.296 INFO 16256 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.46]
2021-06-09 06:51:49.442 INFO 16256 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-06-09 06:51:49.442 INFO 16256 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1377 ms
2021-06-09 06:51:49.643 INFO 16256 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2021-06-09 06:51:49.921 INFO 16256 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2021-06-09 06:51:50.004 INFO 16256 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2021-06-09 06:51:50.062 INFO 16256 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.31.Final
2021-06-09 06:51:50.255 INFO 16256 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2021-06-09 06:51:50.399 INFO 16256 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL10Dialect
2021-06-09 06:51:51.282 INFO 16256 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2021-06-09 06:51:51.294 INFO 16256 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2021-06-09 06:51:51.364 WARN 16256 --- [ 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-06-09 06:51:51.994 INFO 16256 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2021-06-09 06:51:52.005 INFO 16256 --- [ main] c.incident.tool.IncdtTrackerApplication : Started IncdtTrackerApplication in 4.38 seconds (JVM running for 5.189)
2021-06-09 06:51:52.006 INFO 16256 --- [ main] o.s.b.a.ApplicationAvailabilityBean : Application availability state LivenessState changed to CORRECT
2021-06-09 06:51:52.007 INFO 16256 --- [ main] o.s.b.a.ApplicationAvailabilityBean : Application availability state ReadinessState changed to ACCEPTING_TRAFFIC
2021-06-09 06:52:18.351 INFO 16256 --- [nio-8080-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-06-09 06:52:18.351 INFO 16256 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2021-06-09 06:52:18.354 INFO 16256 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms
Output when Get request is made via Postman:
yuty null
screenshot of postman request screenshot of postman headers
I have tested it via Jax-RS Rest and it working fine, the problem is only occurring for Spring-boot. Postman is hitting the backend code successfully but the data is not getting maapped in method paramater. I am sending text/plain from Postman.
Try with this:
#RestController
#RequestMapping("/incident")
public class EncryptJsonString {
#GetMapping("/test/{a}")
public String getTest(#PathVariable("a") String a) {
System.out.println("yuty "+a);
return a;
}
}
and then use http://localhost:8080/incident/test/whatever. It should print yuty whatever.
You have 2 approaches here. One is the one that Alessandro just write. (Thats the best, your method is a GET so you must use PathVariables or QueryParams).
If you're actually trying to send plain text in the body of the request, you should add the #RequestBody annotation to your method argument
Like this:
#GetMapping("/test")
public String getTest(#RequestBody String a) {
System.out.println("yuty "+a);
return a;
}
But remember, you should avoid sending a body if your request is a GET.

Cannot start Spring Boot Application

cannot start the Application. Everytime i see this on my console.
2019-10-16 16:00:32.557 INFO 3496 --- [ restartedMain]
com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown
completed.
2019-10-16 16:00:32.566 INFO 3496 --- [ restartedMain]
o.apache.catalina.core.StandardService : Stopping service [Tomcat]
I am not getting any error so far,What i see on console is Stopping service [Tomcat] .
I tried so many time even i changed my work directory. But No Luck.
Even i changed the port number but i dont see any progress.can you please help me to figure it out.
My pom.xml file is below:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.guides.springboot</groupId>
<artifactId>registration-login-springboot-security-thymeleaf</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>registration-login-springboot-security-thymeleaf</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.4.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!-- <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId>
<version>1.7.5</version> </dependency> <dependency> <groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId> <version>1.7.5</version> </dependency> -->
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-beanutils/commons-beanutils -->
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.3</version>
</dependency>
<!-- bootstrap and jquery -->
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.3.7</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>3.2.1</version>
</dependency>
<!-- mysql connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<!-- testing -->
<!-- <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> </dependency> -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
.properties file
server.port=8083
spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp
spring.datasource.url = jdbc:mysql://localhost:3306/dashboard_local?useSSL=false
spring.datasource.username = root
spring.datasource.password = root
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.hibernate.ddl-auto = update
logs are below:
2019-10-16 16:34:45.368 INFO 1388 --- [ restartedMain] com.app.dash.DashApplication : Starting DashApplication on LAPTOP-UH51ORMM with PID 1388 (E:\Download-E\RawTxn\27thSept\Dash\target\classes started by user in E:\Download-E\RawTxn\27thSept\Dash)
2019-10-16 16:34:45.372 INFO 1388 --- [ restartedMain] com.app.dash.DashApplication : No active profile set, falling back to default profiles: default
2019-10-16 16:34:45.448 INFO 1388 --- [ restartedMain] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#37115abe: startup date [Wed Oct 16 16:34:45 SGT 2019]; root of context hierarchy
2019-10-16 16:34:46.993 INFO 1388 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$60543c7c] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-10-16 16:34:47.961 INFO 1388 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8081 (http)
2019-10-16 16:34:47.999 INFO 1388 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-10-16 16:34:47.999 INFO 1388 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.32
2019-10-16 16:34:48.012 INFO 1388 --- [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\jre1.8.0_221\bin;C:\windows\Sun\Java\bin;C:\windows\system32;C:\windows;C:/Program Files/Java/jre1.8.0_221/bin/server;C:/Program Files/Java/jre1.8.0_221/bin;C:/Program Files/Java/jre1.8.0_221/lib/amd64;C:\Program Files\Microsoft MPI\Bin\;C:\Program Files (x86)\Business Objects\Common\3.5\bin\NOTES\;C:\Program Files (x86)\Business Objects\Common\3.5\bin\NOTES\DATA\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;%JAVA_HOME%\bin;%JUNIT_HOME%\junit-4.10.jar;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Users\user\AppData\Local\Programs\Python\Python37-32\Scripts\;C:\Users\user\AppData\Local\Programs\Python\Python37-32\;C:\Program Files\MySQL\MySQL Shell 8.0\bin\;C:\Users\user\AppData\Local\atom\bin;C:\windows\System32;;.]
2019-10-16 16:34:48.188 INFO 1388 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-10-16 16:34:48.188 INFO 1388 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2744 ms
2019-10-16 16:34:48.341 INFO 1388 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2019-10-16 16:34:48.342 INFO 1388 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2019-10-16 16:34:48.342 INFO 1388 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2019-10-16 16:34:48.343 INFO 1388 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2019-10-16 16:34:48.343 INFO 1388 --- [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2019-10-16 16:34:48.344 INFO 1388 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2019-10-16 16:34:48.791 INFO 1388 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2019-10-16 16:34:49.321 INFO 1388 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2019-10-16 16:34:49.438 INFO 1388 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2019-10-16 16:34:49.495 INFO 1388 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2019-10-16 16:34:49.698 INFO 1388 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.2.17.Final}
2019-10-16 16:34:49.702 INFO 1388 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2019-10-16 16:34:49.823 INFO 1388 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2019-10-16 16:34:50.101 INFO 1388 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
2019-10-16 16:34:51.408 INFO 1388 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2019-10-16 16:34:51.682 WARN 1388 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'securityConfiguration': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.app.dash.service.UsersService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {#org.springframework.beans.factory.annotation.Autowired(required=true)}
2019-10-16 16:34:51.683 INFO 1388 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2019-10-16 16:34:51.685 INFO 1388 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2019-10-16 16:34:51.699 INFO 1388 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2019-10-16 16:34:51.705 INFO 1388 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
Based on this line of log:
Error creating bean with name 'securityConfiguration': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.app.dash.service.UsersService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {#org.springframework.beans.factory.annotation.Autowired(required=true)}
an implementation of UserServive interface is missed.
From the full log:
2019-10-16 16:34:51.682 WARN 1388 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'securityConfiguration': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.app.dash.service.UsersService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {#org.springframework.beans.factory.annotation.Autowired(required=true)}
Looks like there is something wrong with the UserService. Can you check that?
Check weather UserServive class has #Service or #Component annotation.
The #Component annotation marks a java class as a bean so the component-scanning mechanism of spring can pick it up and pull it into the application context. The #Service annotation is also a specialization of the component annotation.

Use Spring Boot get entity from Oracle DataBase not work

I want to use Spring boot get entity from Oracle DB(Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production)
when i use repository findById method and toString in Console, it only return like this
LogReturnEmail [createDtm=, fileName=, forwardResult=, forwardTo=, id=f6a70923-973a-47ac-98a0-34200d4ddacb, mailSubject=, messageNo=, messageType=, sellerCompid=]
only id column have value.but i want to get all value.
Main class
#SpringBootApplication
public class Demo2Application implements ApplicationRunner {
#Autowired
private LogReturnEmailRepository repo2;
public static void main(String[] args) {
SpringApplication.run(Demo2Application.class, args);
}
#Override
public void run(ApplicationArguments args) throws Exception {
Optional<LogReturnEmail> xml = repo2.findById("f6a70923-973a-47ac-98a0-34200d4ddacb");
System.out.println(xml.get());
}
}
Repository
#Repository
public interface LogReturnEmailRepository extends JpaRepository<LogReturnEmail, String> {
}
LOG_RETURN_EMAIL entity
/**
* The persistent class for the LOG_RETURN_EMAIL database table.
*
*/
#Entity
#Table(name="LOG_RETURN_EMAIL")
#NamedQuery(name="LogReturnEmail.findAll", query="SELECT l FROM LogReturnEmail l")
public class LogReturnEmail implements Serializable {
private static final long serialVersionUID = 1L;
#Column(name="CREATE_DTM")
private String createDtm;
#Column(name="FILE_NAME")
private String fileName;
#Column(name="FORWARD_RESULT")
private String forwardResult;
#Column(name="FORWARD_TO")
private String forwardTo;
#Id
#Column(name="ID")
private String id;
#Column(name="MAIL_SUBJECT")
private String mailSubject;
#Column(name="MESSAGE_NO")
private String messageNo;
#Column(name="MESSAGE_TYPE")
private String messageType;
#Column(name="SELLER_COMPID")
private String sellerCompid;
//commented out get/set method for brevity
hibernate configurations
spring.jpa.hibernate.ddl-auto=none
spring.jpa.database-platform=org.hibernate.dialect.Oracle9iDialect
spring.datasource.url=
spring.datasource.username=
spring.datasource.password=
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath />
</parent>
<groupId>com.example</groupId>
<artifactId>demo2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo2</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
console log
2019-05-30 09:12:53.167 INFO 13668 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.3.9.Final}
2019-05-30 09:12:53.168 INFO 13668 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2019-05-30 09:12:53.241 INFO 13668 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
2019-05-30 09:12:53.325 INFO 13668 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.Oracle9iDialect
2019-05-30 09:12:53.749 INFO 13668 --- [ restartedMain] o.h.h.i.QueryTranslatorFactoryInitiator : HHH000397: Using ASTQueryTranslatorFactory
2019-05-30 09:12:53.783 INFO 13668 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2019-05-30 09:12:54.006 INFO 13668 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2019-05-30 09:12:54.020 INFO 13668 --- [ restartedMain] com.example.demo.Demo2Application : Started Demo2Application in 2.115 seconds (JVM running for 2.691)
Hibernate:
select
logreturne0_.id as id1_0_0_,
logreturne0_.create_dtm as create_dtm2_0_0_,
logreturne0_.file_name as file_name3_0_0_,
logreturne0_.forward_result as forward_result4_0_0_,
logreturne0_.forward_to as forward_to5_0_0_,
logreturne0_.mail_subject as mail_subject6_0_0_,
logreturne0_.message_no as message_no7_0_0_,
logreturne0_.message_type as message_type8_0_0_,
logreturne0_.seller_compid as seller_compid9_0_0_
from
log_return_email logreturne0_
where
logreturne0_.id=?
LogReturnEmail [createDtm=, fileName=, forwardResult=, forwardTo=, id=f6a70923-973a-47ac-98a0-34200d4ddacb, mailSubject=, messageNo=, messageType=, sellerCompid=]
2019-05-30 09:12:54.079 INFO 13668 --- [ Thread-10] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2019-05-30 09:12:54.080 INFO 13668 --- [ Thread-10] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2019-05-30 09:12:54.088 INFO 13668 --- [ Thread-10] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
TABLE COLUMN NAME
ID
SELLER_COMPID
MESSAGE_NO
MAIL_SUBJECT
CREATE_DTM
FORWARD_TO
FORWARD_RESULT
FILE_NAME
MESSAGE_TYPE
Verify your Java Entity class datatypes and Oracle DATA_TYPE. This issue mostly occurs when data type mismatch.

HikariPool-1 - Driver does not support get/set network timeout for connections. (com.mysql.jdbc.JDBC4Connection.getNetworkTimeout()I)

i,m creating a simple maven project with spring boot and hibernate and i want to create my table in mysqlDB with hibernate.when i run my spring application its not creating my table and i have no error but title massage will appear and i think this is the cause of my problem
`2019-05-31 14:02:54.781 INFO 25517 --- [ restartedMain] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Driver does not support get/set network timeout for connections. (com.mysql.jdbc.JDBC4Connection.getNetworkTimeout()I)`
pom.xml:
`<?xml version="1.0" encoding="UTF-8"?>
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
<groupId>Example</groupId>
<artifactId>Example</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.5.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
<version>2.0.0.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<version>2.0.0.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.12.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>javax.transaction-api</artifactId>
<version>1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>2.0.1.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>5.0.1.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.16</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
</dependencies>
`
application.properties:
spring.jpa.hibernate.ddl-auto=create-drop
spring.datasource.url=jdbc:mysql://localhost:3306/test
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.show-sql=true
spring.datasource.password=dani861
spring.datasource.username=root
spring.jooq.sql-dialect=org.hibernate.dialect.MySQLDialect
RUN:
2019-05-31 14:35:54.116 INFO 26667 --- [ restartedMain] c.e.configuration.SpringConfiguration : Starting SpringConfiguration on Daniyal with PID 26667 (/home/daniyal/IdeaProjects/Example/target/classes started by daniyal in /home/daniyal/IdeaProjects/Example)
2019-05-31 14:35:54.119 INFO 26667 --- [ restartedMain] c.e.configuration.SpringConfiguration : No active profile set, falling back to default profiles: default
2019-05-31 14:35:54.164 INFO 26667 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2019-05-31 14:35:54.165 INFO 26667 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2019-05-31 14:35:54.848 INFO 26667 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-05-31 14:35:54.869 INFO 26667 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 14ms. Found 0 repository interfaces.
2019-05-31 14:35:55.259 INFO 26667 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$4830e052] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-05-31 14:35:55.598 INFO 26667 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2019-05-31 14:35:55.631 INFO 26667 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-05-31 14:35:55.631 INFO 26667 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.19]
2019-05-31 14:35:55.715 INFO 26667 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-05-31 14:35:55.715 INFO 26667 --- [ restartedMain] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1550 ms
2019-05-31 14:35:55.868 INFO 26667 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2019-05-31 14:35:56.075 INFO 26667 --- [ restartedMain] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Driver does not support get/set network timeout for connections. (com.mysql.jdbc.JDBC4Connection.getNetworkTimeout()I)
2019-05-31 14:35:56.077 INFO 26667 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2019-05-31 14:35:56.117 INFO 26667 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2019-05-31 14:35:56.163 INFO 26667 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.2.12.Final}
2019-05-31 14:35:56.164 INFO 26667 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000205: Loaded properties from resource hibernate.properties: {jdbc.url=jdbc:mysql://localhost/3306/test, hibernate.dialect=org.hibernate.dialect.H2Dialect, hibernate.show_sql=true, jdbc.user=root, hibernate.bytecode.use_reflection_optimizer=false, hibernate.hbm2ddl.auto=create-drop, jdbc.driverClassName=org.h2.Driver, jdbc.pass=dani861}
2019-05-31 14:35:56.192 INFO 26667 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2019-05-31 14:35:56.282 INFO 26667 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2019-05-31 14:35:56.306 INFO 26667 --- [ restartedMain] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
2019-05-31 14:35:56.454 INFO 26667 --- [ restartedMain] o.h.t.schema.internal.SchemaCreatorImpl : HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl#cf13b9f'
2019-05-31 14:35:56.456 INFO 26667 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2019-05-31 14:35:56.473 INFO 26667 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2019-05-31 14:35:56.680 INFO 26667 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-05-31 14:35:56.717 WARN 26667 --- [ 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
2019-05-31 14:35:56.957 INFO 26667 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2019-05-31 14:35:56.960 INFO 26667 --- [ restartedMain] c.e.configuration.SpringConfiguration : Started SpringConfiguration in 3.121 seconds (JVM running for 3.414)
Looking at your log, it seems to me that hibernate is using properties from hibernate.properties
2019-05-31 14:35:56.164 INFO 26667 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000205: Loaded properties from resource hibernate.properties: {jdbc.url=jdbc:mysql://localhost/3306/test, hibernate.dialect=org.hibernate.dialect.H2Dialect, hibernate.show_sql=true, jdbc.user=root, hibernate.bytecode.use_reflection_optimizer=false, hibernate.hbm2ddl.auto=create-drop, jdbc.driverClassName=org.h2.Driver, jdbc.pass=dani861}
This line is showing that it's trying to use the H2 Database as driver and dialect.
In your pom.xml, you are declaring all de dependencies to spring data jpa e hibernate but using spring boot it makes more sense if you use the spring-boot-starter-jpa dependency. It provides auto-configuration classes to help you.
Take a look at this guide: Link
I solved it using :
pom
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<scope>runtime</scope>
</dependency>
yaml config
spring:
datasource:
driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
log :
com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.

spring boot app shutting down without error

I am running a spring boot application with mysql, web, jpa as dependencies. I have configured the application.properties file with the database properties. The log is attached for more details below:
2018-08-16 10:02:00.746 INFO 10472 --- [ restartedMain] com.classpath.CrudApplication : Starting CrudApplication on LAPTOP-MAI0FJBD with PID 10472 (C:\Users\classpath\packt\Downloads\crud\target\classes started by classpath in C:\Users\classpath\packt\Downloads\crud)
2018-08-16 10:02:00.748 INFO 10472 --- [ restartedMain] com.classpath.CrudApplication : No active profile set, falling back to default profiles: default
2018-08-16 10:02:00.876 INFO 10472 --- [ restartedMain] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#17bd80f6: startup date [Thu Aug 16 10:02:00 IST 2018]; root of context hierarchy
2018-08-16 10:02:02.107 INFO 10472 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$437af157] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-08-16 10:02:02.370 INFO 10472 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2018-08-16 10:02:02.572 INFO 10472 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2018-08-16 10:02:02.602 INFO 10472 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2018-08-16 10:02:02.616 INFO 10472 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2018-08-16 10:02:02.670 INFO 10472 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.2.17.Final}
2018-08-16 10:02:02.671 INFO 10472 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2018-08-16 10:02:02.708 INFO 10472 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2018-08-16 10:02:02.847 INFO 10472 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
2018-08-16 10:02:03.377 INFO 10472 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2018-08-16 10:02:04.183 INFO 10472 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2018-08-16 10:02:04.206 INFO 10472 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-08-16 10:02:04.207 INFO 10472 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'dataSource' has been autodetected for JMX exposure
2018-08-16 10:02:04.210 INFO 10472 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Located MBean 'dataSource': registering with JMX server as MBean [com.zaxxer.hikari:name=dataSource,type=HikariDataSource]
2018-08-16 10:02:04.221 INFO 10472 --- [ restartedMain] com.classpath.CrudApplication : Started CrudApplication in 3.814 seconds (JVM running for 4.411)
2018-08-16 10:02:04.225 INFO 10472 --- [ Thread-10] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext#17bd80f6: startup date [Thu Aug 16 10:02:00 IST 2018]; root of context hierarchy
2018-08-16 10:02:04.228 INFO 10472 --- [ Thread-10] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
2018-08-16 10:02:04.228 INFO 10472 --- [ Thread-10] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans
2018-08-16 10:02:04.229 INFO 10472 --- [ Thread-10] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2018-08-16 10:02:04.230 INFO 10472 --- [ Thread-10] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2018-08-16 10:02:04.233 INFO 10472 --- [ Thread-10] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
Process finished with exit code 0
I have created the git repository and uploaded my code onto Github - Link to Github repo
I am also attaching the pom.xml for reference
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.classpath</groupId>
<artifactId>crud</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>crud</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
How should I be debugging this error. Kindly let me know as there is lot of magic going on here.
The condition evaluation report in the application log shows that the embedded servlet container hasn't been configured as javax.servlet.ServletRequest is not on the classpath:
ServletWebServerFactoryAutoConfiguration:
Did not match:
- #ConditionalOnClass did not find required class 'javax.servlet.ServletRequest' (OnClassCondition)
It should be on the classpath as you have a dependency on spring-boot-starter-web which pulls in tomcat-embed-core that contains all of the Servlet API classes. The application log also shows that C:\Users\classpath\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.32\tomcat-embed-core-8.5.32.jar is on the classpath.
For the jar file to be on the classpath and a class that it contains not to be found, the jar file must be corrupted. This can happen when Maven downloads the jar. Try deleting the C:\Users\classpath\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.32\ directory and rebuilding your application. This will cause Maven to download a new copy of the jar and, hopefully, to not corrupt it this time.
Finally, I was able to solve this problem. I deleted the repository directory inside .m2 and build the whole project once again. This time, it worked.

Categories