简体   繁体   English

如何修复 org.postgresql.util.PSQLException:致命:用户密码验证失败

[英]How to fix org.postgresql.util.PSQLException: FATAL: password authentication failed for user

I have the following persistence.xml file:我有以下persistence.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">

    <persistence-unit name="NewPersistenceUnit" transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
        <class>models.Meeting</class>
        <class>models.Person</class>
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL10Dialect"/>
            <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/java_lab4"/>
            <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver"/>
            <property name="javax.persistence.jdbc.username" value="postgres"/>
            <property name="javax.persistence.jdbc.password" value="admin"/>
        </properties>
    </persistence-unit>
</persistence>

Pretty sure it should work but when running a basic app, I keep getting很确定它应该可以工作,但是在运行基本应用程序时,我不断收到

Caused by: org.hibernate.exception.GenericJDBCException: Error calling Driver#connect
    at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
    at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.convertSqlException(BasicConnectionCreator.java:118)
    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:331)
    at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.<init>(DriverManagerConnectionProviderImpl.java:250)
    at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.<init>(DriverManagerConnectionProviderImpl.java:228)
    at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections$Builder.build(DriverManagerConnectionProviderImpl.java:369)
    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:145)
    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)
    ... 15 more
Caused by: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "Mihnea"

However, that user is not my postgres user.但是,该用户不是我的 postgres 用户。 That is my computer user!那是我的电脑用户! How should I disable this error?我应该如何禁用此错误? What should I do?我该怎么办?

Try to correct this:尝试纠正这个:

<property name="javax.persistence.jdbc.username" value="postgres"/>

to this:对此:

<property name="javax.persistence.jdbc.user" value="postgres" />

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 org.postgresql.util.PSQLException: FATAL: 用户 springboot maven 项目的密码验证失败 - org.postgresql.util.PSQLException: FATAL: password authentication failed for user springboot maven project 引起:org.postgresql.util.PSQLException:致命:用户“admin”的密码验证失败 - Caused by: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "admin" org.postgresql.util.PSQLException:致命:数据库“pma-springbootdb” - org.postgresql.util.PSQLException: FATAL: database “pma-springbootdb” org.postgresql.util.PSQLException:致命:数据库“ postgres&gt;”不存在 - org.postgresql.util.PSQLException: FATAL: database “postgres>” does not exist org.postgresql.util.PSQLException:服务器请求基于 SCRAM 的身份验证,但未提供密码 - org.postgresql.util.PSQLException: The server requested SCRAM-based authentication, but no password was provided org.postgresql.util.PSQLException:连接尝试失败 - org.postgresql.util.PSQLException: The connection attempt failed ClassNotFoundException:org.postgresql.util.PSQLException - ClassNotFoundException: org.postgresql.util.PSQLException org.postgresql.util.PSQLException - 2019 - org.postgresql.util.PSQLException - 2019 引起:org.postgresql.util.PSQLException:致命:剩余的连接槽是为非复制超级用户连接保留的 - Caused by: org.postgresql.util.PSQLException: FATAL: remaining connection slots are reserved for non-replication superuser connections org.postgresql.util.PSQLException:致命:主机没有pg_hba.conf条目 - org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM