Mysql 问题,无法解决,谁能帮忙,我正在使用 java
Mysql problem ,cant resolve it, cant somebody help, i using java
Yoo coderrs,连接和写入 table 到我的在线免费数据库时遇到问题。问题出在Unable to create requested service
和Unable to make JDBC Connection
"C:\Users\myhome\.jdks\openjdk-17.0.1\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Educational Edition 2021.2.3\lib\idea_rt.jar=56594:C:\Program Files\JetBrains\IntelliJ IDEA Educational Edition 2021.2.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\Users\Patrik Severín\IdeaProjects\untitled\jpa\target\classes;C:\Users\Patrik Severín\.m2\repository\org\hibernate\hibernate-core.6.3.Final\hibernate-core-5.6.3.Final.jar;C:\Users\Patrik Severín\.m2\repository\org\jboss\logging\jboss-logging.4.2.Final\jboss-logging-3.4.2.Final.jar;C:\Users\Patrik Severín\.m2\repository\net\bytebuddy\byte-buddy.11.20\byte-buddy-1.11.20.jar;C:\Users\Patrik Severín\.m2\repository\antlr\antlr.7.7\antlr-2.7.7.jar;C:\Users\Patrik Severín\.m2\repository\org\jboss\spec\javax\transaction\jboss-transaction-api_1.2_spec.1.1.Final\jboss-transaction-api_1.2_spec-1.1.1.Final.jar;C:\Users\Patrik Severín\.m2\repository\org\jboss\jandex.2.3.Final\jandex-2.2.3.Final.jar;C:\Users\Patrik Severín\.m2\repository\com\fasterxml\classmate.5.1\classmate-1.5.1.jar;C:\Users\Patrik Severín\.m2\repository\javax\activation\javax.activation-api.2.0\javax.activation-api-1.2.0.jar;C:\Users\Patrik Severín\.m2\repository\org\hibernate\common\hibernate-commons-annotations.1.2.Final\hibernate-commons-annotations-5.1.2.Final.jar;C:\Users\Patrik Severín\.m2\repository\javax\xml\bind\jaxb-api.3.1\jaxb-api-2.3.1.jar;C:\Users\Patrik Severín\.m2\repository\org\glassfish\jaxb\jaxb-runtime.3.1\jaxb-runtime-2.3.1.jar;C:\Users\Patrik Severín\.m2\repository\org\glassfish\jaxb\txw2.3.1\txw2-2.3.1.jar;C:\Users\Patrik Severín\.m2\repository\com\sun\istack\istack-commons-runtime.0.7\istack-commons-runtime-3.0.7.jar;C:\Users\Patrik Severín\.m2\repository\org\jvnet\staxex\stax-ex.8\stax-ex-1.8.jar;C:\Users\Patrik Severín\.m2\repository\com\sun\xml\fastinfoset\FastInfoset.2.15\FastInfoset-1.2.15.jar;C:\Users\Patrik Severín\.m2\repository\mysql\mysql-connector-java.0.28\mysql-connector-java-8.0.28.jar;C:\Users\Patrik Severín\.m2\repository\com\google\protobuf\protobuf-java.11.4\protobuf-java-3.11.4.jar;C:\Users\Patrik Severín\.m2\repository\javax\persistence\javax.persistence-api.2\javax.persistence-api-2.2.jar" sk.hibernate.App
jan 28, 2022 10:05:46 AM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
INFO: HHH000204: Processing PersistenceUnitInfo [name: sk.hibernate]
jan 28, 2022 10:05:46 AM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate ORM core version 5.6.3.Final
jan 28, 2022 10:05:46 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
jan 28, 2022 10:05:46 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
jan 28, 2022 10:05:46 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001005: using driver [com.mysql.cj.jdbc.Driver] at URL [mysql://****************:******************@bkt9ucjj52rre9ut1cix-mysql.services.clever-cloud.com:3306/bkt9ucjj52rre9ut1cix]
jan 28, 2022 10:05:46 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001001: Connection properties: {password=****, user=ujfnz0sxud23qruy}
jan 28, 2022 10:05:46 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001003: Autocommit mode: false
jan 28, 2022 10:05:46 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections <init>
INFO: HHH000115: Hibernate connection pool size: 20 (min=1)
Exception in thread "main" org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:275)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:175)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:173)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:127)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1460)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1494)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:56)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
at sk.hibernate.App.main(App.java:15)
Caused by: org.hibernate.HibernateException: Unable to make JDBC Connection [mysql://ujfnz0sxud23qruy:lqoN4PMPxWAAUjNEKuv8@bkt9ucjj52rre9ut1cix-mysql.services.clever-cloud.com:3306/bkt9ucjj52rre9ut1cix]
at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.createConnection(BasicConnectionCreator.java:60)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.addConnections(DriverManagerConnectionProviderImpl.java:409)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.<init>(DriverManagerConnectionProviderImpl.java:275)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.<init>(DriverManagerConnectionProviderImpl.java:249)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections$Builder.build(DriverManagerConnectionProviderImpl.java:453)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildPool(DriverManagerConnectionProviderImpl.java:98)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:73)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:107)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:246)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.buildJdbcConnectionAccess(JdbcEnvironmentInitiator.java:146)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:66)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
... 14 more
1班
包裹 sk.hibernate;
import sk.hibernate.model.Message;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
public class App
{
public static void main( String[] args ){
EntityManagerFactory entityManagerFactory =
Persistence.createEntityManagerFactory("sk.hibernate");
EntityManager entityManager = entityManagerFactory.createEntityManager();
entityManager.getTransaction().begin();
entityManager.persist(new Message("Prva sprava"));
entityManager.persist(new Message("Druha sprava"));
entityManager.getTransaction().commit();
entityManager.close();
}
}
2.class
package sk.hibernate.model;
import javax.persistence.*;
import java.util.Date;
@Entity
public class Message {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY )
// @Column(name = "ID")
private Long id;
// @Column(name = "MESSAGE")
private String message;
private Date CREATE_DATE;
public Message() {
}
public Message(String message) {
this.message = message;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Date getCREATE_DATE() {
return CREATE_DATE;
}
public void setCREATE_DATE(Date CREATE_DATE) {
this.CREATE_DATE = CREATE_DATE;
}
}
persistence.xml
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.2"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd">
<persistence-unit name="sk.hibernate" transaction-type="RESOURCE_LOCAL">
<class>sk.hibernate.model.Message</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.jdbc.driver" value="com.mysql.cj.jdbc.Driver"/>
<property name="javax.persistence.jdbc.url" value="mysql://*****************:************************@bkt9ucjj52rre9ut1cix-mysql.services.clever-cloud.com:3306/bkt9ucjj52rre9ut1cix"/>
<property name="javax.persistence.jdbc.user" value="******"/>
<property name="javax.persistence.jdbc.password" value="****"/>
<property name = "hibernate.show_sql" value = "true" />
<property name = "hibernate.format_sql" value = "true" />
<!--<property name = "hibernate.hbm2ddl.auto" value = "update" />-->
</properties>
</persistence-unit>
</persistence>
POM
<?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>sk.hibernate</groupId>
<artifactId>jpa</artifactId>
<version>1.0-SNAPSHOT</version>
<name>jpa</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.6.3.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.28</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.persistence/javax.persistence-api -->
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project
*MYSQL_ADDON_DB="bkt9ucjj52rre9ut1cix"
MYSQL_ADDON_HOST="bkt9ucjj52rre9ut1cix-mysql.services.clever-cloud.com"
MYSQL_ADDON_PASSWORD="***"
MYSQL_ADDON_PORT="3306"
MYSQL_ADDON_URI="mysql://******************:***********************@bkt9ucjj52rre9ut1cix-mysql.services.clever-cloud.com:3306/bkt9ucjj52rre9ut1cix"
MYSQL_ADDON_USER="****"
MYSQL_ADDON_VERSION="8.0"*
我刚刚使用以下 URL 访问了您的数据库:
jdbc:mysql://******************:******************@bkt9ucjj52rre9ut1cix-mysql.services.clever-cloud.com:3306/bkt9ucjj52rre9ut1cix
(我屏蔽了凭据)。所以你错过了前缀 "jdbc:"
您现在应该快速更改您的用户名和密码。您不希望所有 Internet 都可以访问,对吗?我想有人可能已经重命名了您的一张桌子...
哦,代我向 Patrik Severín 打个招呼,好吗? ;-)
"C:\Users\Patrik Severín\.jdks\openjdk-17.0.1\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Educational Edition 2021.2.3\lib\idea_rt.jar=54133:C:\Program Files\JetBrains\IntelliJ IDEA Educational Edition 2021.2.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\Users\Patrik Severín\IdeaProjects\untitled\jpa\target\classes;C:\Users\Patrik Severín\.m2\repository\org\hibernate\hibernate-core.6.4.Final\hibernate-core-5.6.4.Final.jar;C:\Users\Patrik Severín\.m2\repository\org\jboss\logging\jboss-logging.4.3.Final\jboss-logging-3.4.3.Final.jar;C:\Users\Patrik Severín\.m2\repository\net\bytebuddy\byte-buddy.12.7\byte-buddy-1.12.7.jar;C:\Users\Patrik Severín\.m2\repository\antlr\antlr.7.7\antlr-2.7.7.jar;C:\Users\Patrik Severín\.m2\repository\org\jboss\spec\javax\transaction\jboss-transaction-api_1.2_spec.1.1.Final\jboss-transaction-api_1.2_spec-1.1.1.Final.jar;C:\Users\Patrik Severín\.m2\repository\org\jboss\jandex.4.2.Final\jandex-2.4.2.Final.jar;C:\Users\Patrik Severín\.m2\repository\com\fasterxml\classmate.5.1\classmate-1.5.1.jar;C:\Users\Patrik Severín\.m2\repository\javax\activation\javax.activation-api.2.0\javax.activation-api-1.2.0.jar;C:\Users\Patrik Severín\.m2\repository\org\hibernate\common\hibernate-commons-annotations.1.2.Final\hibernate-commons-annotations-5.1.2.Final.jar;C:\Users\Patrik Severín\.m2\repository\javax\xml\bind\jaxb-api.3.1\jaxb-api-2.3.1.jar;C:\Users\Patrik Severín\.m2\repository\org\glassfish\jaxb\jaxb-runtime.3.1\jaxb-runtime-2.3.1.jar;C:\Users\Patrik Severín\.m2\repository\org\glassfish\jaxb\txw2.3.1\txw2-2.3.1.jar;C:\Users\Patrik Severín\.m2\repository\com\sun\istack\istack-commons-runtime.0.7\istack-commons-runtime-3.0.7.jar;C:\Users\Patrik Severín\.m2\repository\org\jvnet\staxex\stax-ex.8\stax-ex-1.8.jar;C:\Users\Patrik Severín\.m2\repository\com\sun\xml\fastinfoset\FastInfoset.2.15\FastInfoset-1.2.15.jar;C:\Users\Patrik Severín\.m2\repository\mysql\mysql-connector-java.0.28\mysql-connector-java-8.0.28.jar;C:\Users\Patrik Severín\.m2\repository\com\google\protobuf\protobuf-java.11.4\protobuf-java-3.11.4.jar;C:\Users\Patrik Severín\.m2\repository\javax\persistence\javax.persistence-api.2\javax.persistence-api-2.2.jar;C:\Users\Patrik Severín\mysql-connector-java-8.0.28.jar" sk.hibernate.App
jan 29, 2022 10:39:07 AM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
INFO: HHH000204: Processing PersistenceUnitInfo [name: sk.jpa]
jan 29, 2022 10:39:07 AM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate ORM core version 5.6.4.Final
jan 29, 2022 10:39:07 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
jan 29, 2022 10:39:07 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
jan 29, 2022 10:39:07 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001005: using driver [com.mysql.cj.jdbc.Driver] at URL [jdbc:mysql://ujf***ud23qruy:lqoN4PMP**8@bkt9ucjj52rre9ut1cix-mysql.services.clever-cloud.com:3306/bkt9ucjj52rre9ut1cix]
jan 29, 2022 10:39:07 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001001: Connection properties: {password=****, user=ujfnz0sxud23qruy}
jan 29, 2022 10:39:07 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001003: Autocommit mode: false
jan 29, 2022 10:39:07 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections <init>
INFO: HHH000115: Hibernate connection pool size: 20 (min=1)
jan 29, 2022 10:39:08 AM org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator initiateService
WARN: HHH000342: Could not obtain connection to query metadata
java.lang.IllegalStateException: Cannot get a connection as the driver manager is not properly initialized
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.getConnection(DriverManagerConnectionProviderImpl.java:172)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:181)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:68)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:51)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:107)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:246)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.convertSqlException(BasicConnectionCreator.java:116)
at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:41)
at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.createConnection(BasicConnectionCreator.java:58)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.addConnections(DriverManagerConnectionProviderImpl.java:409)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.<init>(DriverManagerConnectionProviderImpl.java:275)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.<init>(DriverManagerConnectionProviderImpl.java:249)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections$Builder.build(DriverManagerConnectionProviderImpl.java:453)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildPool(DriverManagerConnectionProviderImpl.java:98)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:73)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:107)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:246)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.buildJdbcConnectionAccess(JdbcEnvironmentInitiator.java:146)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:66)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:175)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:173)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:127)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1460)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1494)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:56)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
at sk.hibernate.App.main(App.java:15)
Exception in thread "main" org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:275)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:51)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:107)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:246)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.convertSqlException(BasicConnectionCreator.java:116)
at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:41)
at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.createConnection(BasicConnectionCreator.java:58)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.addConnections(DriverManagerConnectionProviderImpl.java:409)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.<init>(DriverManagerConnectionProviderImpl.java:275)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.<init>(DriverManagerConnectionProviderImpl.java:249)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections$Builder.build(DriverManagerConnectionProviderImpl.java:453)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildPool(DriverManagerConnectionProviderImpl.java:98)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:73)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:107)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:246)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.buildJdbcConnectionAccess(JdbcEnvironmentInitiator.java:146)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:66)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:175)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:173)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:127)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1460)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1494)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:56)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
at sk.hibernate.App.main(App.java:15)
Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:100)
at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:54)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:138)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
... 37 more
Process finished with exit code 1
Yoo coderrs,连接和写入 table 到我的在线免费数据库时遇到问题。问题出在Unable to create requested service
和Unable to make JDBC Connection
"C:\Users\myhome\.jdks\openjdk-17.0.1\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Educational Edition 2021.2.3\lib\idea_rt.jar=56594:C:\Program Files\JetBrains\IntelliJ IDEA Educational Edition 2021.2.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\Users\Patrik Severín\IdeaProjects\untitled\jpa\target\classes;C:\Users\Patrik Severín\.m2\repository\org\hibernate\hibernate-core.6.3.Final\hibernate-core-5.6.3.Final.jar;C:\Users\Patrik Severín\.m2\repository\org\jboss\logging\jboss-logging.4.2.Final\jboss-logging-3.4.2.Final.jar;C:\Users\Patrik Severín\.m2\repository\net\bytebuddy\byte-buddy.11.20\byte-buddy-1.11.20.jar;C:\Users\Patrik Severín\.m2\repository\antlr\antlr.7.7\antlr-2.7.7.jar;C:\Users\Patrik Severín\.m2\repository\org\jboss\spec\javax\transaction\jboss-transaction-api_1.2_spec.1.1.Final\jboss-transaction-api_1.2_spec-1.1.1.Final.jar;C:\Users\Patrik Severín\.m2\repository\org\jboss\jandex.2.3.Final\jandex-2.2.3.Final.jar;C:\Users\Patrik Severín\.m2\repository\com\fasterxml\classmate.5.1\classmate-1.5.1.jar;C:\Users\Patrik Severín\.m2\repository\javax\activation\javax.activation-api.2.0\javax.activation-api-1.2.0.jar;C:\Users\Patrik Severín\.m2\repository\org\hibernate\common\hibernate-commons-annotations.1.2.Final\hibernate-commons-annotations-5.1.2.Final.jar;C:\Users\Patrik Severín\.m2\repository\javax\xml\bind\jaxb-api.3.1\jaxb-api-2.3.1.jar;C:\Users\Patrik Severín\.m2\repository\org\glassfish\jaxb\jaxb-runtime.3.1\jaxb-runtime-2.3.1.jar;C:\Users\Patrik Severín\.m2\repository\org\glassfish\jaxb\txw2.3.1\txw2-2.3.1.jar;C:\Users\Patrik Severín\.m2\repository\com\sun\istack\istack-commons-runtime.0.7\istack-commons-runtime-3.0.7.jar;C:\Users\Patrik Severín\.m2\repository\org\jvnet\staxex\stax-ex.8\stax-ex-1.8.jar;C:\Users\Patrik Severín\.m2\repository\com\sun\xml\fastinfoset\FastInfoset.2.15\FastInfoset-1.2.15.jar;C:\Users\Patrik Severín\.m2\repository\mysql\mysql-connector-java.0.28\mysql-connector-java-8.0.28.jar;C:\Users\Patrik Severín\.m2\repository\com\google\protobuf\protobuf-java.11.4\protobuf-java-3.11.4.jar;C:\Users\Patrik Severín\.m2\repository\javax\persistence\javax.persistence-api.2\javax.persistence-api-2.2.jar" sk.hibernate.App
jan 28, 2022 10:05:46 AM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
INFO: HHH000204: Processing PersistenceUnitInfo [name: sk.hibernate]
jan 28, 2022 10:05:46 AM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate ORM core version 5.6.3.Final
jan 28, 2022 10:05:46 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
jan 28, 2022 10:05:46 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
jan 28, 2022 10:05:46 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001005: using driver [com.mysql.cj.jdbc.Driver] at URL [mysql://****************:******************@bkt9ucjj52rre9ut1cix-mysql.services.clever-cloud.com:3306/bkt9ucjj52rre9ut1cix]
jan 28, 2022 10:05:46 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001001: Connection properties: {password=****, user=ujfnz0sxud23qruy}
jan 28, 2022 10:05:46 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001003: Autocommit mode: false
jan 28, 2022 10:05:46 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections <init>
INFO: HHH000115: Hibernate connection pool size: 20 (min=1)
Exception in thread "main" org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:275)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:175)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:173)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:127)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1460)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1494)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:56)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
at sk.hibernate.App.main(App.java:15)
Caused by: org.hibernate.HibernateException: Unable to make JDBC Connection [mysql://ujfnz0sxud23qruy:lqoN4PMPxWAAUjNEKuv8@bkt9ucjj52rre9ut1cix-mysql.services.clever-cloud.com:3306/bkt9ucjj52rre9ut1cix]
at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.createConnection(BasicConnectionCreator.java:60)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.addConnections(DriverManagerConnectionProviderImpl.java:409)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.<init>(DriverManagerConnectionProviderImpl.java:275)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.<init>(DriverManagerConnectionProviderImpl.java:249)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections$Builder.build(DriverManagerConnectionProviderImpl.java:453)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildPool(DriverManagerConnectionProviderImpl.java:98)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:73)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:107)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:246)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.buildJdbcConnectionAccess(JdbcEnvironmentInitiator.java:146)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:66)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
... 14 more
1班 包裹 sk.hibernate;
import sk.hibernate.model.Message;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
public class App
{
public static void main( String[] args ){
EntityManagerFactory entityManagerFactory =
Persistence.createEntityManagerFactory("sk.hibernate");
EntityManager entityManager = entityManagerFactory.createEntityManager();
entityManager.getTransaction().begin();
entityManager.persist(new Message("Prva sprava"));
entityManager.persist(new Message("Druha sprava"));
entityManager.getTransaction().commit();
entityManager.close();
}
}
2.class
package sk.hibernate.model;
import javax.persistence.*;
import java.util.Date;
@Entity
public class Message {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY )
// @Column(name = "ID")
private Long id;
// @Column(name = "MESSAGE")
private String message;
private Date CREATE_DATE;
public Message() {
}
public Message(String message) {
this.message = message;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Date getCREATE_DATE() {
return CREATE_DATE;
}
public void setCREATE_DATE(Date CREATE_DATE) {
this.CREATE_DATE = CREATE_DATE;
}
}
persistence.xml
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.2"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd">
<persistence-unit name="sk.hibernate" transaction-type="RESOURCE_LOCAL">
<class>sk.hibernate.model.Message</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.jdbc.driver" value="com.mysql.cj.jdbc.Driver"/>
<property name="javax.persistence.jdbc.url" value="mysql://*****************:************************@bkt9ucjj52rre9ut1cix-mysql.services.clever-cloud.com:3306/bkt9ucjj52rre9ut1cix"/>
<property name="javax.persistence.jdbc.user" value="******"/>
<property name="javax.persistence.jdbc.password" value="****"/>
<property name = "hibernate.show_sql" value = "true" />
<property name = "hibernate.format_sql" value = "true" />
<!--<property name = "hibernate.hbm2ddl.auto" value = "update" />-->
</properties>
</persistence-unit>
</persistence>
POM
<?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>sk.hibernate</groupId>
<artifactId>jpa</artifactId>
<version>1.0-SNAPSHOT</version>
<name>jpa</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.6.3.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.28</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.persistence/javax.persistence-api -->
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project
*MYSQL_ADDON_DB="bkt9ucjj52rre9ut1cix"
MYSQL_ADDON_HOST="bkt9ucjj52rre9ut1cix-mysql.services.clever-cloud.com"
MYSQL_ADDON_PASSWORD="***"
MYSQL_ADDON_PORT="3306"
MYSQL_ADDON_URI="mysql://******************:***********************@bkt9ucjj52rre9ut1cix-mysql.services.clever-cloud.com:3306/bkt9ucjj52rre9ut1cix"
MYSQL_ADDON_USER="****"
MYSQL_ADDON_VERSION="8.0"*
我刚刚使用以下 URL 访问了您的数据库:
jdbc:mysql://******************:******************@bkt9ucjj52rre9ut1cix-mysql.services.clever-cloud.com:3306/bkt9ucjj52rre9ut1cix
(我屏蔽了凭据)。所以你错过了前缀 "jdbc:"
您现在应该快速更改您的用户名和密码。您不希望所有 Internet 都可以访问,对吗?我想有人可能已经重命名了您的一张桌子...
哦,代我向 Patrik Severín 打个招呼,好吗? ;-)
"C:\Users\Patrik Severín\.jdks\openjdk-17.0.1\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Educational Edition 2021.2.3\lib\idea_rt.jar=54133:C:\Program Files\JetBrains\IntelliJ IDEA Educational Edition 2021.2.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\Users\Patrik Severín\IdeaProjects\untitled\jpa\target\classes;C:\Users\Patrik Severín\.m2\repository\org\hibernate\hibernate-core.6.4.Final\hibernate-core-5.6.4.Final.jar;C:\Users\Patrik Severín\.m2\repository\org\jboss\logging\jboss-logging.4.3.Final\jboss-logging-3.4.3.Final.jar;C:\Users\Patrik Severín\.m2\repository\net\bytebuddy\byte-buddy.12.7\byte-buddy-1.12.7.jar;C:\Users\Patrik Severín\.m2\repository\antlr\antlr.7.7\antlr-2.7.7.jar;C:\Users\Patrik Severín\.m2\repository\org\jboss\spec\javax\transaction\jboss-transaction-api_1.2_spec.1.1.Final\jboss-transaction-api_1.2_spec-1.1.1.Final.jar;C:\Users\Patrik Severín\.m2\repository\org\jboss\jandex.4.2.Final\jandex-2.4.2.Final.jar;C:\Users\Patrik Severín\.m2\repository\com\fasterxml\classmate.5.1\classmate-1.5.1.jar;C:\Users\Patrik Severín\.m2\repository\javax\activation\javax.activation-api.2.0\javax.activation-api-1.2.0.jar;C:\Users\Patrik Severín\.m2\repository\org\hibernate\common\hibernate-commons-annotations.1.2.Final\hibernate-commons-annotations-5.1.2.Final.jar;C:\Users\Patrik Severín\.m2\repository\javax\xml\bind\jaxb-api.3.1\jaxb-api-2.3.1.jar;C:\Users\Patrik Severín\.m2\repository\org\glassfish\jaxb\jaxb-runtime.3.1\jaxb-runtime-2.3.1.jar;C:\Users\Patrik Severín\.m2\repository\org\glassfish\jaxb\txw2.3.1\txw2-2.3.1.jar;C:\Users\Patrik Severín\.m2\repository\com\sun\istack\istack-commons-runtime.0.7\istack-commons-runtime-3.0.7.jar;C:\Users\Patrik Severín\.m2\repository\org\jvnet\staxex\stax-ex.8\stax-ex-1.8.jar;C:\Users\Patrik Severín\.m2\repository\com\sun\xml\fastinfoset\FastInfoset.2.15\FastInfoset-1.2.15.jar;C:\Users\Patrik Severín\.m2\repository\mysql\mysql-connector-java.0.28\mysql-connector-java-8.0.28.jar;C:\Users\Patrik Severín\.m2\repository\com\google\protobuf\protobuf-java.11.4\protobuf-java-3.11.4.jar;C:\Users\Patrik Severín\.m2\repository\javax\persistence\javax.persistence-api.2\javax.persistence-api-2.2.jar;C:\Users\Patrik Severín\mysql-connector-java-8.0.28.jar" sk.hibernate.App
jan 29, 2022 10:39:07 AM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
INFO: HHH000204: Processing PersistenceUnitInfo [name: sk.jpa]
jan 29, 2022 10:39:07 AM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate ORM core version 5.6.4.Final
jan 29, 2022 10:39:07 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
jan 29, 2022 10:39:07 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
jan 29, 2022 10:39:07 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001005: using driver [com.mysql.cj.jdbc.Driver] at URL [jdbc:mysql://ujf***ud23qruy:lqoN4PMP**8@bkt9ucjj52rre9ut1cix-mysql.services.clever-cloud.com:3306/bkt9ucjj52rre9ut1cix]
jan 29, 2022 10:39:07 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001001: Connection properties: {password=****, user=ujfnz0sxud23qruy}
jan 29, 2022 10:39:07 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001003: Autocommit mode: false
jan 29, 2022 10:39:07 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections <init>
INFO: HHH000115: Hibernate connection pool size: 20 (min=1)
jan 29, 2022 10:39:08 AM org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator initiateService
WARN: HHH000342: Could not obtain connection to query metadata
java.lang.IllegalStateException: Cannot get a connection as the driver manager is not properly initialized
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.getConnection(DriverManagerConnectionProviderImpl.java:172)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:181)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:68)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:51)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:107)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:246)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.convertSqlException(BasicConnectionCreator.java:116)
at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:41)
at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.createConnection(BasicConnectionCreator.java:58)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.addConnections(DriverManagerConnectionProviderImpl.java:409)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.<init>(DriverManagerConnectionProviderImpl.java:275)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.<init>(DriverManagerConnectionProviderImpl.java:249)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections$Builder.build(DriverManagerConnectionProviderImpl.java:453)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildPool(DriverManagerConnectionProviderImpl.java:98)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:73)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:107)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:246)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.buildJdbcConnectionAccess(JdbcEnvironmentInitiator.java:146)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:66)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:175)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:173)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:127)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1460)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1494)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:56)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
at sk.hibernate.App.main(App.java:15)
Exception in thread "main" org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:275)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:51)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:107)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:246)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.convertSqlException(BasicConnectionCreator.java:116)
at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:41)
at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.createConnection(BasicConnectionCreator.java:58)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.addConnections(DriverManagerConnectionProviderImpl.java:409)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.<init>(DriverManagerConnectionProviderImpl.java:275)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.<init>(DriverManagerConnectionProviderImpl.java:249)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections$Builder.build(DriverManagerConnectionProviderImpl.java:453)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildPool(DriverManagerConnectionProviderImpl.java:98)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:73)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:107)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:246)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.buildJdbcConnectionAccess(JdbcEnvironmentInitiator.java:146)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:66)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:175)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:173)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:127)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1460)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1494)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:56)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
at sk.hibernate.App.main(App.java:15)
Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:100)
at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:54)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:138)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
... 37 more
Process finished with exit code 1