我正在使用 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/