Classpath location for Jar Files needed by JDBC Driver

I have attempted connecting Ignition to Apache Phoenix via JDBC. As a test case I have also connected to the database using Squirrel from the same host where the Ignition gateway is installed.

After configuring both the Driver and Connection properties the connection status reads “Unknown”

When I view the console output I see the output below.

Additional information

  1. security is not enabled on this database and I have provided no user name or password in the connection properties. I have tried it with a username and password as well with no effect.

  2. The JDBC driver JAR that I am using should contain all of the necessary dependencies and this is verified by the Squirrel Client driver configuration

  3. I have updated separate JARs containing these classes using the Driver configuration with no effect. I added JARs to the C:\Program Files\Inductive Automation\Ignition\lib folders with no effect

11:11:35 AM BasicExecutionEngine Task connection validation hbaseviaphoenix threw uncaught exception.

java.lang.NoClassDefFoundError: Could not initialize class
at org.apache.hadoop.hbase.client.ConnectionManager.createConnectionInternal(
at org.apache.hadoop.hbase.client.HConnectionManager.createConnection(
at org.apache.phoenix.query.HConnectionFactory$HConnectionFactoryImpl.createConnection(
at org.apache.phoenix.query.ConnectionQueryServicesImpl.openConnection(
at org.apache.phoenix.query.ConnectionQueryServicesImpl.access$300(
at org.apache.phoenix.query.ConnectionQueryServicesImpl$
at org.apache.phoenix.query.ConnectionQueryServicesImpl$
at org.apache.phoenix.query.ConnectionQueryServicesImpl.init(
at org.apache.phoenix.jdbc.PhoenixDriver.getConnectionQueryServices(
at org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.createConnection(
at org.apache.phoenix.jdbc.PhoenixDriver.connect(
at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(
at org.apache.commons.dbcp.BasicDataSource.createDataSource(
at org.apache.commons.dbcp.BasicDataSource.getConnection(
at com.inductiveautomation.ignition.gateway.datasource.DatasourceImpl.getConnectionInternal(
at com.inductiveautomation.ignition.gateway.datasource.DatasourceImpl.runTest(
at com.inductiveautomation.ignition.gateway.datasource.DatasourceManagerImpl$FaultedDatasourceRetryer$
at com.inductiveautomation.ignition.common.execution.impl.BasicExecutionEngine$
at java.util.concurrent.Executors$ Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$ Source)
at Source)

Ignition uses a custom classpath, not the system classpath. Your driver is referencing org.apache.hadoop, which isn’t part of Ignition. You’ll need to adjust the Ignition service wrapper configuration to add hadoop to the custom classpath.

Is there a guide or other document that describes how to adjust the service wrapper?

It’s just a text file, ignition.conf, in your install folder. You’ll want to add entries, one jar per line, starting with ‘’ as shown for the standard install. There’s various items in the manual that describe edits to this file, like setting Ignition’s memory limit, but nothing specific for adding Jars.

Partial success :slight_smile:

after adding

to C:\Program Files\Inductive Automation\Ignition\data\ignition.conf

we eliminated

java.lang.NoClassDefFoundError: Could not initialize class

However the error that remains is:

java.lang.NoClassDefFoundError: Could not initialize class org.apache.hadoop.hbase.HBaseConfiguration

This class depends on a hbase-site.xml file and a NoClassDefFoundError is thrown when this properties file is unavailable. Adding this XML to the file to in igition.conf did not resolve the error.

Should I add XML files to the classpath this way or is there another way to add XML files to the classpath?

I’ve never seen an xml file in a classpath. Are you sure you aren’t supposed to place that file in a directory the hadoop architecture is looking in?

Usually this file is on the cp of the jvm and works like a resource file. I did not see another way to add such files so I tried adding it like a jar.

Is there another way to upload files resource files for the JDBC jar?

I believe the ideal thing to do here is upload them through the “drivers configuration”. This dialog only accepts JARs though

I don’t know enough about hadoop to advise in detail, but I would be surprised if you can’t just place it in the service’s “current directory”, or some folder within it. You’ll have to experiment.

If I were to run the client code from the command line I would use

java -cp $CLASSPATH:/usr/lib/hbase/conf

to include the directory of XML files

Is there an equivalent directory in Ignition?

I was able to get the Phoenix JDBC driver working but I had to include 42 individual dependency jars in the ignition.conf file. The gateway would not start if I tried including the directory

Also, loading dependencies via the web app did not work because it would not accept the .xml files. Placing XML files in the in user-lib folder also did not seem work either.

I am glad its working but I feel like there should be a better way. Using the ignition.conf I saw the start time increase with each jar file I added.

Thanks for all your help and let me know if you have any other ideas to try