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 org.apache.hadoop.security.UserGroupInformation
at org.apache.hadoop.hbase.security.User$SecureHadoopUser.(User.java:286)
at org.apache.hadoop.hbase.security.User$SecureHadoopUser.(User.java:282)
at org.apache.hadoop.hbase.security.User.getCurrent(User.java:185)
at org.apache.hadoop.hbase.security.UserProvider.getCurrent(UserProvider.java:88)
at org.apache.hadoop.hbase.client.ConnectionManager.createConnectionInternal(ConnectionManager.java:336)
at org.apache.hadoop.hbase.client.HConnectionManager.createConnection(HConnectionManager.java:144)
at org.apache.phoenix.query.HConnectionFactory$HConnectionFactoryImpl.createConnection(HConnectionFactory.java:47)
at org.apache.phoenix.query.ConnectionQueryServicesImpl.openConnection(ConnectionQueryServicesImpl.java:389)
at org.apache.phoenix.query.ConnectionQueryServicesImpl.access$300(ConnectionQueryServicesImpl.java:217)
at org.apache.phoenix.query.ConnectionQueryServicesImpl$13.call(ConnectionQueryServicesImpl.java:2348)
at org.apache.phoenix.query.ConnectionQueryServicesImpl$13.call(ConnectionQueryServicesImpl.java:2327)
at org.apache.phoenix.util.PhoenixContextExecutor.call(PhoenixContextExecutor.java:78)
at org.apache.phoenix.query.ConnectionQueryServicesImpl.init(ConnectionQueryServicesImpl.java:2327)
at org.apache.phoenix.jdbc.PhoenixDriver.getConnectionQueryServices(PhoenixDriver.java:233)
at org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.createConnection(PhoenixEmbeddedDriver.java:142)
at org.apache.phoenix.jdbc.PhoenixDriver.connect(PhoenixDriver.java:202)
at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294)
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1247)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1221)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
at com.inductiveautomation.ignition.gateway.datasource.DatasourceImpl.getConnectionInternal(DatasourceImpl.java:199)
at com.inductiveautomation.ignition.gateway.datasource.DatasourceImpl.runTest(DatasourceImpl.java:155)
at com.inductiveautomation.ignition.gateway.datasource.DatasourceManagerImpl$FaultedDatasourceRetryer$1.run(DatasourceManagerImpl.java:996)
at com.inductiveautomation.ignition.common.execution.impl.BasicExecutionEngine$TrackedTask.run(BasicExecutionEngine.java:584)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown 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 ‘wrapper.java.classpath’ 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

wrapper.java.classpath.3=lib/hadoop-common.jar

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

we eliminated

java.lang.NoClassDefFoundError: Could not initialize class org.apache.hadoop.security.UserGroupInformation

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 wrapper.java.classpath.x 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 wrapper.java.classpath.3=lib/phoenix.

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