You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Mohammed Fadili <mo...@ajiel.com> on 2022/06/03 20:58:39 UTC

How to pass certificate path with Postgres database url string for SSL connection

*Hi team,*

*My customer is using our ofbiz app hosted on an azure VM and we want now
to connect it to an azure postgresql db setup with ssl.*
I am trying to find the right connection string to set in the
entityengine.xml.

From different readings, I have found the following:
jdbc-uri="jdbc:postgresql://
pql-001.postgres.database.azure.com:5432/hrajiel?sslmode=verify-full&sslfactory=org.postgresql.ssl.SingleCertValidatingFactory&sslfactoryarg=classpath:framework/entity/config/myCyberTrustRoot.crt.pem
"

when running the gradlew loadDefault command, I face the below error:
2022-06-03 11:33:45,374 |delegator-startup-1  |UtilXml
  |E| XmlFileLoader: File
jar:file:/D:/HRAJIEL/ajsfrc22/ajielsoft/build/libs/ajielsoft.jar!/entityengine.xml
process fatal error. Line: 134. Error message: The reference to entity
"sslfactory" must end with the ';' delimiter.

The below post mentions that this is a tomcat issue and we need to
escape the "&" in the connection string.
https://marc.info/?l=postgresql-general&m=153342574420527&w=2

Hence I changed the string to:
jdbc-uri="jdbc:postgresql://
pql-001.postgres.database.azure.com:5432/hrajiel?sslmode=verify-full&sslfactory=org.postgresql.ssl.SingleCertValidatingFactory&#038;sslfactoryarg=classpath:framework/entity/config/myCyberTrustRoot.crt.pem
"

But still the same issue: Error message: The reference to entity
"sslfactory" must end with the ';' delimiter.

Would the ofbiz community know anything about this ssl and postgresql issue?
An additional question would be about the format of the certificate. Does
it have to be a PKS file mandatory or can we still use the .pem file?

Many thanks in advance to all reading this.

M. Fadili
Ajiel Information Systems Morocco

Re: How to pass certificate path with Postgres database url string for SSL connection

Posted by Jacques Le Roux <ja...@les7arts.com>.
Hi Mohammed,

Your message has been moderated, else it would not have reached this Mailing List.

Please subscribe to the user ML for such questions and then use your email client.
See why here http://ofbiz.apache.org/mailing-lists.html.

You will get a better support, people can answer you on the ML.
The wider the audience the better the answers you might get.

Also it's more work for moderators who have to accept your messages as long as you have not subscribed.
I'll personally no longer accept them (other moderators still could).

Thanks

This said, I have no idea but from https://marc.info/?l=postgresql-general&m=153342574420527&w=2 I'd try

jdbc-uri="jdbc:postgresql://pql-001.postgres.database.azure.com:5432/hrajiel?sslmode=verify-full&amp;sslfactory=org.postgresql.ssl.SingleCertValidatingFactory&amp;sslfactoryarg=classpath:framework/entity/config/myCyberTrustRoot.crt.pem"

HTH

Jacques

Le 03/06/2022 à 22:58, Mohammed Fadili a écrit :
> *Hi team,*
>
> *My customer is using our ofbiz app hosted on an azure VM and we want now
> to connect it to an azure postgresql db setup with ssl.*
> I am trying to find the right connection string to set in the
> entityengine.xml.
>
> >From different readings, I have found the following:
> jdbc-uri="jdbc:postgresql://
> pql-001.postgres.database.azure.com:5432/hrajiel?sslmode=verify-full&sslfactory=org.postgresql.ssl.SingleCertValidatingFactory&sslfactoryarg=classpath:framework/entity/config/myCyberTrustRoot.crt.pem
> "
>
> when running the gradlew loadDefault command, I face the below error:
> 2022-06-03 11:33:45,374 |delegator-startup-1  |UtilXml
>    |E| XmlFileLoader: File
> jar:file:/D:/HRAJIEL/ajsfrc22/ajielsoft/build/libs/ajielsoft.jar!/entityengine.xml
> process fatal error. Line: 134. Error message: The reference to entity
> "sslfactory" must end with the ';' delimiter.
>
> The below post mentions that this is a tomcat issue and we need to
> escape the "&" in the connection string.
> https://marc.info/?l=postgresql-general&m=153342574420527&w=2
>
> Hence I changed the string to:
> jdbc-uri="jdbc:postgresql://
> pql-001.postgres.database.azure.com:5432/hrajiel?sslmode=verify-full&sslfactory=org.postgresql.ssl.SingleCertValidatingFactory&#038;sslfactoryarg=classpath:framework/entity/config/myCyberTrustRoot.crt.pem
> "
>
> But still the same issue: Error message: The reference to entity
> "sslfactory" must end with the ';' delimiter.
>
> Would the ofbiz community know anything about this ssl and postgresql issue?
> An additional question would be about the format of the certificate. Does
> it have to be a PKS file mandatory or can we still use the .pem file?
>
> Many thanks in advance to all reading this.
>
> M. Fadili
> Ajiel Information Systems Morocco