SAP HANA JDBC Driver causes typecheck error in StreamBase Studio

SAP HANA JDBC Driver causes typecheck error in StreamBase Studio

book

Article ID: KB0074441

calendar_today

Updated On:

Products Versions
TIBCO Streaming 10

Description

At runtime, JDBC works with no errors. In Studio the JDBC Query operator reports in the Problems view:
 Error connecting to data-source SAP: NoClassDefFoundError: Could not initialize class com.sap.db.jdbc.Driver
In the Studio Debug log we see:
 2020-11-17 12:39:00.599-0500 [Thread-23] ERROR com.streambase.sb.jdbc.JDBCRunner - Error executing command in JDBC background thread java.lang.NoClassDefFoundError: Could not initialize class com.sap.db.jdbc.Driver
which means the class was found, but some unreported internal error stopped it.

The expectation is that if the configuration works at runtime, it also works for dynamic typechecking in Studio.

Issue/Introduction

Workaround configuration guidance

Resolution

This issue in TIBCO StreamBase Studio is caused by the fact that the SAP driver JAR is a "Multi-Release" JAR with Java 8 and Java 11 implementations and Studio is running mostly Java 8 code inside an Java 11 VM. The SAP driver loader is getting confused.

There are two workarounds available.

A. Configure the Studio JVM to ignore the JAR file "Multi-Release" manifest attribute and require runtime versioning

Set Java system property setting "jdk.util.jar.enableMultiRelease=force" in the operating system runtime environment and then in the same environment run 'sbstudio'.

Set the STREAMBASE_STUDIO_VMARGS environment variable (example):
 C:\>set STREAMBASE_STUDIO_VMARGS=-Xms4096M -Xmx6144M -Djdk.util.jar.enableMultiRelease=force C:\>sbstudio 
Note that to use any "STREAMBASE_STUDIO_VMARGS" setting, the memory settings must also be set, as described in the documentation here:
  TIBCO Streaming > StreamBase References > StreamBase Environment Variables

B. Prevent Studio from loading the JDBC driver during typechecking

Avoid the error in Studio by setting for every Query operator the contents of the Result Settings tab:
  SQL Result fields: "Explicitly declare fields below"
and list the expected output column names and their StreamBase types manually. 

Example:
Explicitly declare fields example in Studio

Using this means that Studio will not automatically populate the output schema to match the database table if the table changes. Many customers prefer to use this setting so that Studio does not attempt to contact the database during development.


Note: For the above settings we tested using POM dependency:
 <dependency>     <groupId>com.sap.cloud.db.jdbc</groupId>     <artifactId>ngdbc</artifactId>     <version>2.5.49</version>     <type>jar</type> </dependency>