如何在payara docker容器上安装postgresql?

gywdnpxw  于 2021-07-06  发布在  Java
关注(0)|答案(0)|浏览(353)

我正在尝试安装并创建一个容器,用jax-rs应用程序运行payaraserver。运行服务器并不难,我只是使用了官方图片。但是,当我创建连接池时,我无法ping,并收到以下错误消息:

Ping Connection Pool failed for PostgreSQLPool. 
Class name is wrong or classpath is not set for :
 org.postgresql.ds.PGConnectionPoolDataSource Please check the server.log for more details.

另外,当我尝试上载.war文件时(在创建数据源之后),我收到以下错误消息:

Error occurred during deployment: Exception [EclipseLink-4002] (Eclipse Persistence Services - 
2.7.7.payara-p3): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: 
java.sql.SQLException: Error in allocating a connection. Cause: 
org.postgresql.ds.PGConnectionPoolDataSource cannot be cast to javax.sql.DataSource Error Code:
 0. Please see server.log for more details.

经过一番挖掘,我认为问题在于容器中没有postgre jdbc驱动程序。我创建了这个dockerfile:

FROM payara/server-full

COPY postgresql-42.2.18.jar /opt/payara41/glassfish/domains/domain1/lib

,我认为这会将.jar文件添加到容器中。不幸的是,没有任何改变。我在本地安装的payara上有完全相同的配置,在那里一切正常。
有什么我不知道的吗?我对 Docker 很陌生,所以如果有人能给我指出正确的方向,我会非常感激的。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题