Spring boot and JPA - javax.persistence.spi::No valid providers found - spring-boot

I am using Spring Boot for my application and try to access an MS SQL database through JPA.
But I am getting an error javax.persistence.spi::No valid providers found.
I added the necessary libs in dependencies:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<!--<version>2.4.13</version>-->
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
And I also used configuration in application.yaml
spring:
datasource:
url: jdbc:sqlserver://DEV\SQLLOKAL;databaseName=myDB
username: myDBUser
password: myDBPass
jpa:
properties:
hibernate:
dialect: org.hibernate.dialect.SQLServerDialect
hibernate:
ddl-auto: validate
show-sql: true
Is there any kind of more configuration missing? Or more dependencies?

Related

How to connect to Database with Spring Boot application.yml

I have the PostgreSQL Database called db.
And here is my application.yml
spring:
jpa:
database: postgresql
show-sql: true
hibernate:
ddl-auto: create-drop
datasource:
schema: classpath:/schema.sql
platform: postgres
url: jdbc:postgresql://localhost:5432/db
username: postgres
password: postgres
driverClassName: org.postgresql.Driver
When I run my project, nothing happens, no errors and sure schema.sql that has a script for creating a table also does not work.
I have these dependencies in my pom.xml
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
I don't understand why nothing happens even with no errors.
I hope for your help.

SpringBoot JPA save in Impala

I develop a web service whit springboot and I need it save some info in my impala database.
I searching about save in impala and I only find how to use the JDBC.
Someone know if I can use spring boot and spring jpa to save data in impala?
My .yml
server:
port: 8080
spring:
config:
name: **
cloud:
loadbalancer:
ribbon:
enable: false
datasource:
url: jdbc:impala://...
username: ...
password: ...
driver-class-name: io.opentracing.contrib.jdbc.TracingDriver (I think this is not the correct but i find another)
My pom.xml
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
</dependency>
<dependency>
<groupId>com.cloudera.impala.jdbc</groupId>
<artifactId>ImpalaJDBC41</artifactId>
<version>2.6.4.1005</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>es.caser.archit.spring</groupId>
<artifactId>db-caf-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>es.caser.archit.spring</groupId>
<artifactId>rest-caf-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>es.caser.archit.spring</groupId>
<artifactId>test-caf-boot-starter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>es.caser.archit.spring</groupId>
<artifactId>security-caf-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies>
Thanks :D
The driver class name should be
driverClassName: org.apache.hive.jdbc.HiveDriver
And use this dependency
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-jdbc</artifactId>
<version>3.1.2</version>
</dependency>

Spring Boot on Appengine standard doesn't start

I created a simple ( and almost empty ) spring boot project, I packaged into a jar and I deployed it on appengine.
But it doesn't start!
When I run https://.appspot.com I Have a 500 error page
I saw the database was created and the tables too, but there is something wrong into application
These are the last few lines of the log
Started VibesCoreApplication in 9.729 seconds (JVM running for 11.147)
Shutting down ExecutorService 'taskScheduler'
Closing JPA EntityManagerFactory for persistence unit 'default'
HikariPool-1 - Shutdown initiated...
HikariPool-1 - Shutdown completed.
this is a part of the pom file
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<!-- for GAE -->
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- for GAE -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-sqladmin</artifactId>
<version>v1beta4-rev76-1.25.0</version>
</dependency>
<dependency>
<groupId>com.google.cloud.sql</groupId>
<artifactId>mysql-socket-factory</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.23.0</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gcp-starter</artifactId>
<version>LATEST</version>
</dependency>
<!-- JPA -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>2.1.4.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-jdbc -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<version>2.2.2.RELEASE</version>
</dependency>
<!-- MySQL -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.17</version>
<scope>runtime</scope>
</dependency>
</dependencies>
this is the app.yaml file
runtime: java11
instance_class: F2
env: standard
network:
session_affinity: true
entrypoint: java -Xmx64m -jar target/vibes-core-0.4.0.jar
handlers:
- url: /(.*\.(gif|png|jpg|js|css|env))$
static_files: static/\1
upload: static/.*\.(gif|png|jpg)$
here there is the full logs
I was able to find a similar issue with yours here. The fact is that ( even this should not happen ) the configuration loading order may be broken.
In the post that I have sent you, the solution was removing the #EnableAutoConfiguration annotation.

Zipkin data not able to persist in Elastic search

I am having problem persisting the zipkin data. I did not get any error message. So I am sharing configuration to get a help.
I can see my logs in zipkin UI, but not able to persist in elastic search.
My zipkin-service pom file shared below.
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-ui</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-rabbit</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-storage-elasticsearch-http</artifactId>
<version>2.0.0</version>
</dependency>
<!-- add the dependency for elasticsearch via http -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
And my properties looks like this
spring:
profiles: local
rabbitmq:
host: ${RABBIT_HOST:localhost}
username: test
password: test
zipkin:
storage:
type: elasticsearch
elasticsearch:
jest:
uris: http://localhost:9200

Spring Cloud turbine - No data returned from /turbine.stream

My techstack comprises of the following
Eureka Discovery server
Zuul Gateway
Spring Config server
Hystrix Dashboard
My core services that has Hystrix stream enabled.
Hystrix dashboard is working fine as I am able to stream using the hystrics.stream exposed out of my services.
However, whenever I try to add turbine to this stack, the /turbine.stream only returns data: {"type":"Ping"} repeatedly on the browser and as a result Hystrix dashboard shows Unable to connect to Command Metric Stream
Can someone please assist me to find out where I am going wrong?
Here are my key configurations for turbine. The TurbineAppliation class is just a springboot app with #EnableTurbineStream so not listing it down below.
pom dependencies:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.1.RELEASE</version>
</parent>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Camden.SR5</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-turbine-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rabbit</artifactId>
</dependency>
</dependencies>
bootstrap.yml: (Please ignore eureka specific config if it does not matter as I have not tuned them myself). The config server and eureka settings are same for all the other components which are working just fine.
spring:
application:
name: Turbine
cloud:
config:
enabled: true
discovery:
enabled: true
serviceId: ConfigServer
management:
security:
enabled: false
eureka:
instance:
leaseRenewalIntervalInSeconds: 10
# leaseExpirationDurationInSeconds: 2
preferIpAddress: true
ipAddress: 127.0.0.1
client:
serviceUrl:
defaultZone: http://localhost:8761/discovery/eureka/ ---discovery is my eureka context root required for my app
application.yml
server:
port: 7980
info:
component: Turbine App
turbine:
aggregator:
clusterConfig: MY-SERVICE
appConfig: MY-SERVICE
clusterNameExpression: new String('default')
InstanceMonitor:
eventStream:
skipLineLogic:
enabled: false
Hi I am dealing with the same problem using Camden.SR6.
After adding following in Turbine Service pom.xml, I was able to use turbine stream in hystrix dashboard:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix-hystrix-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
Also I added : spring.rabbitmq.address=rabbit-mq-server:5672 to bootstrap.properties file.
With the new version of Spring Cloud Camden SR5 the rabbitMQ queue renamed from springCloudHystrixStream to turbineStreamInput.
As a workaround you can specify the previous version of spring-cloud-stream.
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream</artifactId>
<version>1.1.0.RELEASE</version>
</dependency>
Use for turbine app in your pom
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix</artifactId>
<version>1.3.0.M1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

Resources