CMDBuild Forum

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


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:


Next, I ran the bash script to create the database:
bash /var/lib/tomcat9/webapps/cmdbuild/ 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


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.