I will try to provide as much information to avoid misunderstanding. Please bare with me.
I am trying to run two docker containers, one running Apache/James and one PostgreSQL. The Apache/James instance is supposed to use the PostgreSQL instance. I have succeeded to run the setup using linagora/james-jpa-spring
image of James. I followed the instruction that is provided by Apache/James official website.
According to the documentation, I just need to download PostgreSQL JDBC Driver from here and mount it in /conf/lib folder and update the database address and credentials in /conf/james-database.properties file. I followed the instruction and it works.
However since Linagora image seems to be too old I decided that I want to switch to one of the original Apache/James:jpa* images. (based on the docker hub, I feel :jpa is the right choice but if you feel I am mistaken, please let me know)
I therefore followed the same instruction (mount JDBC Driver and update james-database.properties) and I expected to have a smooth transition to JPA image but it wasn't.
I figured out that recent JPA images require a key-pair that is supposed to save as "keystore" file and mounted in /config/ folder. The keypair must be made with code "james72laBalle". this step is made successfully.
However I am getting one error that is running me creasy. James (not the container) says that it cannot reach to my PostgreSQL container. It say:
There were errors initializing your configuration: <openjpa-3.2.0-r6f721f6 fatal user error> UserException: A connection could not be obtained for driver class ".postgresql.Driver" and URL "jdbc:postgresql://post/jamesdb". You may have specified an invalid URL.
This is the full error message:
1) [Guice/ErrorInjectingConstructor]: <openjpa-3.2.0-r6f721f6 nonfatal general error> PersistenceException: There were errors initializing your configuration: <openjpa-3.2.0-r6f721f6 fatal user error> UserException: A connection could not be obtained for driver class ".postgresql.Driver" and URL "jdbc:postgresql://post/jamesdb". You may have specified an invalid URL.
at DataSourceFactory.newConnectException(DataSourceFactory.java:271)
at DataSourceFactory.newDataSource(DataSourceFactory.java:121)
at JDBCConfigurationImpl.createConnectionFactory(JDBCConfigurationImpl.java:925)
at JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:805)
at java.base/NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/Method.invoke(Unknown Source)
at ConfigurationImpl.instantiateAll(ConfigurationImpl.java:331)
at OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1963)
at AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:665)
at AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:207)
at DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:166)
at EntityManagerFactoryImpl.doCreateEM(EntityManagerFactoryImpl.java:282)
at EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:201)
This is my james-database.properties file:
database.driverClassName=.postgresql.Driver
database.url=jdbc:postgresql://post/jamesdb
database.username=admin
database.password=password
vendorAdapter.database=POSTGRESQL
I have also tried the followings for database url:
database.url=jdbc:postgresql://post:5432/jamesdb
database.url=jdbc:postgresql://post/jamesdb;create=true
database.url=jdbc:postgresql://post:5432/jamesdb;create=true
No success!
I have made a docker network and both containers are running on that "docker network"
I am sure that my James container can access my Postgres container (when I try to run it with its internal Derby database and do not force it to connect to external database.) cause I have Docker-exec bash of James container and pinged my Postgres container (ping post) and it responded successfully. I even installed a psql database manager inside my James container and could successfully connect to the database on my Postgres container and manipulated the data on the database.
I simply do not understand why James says that it cannot see my PostgreSQL database while it should have access.
I will try to provide as much information to avoid misunderstanding. Please bare with me.
I am trying to run two docker containers, one running Apache/James and one PostgreSQL. The Apache/James instance is supposed to use the PostgreSQL instance. I have succeeded to run the setup using linagora/james-jpa-spring
image of James. I followed the instruction that is provided by Apache/James official website.
According to the documentation, I just need to download PostgreSQL JDBC Driver from here and mount it in /conf/lib folder and update the database address and credentials in /conf/james-database.properties file. I followed the instruction and it works.
However since Linagora image seems to be too old I decided that I want to switch to one of the original Apache/James:jpa* images. (based on the docker hub, I feel :jpa is the right choice but if you feel I am mistaken, please let me know)
I therefore followed the same instruction (mount JDBC Driver and update james-database.properties) and I expected to have a smooth transition to JPA image but it wasn't.
I figured out that recent JPA images require a key-pair that is supposed to save as "keystore" file and mounted in /config/ folder. The keypair must be made with code "james72laBalle". this step is made successfully.
However I am getting one error that is running me creasy. James (not the container) says that it cannot reach to my PostgreSQL container. It say:
There were errors initializing your configuration: <openjpa-3.2.0-r6f721f6 fatal user error> UserException: A connection could not be obtained for driver class ".postgresql.Driver" and URL "jdbc:postgresql://post/jamesdb". You may have specified an invalid URL.
This is the full error message:
1) [Guice/ErrorInjectingConstructor]: <openjpa-3.2.0-r6f721f6 nonfatal general error> PersistenceException: There were errors initializing your configuration: <openjpa-3.2.0-r6f721f6 fatal user error> UserException: A connection could not be obtained for driver class ".postgresql.Driver" and URL "jdbc:postgresql://post/jamesdb". You may have specified an invalid URL.
at DataSourceFactory.newConnectException(DataSourceFactory.java:271)
at DataSourceFactory.newDataSource(DataSourceFactory.java:121)
at JDBCConfigurationImpl.createConnectionFactory(JDBCConfigurationImpl.java:925)
at JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:805)
at java.base/NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/Method.invoke(Unknown Source)
at ConfigurationImpl.instantiateAll(ConfigurationImpl.java:331)
at OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1963)
at AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:665)
at AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:207)
at DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:166)
at EntityManagerFactoryImpl.doCreateEM(EntityManagerFactoryImpl.java:282)
at EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:201)
This is my james-database.properties file:
database.driverClassName=.postgresql.Driver
database.url=jdbc:postgresql://post/jamesdb
database.username=admin
database.password=password
vendorAdapter.database=POSTGRESQL
I have also tried the followings for database url:
database.url=jdbc:postgresql://post:5432/jamesdb
database.url=jdbc:postgresql://post/jamesdb;create=true
database.url=jdbc:postgresql://post:5432/jamesdb;create=true
No success!
I have made a docker network and both containers are running on that "docker network"
I am sure that my James container can access my Postgres container (when I try to run it with its internal Derby database and do not force it to connect to external database.) cause I have Docker-exec bash of James container and pinged my Postgres container (ping post) and it responded successfully. I even installed a psql database manager inside my James container and could successfully connect to the database on my Postgres container and manipulated the data on the database.
I simply do not understand why James says that it cannot see my PostgreSQL database while it should have access.
Share asked Mar 3 at 22:24 AdmWintherAdmWinther 313 bronze badges1 Answer
Reset to default 0I could solve the issue. The problem was the mistake in Apache/James documnation. On James website, it says that the JDBC driver must be placed under /conf/lib/ while in their github repo, they have mentioned that the JDBC driver must be placed under /root/libs/
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745069326a4609448.html
评论列表(0条)