In Liferay DXP’s OSGi environment, you must use the portal’s class loader to load
the application server’s JNDI classes. An OSGi bundle’s attempt to connect to a
JNDI data source without using Liferay DXP’s class loader results in a
java.lang.ClassNotFoundException
.
For more information on how to do this, see the Connecting to JNDI Data Sources article.