CMDBuild Forum

Error "java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/postgresql/ds/PGSimpleDataSource"

Hello.

Components installed:

1) OS Linux Ubuntu 20.04 LTS
2) Apache Tomcat 9.0.31
3) Java OpenJDK 17.0.5
4) PostgreSQL 12.12

In the /var/lib/tomcat9/conf/cmdbuild/ directory, I previously created a database.conf file with the following content:

#db.url=jdbc:postgresql://localhost:5432/cmdbuild_30
#db.username=cmdbuild
#idb.password=cmdbuild
#db.admin.username=postgres
#db.admin.password=Bn512$AS

Next, I ran the bash script to create the database:
bash /var/lib/tomcat9/webapps/cmdbuild/cmdbuild.sh dbconfig create demo -configfile /etc/tomcat9/cmdbuild/database.conf

The database was created successfully, I go to the web interface, I try to check the test connection, and I get the following error:

java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/postgresql/ds/PGSimpleDataSource, caused by: java.lang.NoClassDefFoundError: org/postgresql/ds/PGSimpleDataSource, caused by: java.lang.ClassNotFoundException: org.postgresql. ds.PGSimpleDataSource

cmdbuild_error_java.lang.NoClassDefFoundError_org-postgresql-ds-PGSimpleDataSource

Tell me what am I doing wrong?
It seems that some library with the description of the “PGSimpleDataSource” class is missing

Also please clarify where should I look for the path org/postgresql/ds/PGSimpleDataSource ?

While this post was being moderated, I solved this problem.

You need to download the postgresql-42.2.10.jar library and copy it to the /usr/share/java directory and make a symbolic link as follows:

cd /usr/share/tomcat9/lib; ln -s …/…/java/postgresql-42.2.10.jar

After that, you need to restart the Tomcat service and again test the connection to the database through the web interface

P.S. I found a solution to this problem in the topic "Installing CMDBuild on Ubuntu/Debian from command line, DigitalOcean instance" on this forum, where it says that the “tomcat-dbcp” library is no longer used for access.

I had a similar issue.

Thanks to your answer I solved this issue.

I had the same problem with an install of tomcat which I installed from the binary application .tar.gz. Tomcat 9.0.82 installed from the archive on the official website of tomcat.

So I got the file postgresql-42.X.X.jar from my installation which was at “$CATALINA_HOME/webapps/cmdbuild/WEB-INF/lib_ext/posgresql-42.X.X.jar”.
I put it in $CATALINA_HOME/lib and it worked !

Hope it will be useful for someone !