You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Bs Serge <se...@gmail.com> on 2022/01/03 12:03:01 UTC

Re: Using Postgres

Progress update :

I added the Postgres jar file in the 'extensions-jars' folder and I can see
it being loaded in the classpath in the logs :

11:41:55.472 [34m[INFO ] [0;39m o.a.j.u.ExtendedClassLoader - Loading
custom classpath resource /root/./extensions-jars/postgresql-42.3.1.jar

but I'm still getting the same error :  java.lang.ClassNotFoundException:
org.postgresql.Driver

Below is the full logs

Full logs:
https://paste.0xfc.de/?1df0ef907332046f#56txc688Yicbqgt84VFiaDJ6tvB3joLwoKDmE2wtxkvi

Any thoughts or comments would be appreciated!

Best regards,

On Fri, Dec 31, 2021 at 7:09 PM Bs Serge <se...@gmail.com> wrote:

> James 3.6.1 Guice+JPA in a docker container
>
> Hi all,
>
> I'm using this database configuration [1] in james-database.properties
> file to connect to the Postgres server on the Linux host,
>
> I also added the Postgres JDBC driver version 42.3.1 jar file [2] in the
> `james-server-cli.lib` folder inside the container,
>
> and when I restart the docker container, it give this error [3]
> `ClassNotFoundException: org.postgresql.Driver`
>
> I'm wondering what I did wrong
>
> Any thoughts or comments would be appreciated!
>
> [1]
> https://paste.0xfc.de/?d1c74b073c748f1a#88WJMDV1v3yg9Zd15zeXoyr3rM4BaCVZB7N5wxzRt9cY
>
> [2] https://jdbc.postgresql.org/download.html
>
> [3]
> https://paste.0xfc.de/?bb4c913bb483930a#FcHAonPNN9LQzfzkSFuQHjwTHT92VUdNswByeMjNSHza
>
> Best regards,
>

Re: Using Postgres

Posted by Bs Serge <se...@gmail.com>.
Finally, IT WORKED,

I can't really blame you, to be honest,

There is a lot of stuff going on with James and you seem to be the only one
around most times. I'll give a hand when I can.

So I hope you enjoyed your holidays,

Cheers,


On Tue, Jan 4, 2022 at 2:18 PM Benoit TELLIER <bt...@linagora.com> wrote:

> You are right.
>
> On upcoming 3.7.0/master JDBC the docker image is assembled using JIB
> (wich brings in the /root/libs folder)
>
> Prior to this (3.6.1 included) we were running a java command inside
> docker, you would need to override the CMD of the container to override
> the classpath of the container, as in
>
> https://github.com/apache/james-project/tree/master/server/apps/jpa-app#using-alternative-jdbc-drivers
>
>
> Example of Java command:
>
> java \
>    -javaagent:james-server-jpa-app.lib/openjpa-3.1.2.jar \
>    -Dworking.directory=. \
>    -Djdk.tls.ephemeralDHKeySize=2048 \
>    -Dlogback.configurationFile=conf/logback.xml \
>    -cp
> "james-server-jpa-app.jar:james-server-jpa-app.lib/*:jdbc-driver.jar" \
>    org.apache.james.JPAJamesServerMain
>
> Best regards,
>
> I hope it helps, sorry for the misleading pointer...
>
> Benoit
>
> On 04/01/2022 18:06, Bs Serge wrote:
> > Hi Benoit,
> >
> > Still, it does not work, the /root/libs folder does not by default exists
> > in the 3.6.1 guice-jpa docker container, so I had to create it but even
> it
> > did not solve the issue coz I still get the same error :
> > ClassNotFoundException: org.postgresql.Driver
> >
> > Below is every directory I have placed the Postgres jar in.
> >
> > # docker exec -it james_run sh
> > #
> > # find / -name post*
> > /root/james-server-cli.lib/postgresql-42.3.1.jar
> > /root/extensions-jars/postgresql-42.3.1.jar
> > /root/libs/postgresql-42.3.1.jar
> > /root/james-server-jpa-guice.lib/postgresql-42.3.1.jar
> > /root/postgresql-42.3.1.jar
> > #
> >
> > I still do not understand what it is going to take for the james jvm to
> > pick up the jar file coz I have also used the jcmd tool to inspect the
> > class hierarchy in the JVM and there is not any postgres class from the
> > postgres jar.
> >
> > Kindly let me know your thoughts as well.
> >
> > Best regards,
> >
> >
> > On Tue, Jan 4, 2022 at 3:46 AM Benoit TELLIER <bt...@linagora.com>
> wrote:
> >
> >> Hello Serge,
> >>
> >> Sorry for jumping late on the topic to provide you help.
> >>
> >> /root/libs is the folder you need to put things in for them to be on the
> >> classpath.
> >>
> >> extension-jars is a folder looked up when loading extensions (mailet,
> >> matcher, listeners, webadmin routes etc...) and is not directly on the
> >> classpath...
> >>
> >> I did put an example of setting up JPA app with an external DB:
> >>
> >>
> https://github.com/apache/james-project/tree/master/server/apps/jpa-app#using-alternative-jdbc-drivers-with-docker
> >>
> >>
> >> Best regards,
> >>
> >> Benoit TELLIER
> >>
> >> On 03/01/2022 20:43, Bs Serge wrote:
> >>> # docker exec -it james_run sh
> >>> # find -name post*
> >>> ./james-server-cli.lib/postgresql-42.3.1.jar
> >>> ./extensions-jars/postgresql-42.3.1.jar
> >>> ./james-server-jpa-guice.lib/postgresql-42.3.1.jar
> >>> ./postgresql-42.3.1.jar
> >>> #
> >>>
> >>> I have included the Postgres jar file in every possible directory but
> >>> still, I get the same error : ClassNotFoundException:
> >> org.postgresql.Driver
> >>> Regards,
> >>>
> >>>
> >>> On Mon, Jan 3, 2022 at 2:03 PM Bs Serge <se...@gmail.com> wrote:
> >>>
> >>>> Progress update :
> >>>>
> >>>> I added the Postgres jar file in the 'extensions-jars' folder and I
> can
> >>>> see it being loaded in the classpath in the logs :
> >>>>
> >>>> 11:41:55.472 [34m[INFO ] [0;39m o.a.j.u.ExtendedClassLoader - Loading
> >>>> custom classpath resource
> /root/./extensions-jars/postgresql-42.3.1.jar
> >>>>
> >>>> but I'm still getting the same error :
> >> java.lang.ClassNotFoundException:
> >>>> org.postgresql.Driver
> >>>>
> >>>> Below is the full logs
> >>>>
> >>>> Full logs:
> >>>>
> >>
> https://paste.0xfc.de/?1df0ef907332046f#56txc688Yicbqgt84VFiaDJ6tvB3joLwoKDmE2wtxkvi
> >>>> Any thoughts or comments would be appreciated!
> >>>>
> >>>> Best regards,
> >>>>
> >>>> On Fri, Dec 31, 2021 at 7:09 PM Bs Serge <se...@gmail.com> wrote:
> >>>>
> >>>>> James 3.6.1 Guice+JPA in a docker container
> >>>>>
> >>>>> Hi all,
> >>>>>
> >>>>> I'm using this database configuration [1] in
> james-database.properties
> >>>>> file to connect to the Postgres server on the Linux host,
> >>>>>
> >>>>> I also added the Postgres JDBC driver version 42.3.1 jar file [2] in
> >> the
> >>>>> `james-server-cli.lib` folder inside the container,
> >>>>>
> >>>>> and when I restart the docker container, it give this error [3]
> >>>>> `ClassNotFoundException: org.postgresql.Driver`
> >>>>>
> >>>>> I'm wondering what I did wrong
> >>>>>
> >>>>> Any thoughts or comments would be appreciated!
> >>>>>
> >>>>> [1]
> >>>>>
> >>
> https://paste.0xfc.de/?d1c74b073c748f1a#88WJMDV1v3yg9Zd15zeXoyr3rM4BaCVZB7N5wxzRt9cY
> >>>>> [2] https://jdbc.postgresql.org/download.html
> >>>>>
> >>>>> [3]
> >>>>>
> >>
> https://paste.0xfc.de/?bb4c913bb483930a#FcHAonPNN9LQzfzkSFuQHjwTHT92VUdNswByeMjNSHza
> >>>>> Best regards,
> >>>>>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> >> For additional commands, e-mail: server-user-help@james.apache.org
> >>
> >>
>

Re: Using Postgres

Posted by Benoit TELLIER <bt...@linagora.com>.
You are right.

On upcoming 3.7.0/master JDBC the docker image is assembled using JIB
(wich brings in the /root/libs folder)

Prior to this (3.6.1 included) we were running a java command inside
docker, you would need to override the CMD of the container to override
the classpath of the container, as in
https://github.com/apache/james-project/tree/master/server/apps/jpa-app#using-alternative-jdbc-drivers


Example of Java command:

java \
   -javaagent:james-server-jpa-app.lib/openjpa-3.1.2.jar \
   -Dworking.directory=. \
   -Djdk.tls.ephemeralDHKeySize=2048 \
   -Dlogback.configurationFile=conf/logback.xml \
   -cp "james-server-jpa-app.jar:james-server-jpa-app.lib/*:jdbc-driver.jar" \
   org.apache.james.JPAJamesServerMain

Best regards,

I hope it helps, sorry for the misleading pointer...

Benoit

On 04/01/2022 18:06, Bs Serge wrote:
> Hi Benoit,
>
> Still, it does not work, the /root/libs folder does not by default exists
> in the 3.6.1 guice-jpa docker container, so I had to create it but even it
> did not solve the issue coz I still get the same error :
> ClassNotFoundException: org.postgresql.Driver
>
> Below is every directory I have placed the Postgres jar in.
>
> # docker exec -it james_run sh
> #
> # find / -name post*
> /root/james-server-cli.lib/postgresql-42.3.1.jar
> /root/extensions-jars/postgresql-42.3.1.jar
> /root/libs/postgresql-42.3.1.jar
> /root/james-server-jpa-guice.lib/postgresql-42.3.1.jar
> /root/postgresql-42.3.1.jar
> #
>
> I still do not understand what it is going to take for the james jvm to
> pick up the jar file coz I have also used the jcmd tool to inspect the
> class hierarchy in the JVM and there is not any postgres class from the
> postgres jar.
>
> Kindly let me know your thoughts as well.
>
> Best regards,
>
>
> On Tue, Jan 4, 2022 at 3:46 AM Benoit TELLIER <bt...@linagora.com> wrote:
>
>> Hello Serge,
>>
>> Sorry for jumping late on the topic to provide you help.
>>
>> /root/libs is the folder you need to put things in for them to be on the
>> classpath.
>>
>> extension-jars is a folder looked up when loading extensions (mailet,
>> matcher, listeners, webadmin routes etc...) and is not directly on the
>> classpath...
>>
>> I did put an example of setting up JPA app with an external DB:
>>
>> https://github.com/apache/james-project/tree/master/server/apps/jpa-app#using-alternative-jdbc-drivers-with-docker
>>
>>
>> Best regards,
>>
>> Benoit TELLIER
>>
>> On 03/01/2022 20:43, Bs Serge wrote:
>>> # docker exec -it james_run sh
>>> # find -name post*
>>> ./james-server-cli.lib/postgresql-42.3.1.jar
>>> ./extensions-jars/postgresql-42.3.1.jar
>>> ./james-server-jpa-guice.lib/postgresql-42.3.1.jar
>>> ./postgresql-42.3.1.jar
>>> #
>>>
>>> I have included the Postgres jar file in every possible directory but
>>> still, I get the same error : ClassNotFoundException:
>> org.postgresql.Driver
>>> Regards,
>>>
>>>
>>> On Mon, Jan 3, 2022 at 2:03 PM Bs Serge <se...@gmail.com> wrote:
>>>
>>>> Progress update :
>>>>
>>>> I added the Postgres jar file in the 'extensions-jars' folder and I can
>>>> see it being loaded in the classpath in the logs :
>>>>
>>>> 11:41:55.472 [34m[INFO ] [0;39m o.a.j.u.ExtendedClassLoader - Loading
>>>> custom classpath resource /root/./extensions-jars/postgresql-42.3.1.jar
>>>>
>>>> but I'm still getting the same error :
>> java.lang.ClassNotFoundException:
>>>> org.postgresql.Driver
>>>>
>>>> Below is the full logs
>>>>
>>>> Full logs:
>>>>
>> https://paste.0xfc.de/?1df0ef907332046f#56txc688Yicbqgt84VFiaDJ6tvB3joLwoKDmE2wtxkvi
>>>> Any thoughts or comments would be appreciated!
>>>>
>>>> Best regards,
>>>>
>>>> On Fri, Dec 31, 2021 at 7:09 PM Bs Serge <se...@gmail.com> wrote:
>>>>
>>>>> James 3.6.1 Guice+JPA in a docker container
>>>>>
>>>>> Hi all,
>>>>>
>>>>> I'm using this database configuration [1] in james-database.properties
>>>>> file to connect to the Postgres server on the Linux host,
>>>>>
>>>>> I also added the Postgres JDBC driver version 42.3.1 jar file [2] in
>> the
>>>>> `james-server-cli.lib` folder inside the container,
>>>>>
>>>>> and when I restart the docker container, it give this error [3]
>>>>> `ClassNotFoundException: org.postgresql.Driver`
>>>>>
>>>>> I'm wondering what I did wrong
>>>>>
>>>>> Any thoughts or comments would be appreciated!
>>>>>
>>>>> [1]
>>>>>
>> https://paste.0xfc.de/?d1c74b073c748f1a#88WJMDV1v3yg9Zd15zeXoyr3rM4BaCVZB7N5wxzRt9cY
>>>>> [2] https://jdbc.postgresql.org/download.html
>>>>>
>>>>> [3]
>>>>>
>> https://paste.0xfc.de/?bb4c913bb483930a#FcHAonPNN9LQzfzkSFuQHjwTHT92VUdNswByeMjNSHza
>>>>> Best regards,
>>>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>> For additional commands, e-mail: server-user-help@james.apache.org
>>
>>

Re: Using Postgres

Posted by Bs Serge <se...@gmail.com>.
Hi Benoit,

Still, it does not work, the /root/libs folder does not by default exists
in the 3.6.1 guice-jpa docker container, so I had to create it but even it
did not solve the issue coz I still get the same error :
ClassNotFoundException: org.postgresql.Driver

Below is every directory I have placed the Postgres jar in.

# docker exec -it james_run sh
#
# find / -name post*
/root/james-server-cli.lib/postgresql-42.3.1.jar
/root/extensions-jars/postgresql-42.3.1.jar
/root/libs/postgresql-42.3.1.jar
/root/james-server-jpa-guice.lib/postgresql-42.3.1.jar
/root/postgresql-42.3.1.jar
#

I still do not understand what it is going to take for the james jvm to
pick up the jar file coz I have also used the jcmd tool to inspect the
class hierarchy in the JVM and there is not any postgres class from the
postgres jar.

Kindly let me know your thoughts as well.

Best regards,


On Tue, Jan 4, 2022 at 3:46 AM Benoit TELLIER <bt...@linagora.com> wrote:

> Hello Serge,
>
> Sorry for jumping late on the topic to provide you help.
>
> /root/libs is the folder you need to put things in for them to be on the
> classpath.
>
> extension-jars is a folder looked up when loading extensions (mailet,
> matcher, listeners, webadmin routes etc...) and is not directly on the
> classpath...
>
> I did put an example of setting up JPA app with an external DB:
>
> https://github.com/apache/james-project/tree/master/server/apps/jpa-app#using-alternative-jdbc-drivers-with-docker
>
>
> Best regards,
>
> Benoit TELLIER
>
> On 03/01/2022 20:43, Bs Serge wrote:
> > # docker exec -it james_run sh
> > # find -name post*
> > ./james-server-cli.lib/postgresql-42.3.1.jar
> > ./extensions-jars/postgresql-42.3.1.jar
> > ./james-server-jpa-guice.lib/postgresql-42.3.1.jar
> > ./postgresql-42.3.1.jar
> > #
> >
> > I have included the Postgres jar file in every possible directory but
> > still, I get the same error : ClassNotFoundException:
> org.postgresql.Driver
> >
> > Regards,
> >
> >
> > On Mon, Jan 3, 2022 at 2:03 PM Bs Serge <se...@gmail.com> wrote:
> >
> >> Progress update :
> >>
> >> I added the Postgres jar file in the 'extensions-jars' folder and I can
> >> see it being loaded in the classpath in the logs :
> >>
> >> 11:41:55.472 [34m[INFO ] [0;39m o.a.j.u.ExtendedClassLoader - Loading
> >> custom classpath resource /root/./extensions-jars/postgresql-42.3.1.jar
> >>
> >> but I'm still getting the same error :
> java.lang.ClassNotFoundException:
> >> org.postgresql.Driver
> >>
> >> Below is the full logs
> >>
> >> Full logs:
> >>
> https://paste.0xfc.de/?1df0ef907332046f#56txc688Yicbqgt84VFiaDJ6tvB3joLwoKDmE2wtxkvi
> >>
> >> Any thoughts or comments would be appreciated!
> >>
> >> Best regards,
> >>
> >> On Fri, Dec 31, 2021 at 7:09 PM Bs Serge <se...@gmail.com> wrote:
> >>
> >>> James 3.6.1 Guice+JPA in a docker container
> >>>
> >>> Hi all,
> >>>
> >>> I'm using this database configuration [1] in james-database.properties
> >>> file to connect to the Postgres server on the Linux host,
> >>>
> >>> I also added the Postgres JDBC driver version 42.3.1 jar file [2] in
> the
> >>> `james-server-cli.lib` folder inside the container,
> >>>
> >>> and when I restart the docker container, it give this error [3]
> >>> `ClassNotFoundException: org.postgresql.Driver`
> >>>
> >>> I'm wondering what I did wrong
> >>>
> >>> Any thoughts or comments would be appreciated!
> >>>
> >>> [1]
> >>>
> https://paste.0xfc.de/?d1c74b073c748f1a#88WJMDV1v3yg9Zd15zeXoyr3rM4BaCVZB7N5wxzRt9cY
> >>>
> >>> [2] https://jdbc.postgresql.org/download.html
> >>>
> >>> [3]
> >>>
> https://paste.0xfc.de/?bb4c913bb483930a#FcHAonPNN9LQzfzkSFuQHjwTHT92VUdNswByeMjNSHza
> >>>
> >>> Best regards,
> >>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>
>

Re: Using Postgres

Posted by Benoit TELLIER <bt...@linagora.com>.
Hello Serge,

Sorry for jumping late on the topic to provide you help.

/root/libs is the folder you need to put things in for them to be on the
classpath.

extension-jars is a folder looked up when loading extensions (mailet,
matcher, listeners, webadmin routes etc...) and is not directly on the
classpath...

I did put an example of setting up JPA app with an external DB:
https://github.com/apache/james-project/tree/master/server/apps/jpa-app#using-alternative-jdbc-drivers-with-docker


Best regards,

Benoit TELLIER

On 03/01/2022 20:43, Bs Serge wrote:
> # docker exec -it james_run sh
> # find -name post*
> ./james-server-cli.lib/postgresql-42.3.1.jar
> ./extensions-jars/postgresql-42.3.1.jar
> ./james-server-jpa-guice.lib/postgresql-42.3.1.jar
> ./postgresql-42.3.1.jar
> #
>
> I have included the Postgres jar file in every possible directory but
> still, I get the same error : ClassNotFoundException: org.postgresql.Driver
>
> Regards,
>
>
> On Mon, Jan 3, 2022 at 2:03 PM Bs Serge <se...@gmail.com> wrote:
>
>> Progress update :
>>
>> I added the Postgres jar file in the 'extensions-jars' folder and I can
>> see it being loaded in the classpath in the logs :
>>
>> 11:41:55.472 [34m[INFO ] [0;39m o.a.j.u.ExtendedClassLoader - Loading
>> custom classpath resource /root/./extensions-jars/postgresql-42.3.1.jar
>>
>> but I'm still getting the same error :  java.lang.ClassNotFoundException:
>> org.postgresql.Driver
>>
>> Below is the full logs
>>
>> Full logs:
>> https://paste.0xfc.de/?1df0ef907332046f#56txc688Yicbqgt84VFiaDJ6tvB3joLwoKDmE2wtxkvi
>>
>> Any thoughts or comments would be appreciated!
>>
>> Best regards,
>>
>> On Fri, Dec 31, 2021 at 7:09 PM Bs Serge <se...@gmail.com> wrote:
>>
>>> James 3.6.1 Guice+JPA in a docker container
>>>
>>> Hi all,
>>>
>>> I'm using this database configuration [1] in james-database.properties
>>> file to connect to the Postgres server on the Linux host,
>>>
>>> I also added the Postgres JDBC driver version 42.3.1 jar file [2] in the
>>> `james-server-cli.lib` folder inside the container,
>>>
>>> and when I restart the docker container, it give this error [3]
>>> `ClassNotFoundException: org.postgresql.Driver`
>>>
>>> I'm wondering what I did wrong
>>>
>>> Any thoughts or comments would be appreciated!
>>>
>>> [1]
>>> https://paste.0xfc.de/?d1c74b073c748f1a#88WJMDV1v3yg9Zd15zeXoyr3rM4BaCVZB7N5wxzRt9cY
>>>
>>> [2] https://jdbc.postgresql.org/download.html
>>>
>>> [3]
>>> https://paste.0xfc.de/?bb4c913bb483930a#FcHAonPNN9LQzfzkSFuQHjwTHT92VUdNswByeMjNSHza
>>>
>>> Best regards,
>>>

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: Using Postgres

Posted by Bs Serge <se...@gmail.com>.
# docker exec -it james_run sh
# find -name post*
./james-server-cli.lib/postgresql-42.3.1.jar
./extensions-jars/postgresql-42.3.1.jar
./james-server-jpa-guice.lib/postgresql-42.3.1.jar
./postgresql-42.3.1.jar
#

I have included the Postgres jar file in every possible directory but
still, I get the same error : ClassNotFoundException: org.postgresql.Driver

Regards,


On Mon, Jan 3, 2022 at 2:03 PM Bs Serge <se...@gmail.com> wrote:

> Progress update :
>
> I added the Postgres jar file in the 'extensions-jars' folder and I can
> see it being loaded in the classpath in the logs :
>
> 11:41:55.472 [34m[INFO ] [0;39m o.a.j.u.ExtendedClassLoader - Loading
> custom classpath resource /root/./extensions-jars/postgresql-42.3.1.jar
>
> but I'm still getting the same error :  java.lang.ClassNotFoundException:
> org.postgresql.Driver
>
> Below is the full logs
>
> Full logs:
> https://paste.0xfc.de/?1df0ef907332046f#56txc688Yicbqgt84VFiaDJ6tvB3joLwoKDmE2wtxkvi
>
> Any thoughts or comments would be appreciated!
>
> Best regards,
>
> On Fri, Dec 31, 2021 at 7:09 PM Bs Serge <se...@gmail.com> wrote:
>
>> James 3.6.1 Guice+JPA in a docker container
>>
>> Hi all,
>>
>> I'm using this database configuration [1] in james-database.properties
>> file to connect to the Postgres server on the Linux host,
>>
>> I also added the Postgres JDBC driver version 42.3.1 jar file [2] in the
>> `james-server-cli.lib` folder inside the container,
>>
>> and when I restart the docker container, it give this error [3]
>> `ClassNotFoundException: org.postgresql.Driver`
>>
>> I'm wondering what I did wrong
>>
>> Any thoughts or comments would be appreciated!
>>
>> [1]
>> https://paste.0xfc.de/?d1c74b073c748f1a#88WJMDV1v3yg9Zd15zeXoyr3rM4BaCVZB7N5wxzRt9cY
>>
>> [2] https://jdbc.postgresql.org/download.html
>>
>> [3]
>> https://paste.0xfc.de/?bb4c913bb483930a#FcHAonPNN9LQzfzkSFuQHjwTHT92VUdNswByeMjNSHza
>>
>> Best regards,
>>
>