Java Spring application build unsuccessful classpath error - java

I use Spring + jpa + mysql + tomcat for my configuration file pom.xml here:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</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>
After entity modelling, i build the application, but an error occured, which i could not figured out :)! But my tables have been properly generated after i added proper exclusions in pom.xml-file.
Here is the full error:
2021-07-01 01:21:44.632 INFO 17184 --- [ main] c.c.b.BuildingModelServiceApplication : No active profile set, falling back to default profiles: default
2021-07-01 01:21:45.887 INFO 17184 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-07-01 01:21:45.956 INFO 17184 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 60 ms. Found 1 JPA repository interfaces.
2021-07-01 01:21:46.504 INFO 17184 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2021-07-01 01:21:46.526 INFO 17184 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-07-01 01:21:46.526 INFO 17184 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.46]
2021-07-01 01:21:46.673 INFO 17184 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-07-01 01:21:46.673 INFO 17184 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1882 ms
2021-07-01 01:21:46.804 INFO 17184 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2021-07-01 01:21:47.228 INFO 17184 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2021-07-01 01:21:47.328 INFO 17184 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2021-07-01 01:21:47.428 INFO 17184 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.27.Final
2021-07-01 01:21:47.613 INFO 17184 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2021-07-01 01:21:47.744 INFO 17184 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
2021-07-01 01:21:48.731 INFO 17184 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2021-07-01 01:21:48.747 INFO 17184 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2021-07-01 01:21:48.916 INFO 17184 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2021-07-01 01:21:48.963 WARN 17184 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping]: Factory method 'requestMappingHandlerMapping' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.core.log.LogDelegateFactory.getHiddenLog(Ljava/lang/String;)Lorg/apache/commons/logging/Log;
2021-07-01 01:21:48.963 INFO 17184 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
2021-07-01 01:21:48.963 INFO 17184 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2021-07-01 01:21:48.963 INFO 17184 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2021-07-01 01:21:48.979 INFO 17184 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2021-07-01 01:21:48.994 INFO 17184 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2021-07-01 01:21:48.994 INFO 17184 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-07-01 01:21:49.016 ERROR 17184 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.web.servlet.handler.AbstractHandlerMapping.<init>(AbstractHandlerMapping.java:83)
The following method did not exist:
org.springframework.core.log.LogDelegateFactory.getHiddenLog(Ljava/lang/String;)Lorg/apache/commons/logging/Log;
The method's class, org.springframework.core.log.LogDelegateFactory, is available from the following locations:
jar:file:/C:/Users/user/Desktop/DevOps/Project/my_model_service/lib/spring-core-5.3.3.jar!/org/springframework/core/log/LogDelegateFactory.class
jar:file:/C:/Users/user/.m2/repository/org/springframework/spring-core/5.3.8/spring-core-5.3.8.jar!/org/springframework/core/log/LogDelegateFactory.class
The class hierarchy was loaded from the following locations:
org.springframework.core.log.LogDelegateFactory: file:/C:/Users/user/Desktop/DevOps/Project/my_model_service/lib/spring-core-5.3.3.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.core.log.LogDelegateFactory
Process finished with exit code 1
Hopefully somebody can figure it out, thanks, i will vote up each constructive answer!

I got the error, it was on the version of the spring-boot-starter-parent. I had before the version 2.5.2, now it works with the version 2.4.2.
Here the updated part of the pom.xml:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
Now no error anymore:
2021-07-01 09:11:03.768 INFO 12576 --- [ main] c.c.b.BuildingModelServiceApplication : No active profile set, falling back to default profiles: default
2021-07-01 09:11:04.931 INFO 12576 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-07-01 09:11:04.988 INFO 12576 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 48 ms. Found 1 JPA repository interfaces.
2021-07-01 09:11:05.613 INFO 12576 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2021-07-01 09:11:05.624 INFO 12576 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-07-01 09:11:05.624 INFO 12576 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.41]
2021-07-01 09:11:05.753 INFO 12576 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-07-01 09:11:05.754 INFO 12576 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1913 ms
2021-07-01 09:11:05.939 INFO 12576 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2021-07-01 09:11:05.984 INFO 12576 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.27.Final
2021-07-01 09:11:06.127 INFO 12576 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2021-07-01 09:11:06.259 INFO 12576 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2021-07-01 09:11:06.569 INFO 12576 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2021-07-01 09:11:06.591 INFO 12576 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
2021-07-01 09:11:07.629 INFO 12576 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2021-07-01 09:11:07.637 INFO 12576 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2021-07-01 09:11:07.899 INFO 12576 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2021-07-01 09:11:08.457 INFO 12576 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2021-07-01 09:11:08.468 INFO 12576 --- [ main] c.c.b.BuildingModelServiceApplication : Started BuildingModelServiceApplication in 5.239 seconds (JVM running for 7.113)
Thanks for your help, it was a version problem as #Jean Picard said, but the appropriate version was 2.4.2!

