postgresql - 错误检测数据库类型 : Cannot create PoolableConnectionFactory (FATAL: no pg_hba. conf

标签 postgresql tomcat configuration configuration-files context.xml

我正在使用 pgAdmin3 并使用 pkg 安装 postgreSQL 和 pg。 我正在尝试通过 tomcat 连接到 postgreSQL。当我从我的 tomcat/bin 目录执行 ./startup.sh 时,日志文件显示此错误:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'metaModelDAO' defined in class path resource [applicationContext-coreDataServices.xml]: Invocation of init method failed; nested exception is org.apache.cayenne.CayenneRuntimeException: [v.3.0.1.LB Nov 16 2011 05:24:11] Error detecting database type: Cannot create PoolableConnectionFactory (FATAL: no pg_hba.conf entry for host "10.0.0.197", user "abc_writer", database "abc", SSL off)

这是我的 context.xml 中的内容:

  <Context>
    <Resource username="abc_writer" password="levelsbeyond"  
              url="jdbc:postgresql://localhost:5432/abc"
             type="javax.sql.DataSource" name="jdbc/abc-workflow" 
             maxWait="10000" maxIdle="20" maxActive="50"
             driverClassName="org.postgresql.Driver" auth="Container" /> 
 </Context>

这是我的 pg_hba.config 的样子:

# TYPE  DATABASE        USER            ADDRESS                 METHOD
# "local" is for Unix domain socket connections only
local   all             all                                     md5
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                                md5
#host    replication     postgres        127.0.0.1/32            md5
#host    replication     postgres        ::1/128                 md5
host     abc     abc_writer        10.0.0.197      md5

当我从 postgresql/bin 打开 postmaster 时,它显示如下:

 localhost:~ bryanraymond$ /Library/PostgreSQL/9.3/bin/postgres ; exit;
 postgres cannot access the server configuration file    
 "/Library/PostgreSQL/9.3/data/postgresql.conf": Permission denied
 logout

它说我在 pg_hba.conf 中没有条目的原因是否是因为我没有权限,如果是,我如何获得权限?如果这不是问题,是不是我设置有误?

--- 谢谢,布莱恩

最佳答案

您的 pg_hba.conf 中有一行错误。应该是

主机 abc abc_writer 10.0.0.197/32 md5

注意“/32”。进行更改后,您将需要重新加载 Postgresql 配置(例如“pg_ctl reload”)。不过,我不确定“权限被拒绝”是什么意思。

关于postgresql - 错误检测数据库类型 : Cannot create PoolableConnectionFactory (FATAL: no pg_hba. conf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19284597/

相关文章:

postgresql - 使用环境变量配置 sails 应用程序以连接到 Heroku Postgres

python - 将 ManyToMany 转换为 ForeignKey (django)

spring-mvc - 用于 webapp 的独立 Tomcat 服务器

configuration - 防止创建配置文件

configuration - 使用 Chef/Puppet 并管理手动更改

tomcat - 如何在命令行帮助下检查tomcat服务器中的 Activity 日志?

Postgresql:在 playframework 1.x 中选择两个日期之间的所有数据

php - 未捕获的异常 'PDOException',消息为“SQLSTATE[08P01]”

sql - 应用 ST_VoronoiPolygons 和剪辑输出时传递字段

spring - 为什么 Cobertura 不能在我的 Spring/Hibernate Webapp 中工作?