This method : org.springframework.core.log.LogDelegateFactory.getHiddenLog(Ljava/lang/String;) was added in spring-core-5.3.5 and spring-core-5.3.3 is loaded.
You'll need to use spring-boot with version 2.4.4+ for spring-core-5.3.5, can you check if all your spring-boot dependencies and plugin are on the same version ?

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.

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.

Cant reach Endpoint in Controller, despite it beeing intialised

I read this
and this
The main ideas are that somebody has the wrong structure and components are not beeing scanned, I have a correct one.
My controller is beeing initialised normaly. I tested it debugging and seting the breakpoint on the contructor. It is beiing runned. DEspite of the that the endpoint could not be reached by my tests nor by postman, nor in the browser. I am getting a 404.
I am using gradle. structured my code like this. Already spent 3 Hours trying to fix this, but without success.
My controller looks like this.
package com.fressnapf.microservices.orderhistory.controller.impl;
#RestController
#RequestMapping("/customer")
public class OrderHistoryController implements IOrderHistoryController {
...
#Override
#ResponseStatus(value = HttpStatus.OK)
#RequestMapping(value = "/{customerid}/orders}", method = RequestMethod.GET, produces = "application/json")
public String getOrders(#PathVariable("customerid") String customerid, #RequestParam(required = false) String timeFrom,
#RequestParam(required = false) String timeTo, #RequestParam(required = false) String openOnly) {
...
}
}
Aplplication class
package com.fressnapf.microservices.orderhistory;
#SpringBootApplication()
#ImportResource({"classpath*:applicationContext.xml"})
#Configuration()
public class Application {
public static void main(String[] args) {
ApplicationContext ctx = SpringApplication.run(Application.class, args);
}
}
this is the response I am getting
{
"timestamp": "2020-03-03T16:00:33.489+0000",
"status": 404,
"error": "Not Found",
"message": "No message available",
"path": "/customer/000000000/orders"
}
this is the log I am getting in the app
2020-03-03 16:59:27.595 INFO 10406 --- [ main] c.f.m.orderhistory.Application : Starting Application on debian-sgtechedge with PID 10406 (/home/sergeygerodes/projects/scporderhistoryservice/build/classes/java/main started by sgerodes in /home/sergeygerodes/projects/scporderhistoryservice)
2020-03-03 16:59:27.602 INFO 10406 --- [ main] c.f.m.orderhistory.Application : No active profile set, falling back to default profiles: default
2020-03-03 16:59:28.414 INFO 10406 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2020-03-03 16:59:28.441 INFO 10406 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 16ms. Found 0 JPA repository interfaces.
2020-03-03 16:59:28.768 INFO 10406 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-03-03 16:59:29.035 INFO 10406 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2020-03-03 16:59:29.046 INFO 10406 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-03-03 16:59:29.047 INFO 10406 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.29]
2020-03-03 16:59:29.140 INFO 10406 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-03-03 16:59:29.140 INFO 10406 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1475 ms
2020-03-03 16:59:29.294 INFO 10406 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2020-03-03 16:59:29.405 INFO 10406 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2020-03-03 16:59:29.424 INFO 10406 --- [ main] o.s.b.a.h2.H2ConsoleAutoConfiguration : H2 console available at '/h2-console'. Database available at 'jdbc:h2:mem:orderhistory'
2020-03-03 16:59:29.517 INFO 10406 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2020-03-03 16:59:29.565 INFO 10406 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.4.9.Final}
2020-03-03 16:59:29.660 INFO 10406 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
2020-03-03 16:59:29.741 INFO 10406 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2020-03-03 16:59:29.886 INFO 10406 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2020-03-03 16:59:29.892 INFO 10406 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2020-03-03 17:00:28.614 WARN 10406 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=59s108ms538?s586ns).
2020-03-03 17:00:28.685 WARN 10406 --- [ 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
2020-03-03 17:00:28.845 INFO 10406 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-03-03 17:00:29.052 INFO 10406 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2020-03-03 17:00:29.060 INFO 10406 --- [ main] c.f.m.orderhistory.Application : Started Application in 61.937 seconds (JVM running for 62.493)
2020-03-03 17:00:33.395 INFO 10406 --- [nio-8080-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-03-03 17:00:33.395 INFO 10406 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2020-03-03 17:00:33.404 INFO 10406 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Completed initialization in 9 ms
the whole applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="loggerService"
class="com.fressnapf.sdk.logger.service.impl.DefaultLogService" />
<bean id="dataService"
class="com.fressnapf.sdk.dataaccess.services.impl.H2DataProvider">
<constructor-arg index="0" value="${spring.datasource.url}"/>
<constructor-arg index="1" value="${spring.datasource.username}"/>
<constructor-arg index="2" value="${spring.datasource.password}"/>
</bean>
</beans>
If you copied your controller code and pasted it here...
There is a close bracket too much. I tested it on one of my controllers and it shows the same behaviour.
#RequestMapping(value = "/{customerid}/orders-->}<--"...

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.

Categories