cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

java.lang.ClassCastException in JDBC driver's logger

xamry
New Contributor
Hi,
 
Our Java application is using latest version of Databricks JDBC driver (2.6.38). This application already uses Log4j 2.17.1 and SLF4J 2.0.13.
 
When querying data from Databricks, there are java.lang.ClassCastException printing on the console. Data is being fetched perfectly, and it happens the first time we query data. On subsequent times, there is no error on the console.
 
We tried disabling Databricks logging by passing LogLevel=0; in the connection URL, but it didn't help. We also tried changing versions of Log4J and SLF4J in classpath. We're not using log4j.xml or log4j.properties. Our logger settings are made programmatically.
 
It seems, the Log4J related classes in JDBC driver are somehow conflicting with the Log4J we're using, and failing to initialize Databrick's inbuilt logger.
 
How can we solve this problem? These console errors are problematic and raising false alarm with our customers:
 
Please below error stacktrace snippet on console: (Complete stacktrace is attacked)
--------------------------------------------------
ERROR StatusLogger Unable to create custom ContextSelector. Falling back to default.
 java.lang.ClassCastException: Cannot cast org.apache.logging.log4j.core.async.AsyncLoggerContextSelector to com.databricks.client.jdbc42.internal.apache.logging.log4j.core.selector.ContextSelector
at java.lang.Class.cast(Class.java:3397)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.util.LoaderUtil.newCheckedInstanceOf(LoaderUtil.java:206)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.util.LoaderUtil.newCheckedInstanceOfProperty(LoaderUtil.java:230)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.util.Loader.newCheckedInstanceOfProperty(Loader.java:338)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.impl.Log4jContextFactory.createContextSelector(Log4jContextFactory.java:100)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.impl.Log4jContextFactory.<init>(Log4jContextFactory.java:61)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.LogManager.<clinit>(LogManager.java:95)
at com.databricks.client.jdbc42.internal.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:55)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:47)
at com.databricks.client.jdbc42.internal.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:33)
at com.databricks.client.jdbc42.internal.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
at com.databricks.client.jdbc42.internal.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
at com.databricks.client.jdbc42.internal.apache.arrow.memory.BaseAllocator.<clinit>(BaseAllocator.java:46)
at com.databricks.client.spark.arrow.ArrowBuffer.<init>(Unknown Source)
at com.databricks.client.spark.jdbc.SparkJDBC42Driver.createArrowBuffer(Unknown Source)
at com.databricks.client.hivecommon.api.HS2Client.makeRowsetBuffer(Unknown Source)
at com.databricks.client.hivecommon.dataengine.BackgroundFetcher.<init>(Unknown Source)
at com.databricks.client.hivecommon.dataengine.HiveJDBCResultSet.moveToNextRow(Unknown Source)
at com.databricks.client.jdbc.common.BaseForwardResultSet.next(Unknown Source)
at com.impetus.interaj.dataprovider.rdbms.RDBMSResultSet.checkResultsetStatus(RDBMSResultSet.java:2141)
at com.impetus.interaj.dataprovider.rdbms.RDBMSResultSet.run(RDBMSResultSet.java:2159)
at com.impetus.interaj.utils.IntellicusThreadExecutor.lambda$1(IntellicusThreadExecutor.java:189)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)
ERROR StatusLogger Unable to create Lookup for bundle
 java.lang.ClassCastException: class org.apache.logging.log4j.core.lookup.ResourceBundleLookup
at java.lang.Class.asSubclass(Class.java:3432)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.lookup.Interpolator.<init>(Interpolator.java:84)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.lookup.Interpolator.<init>(Interpolator.java:105)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.config.AbstractConfiguration.<init>(AbstractConfiguration.java:135)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.config.NullConfiguration.<init>(NullConfiguration.java:32)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.LoggerContext.<clinit>(LoggerContext.java:74)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.selector.ClassLoaderContextSelector.createContext(ClassLoaderContextSelector.java:254)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.selector.ClassLoaderContextSelector.locateContext(ClassLoaderContextSelector.java:218)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:136)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:123)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:117)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:150)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.LogManager.getContext(LogManager.java:196)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:137)
at com.databricks.client.jdbc42.internal.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:61)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:47)
at com.databricks.client.jdbc42.internal.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:33)
at com.databricks.client.jdbc42.internal.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
at com.databricks.client.jdbc42.internal.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
at com.databricks.client.jdbc42.internal.apache.arrow.memory.BaseAllocator.<clinit>(BaseAllocator.java:46)
at com.databricks.client.spark.arrow.ArrowBuffer.<init>(Unknown Source)
at com.databricks.client.spark.jdbc.SparkJDBC42Driver.createArrowBuffer(Unknown Source)
at com.databricks.client.hivecommon.api.HS2Client.makeRowsetBuffer(Unknown Source)
at com.databricks.client.hivecommon.dataengine.BackgroundFetcher.<init>(Unknown Source)
at com.databricks.client.hivecommon.dataengine.HiveJDBCResultSet.moveToNextRow(Unknown Source)
at com.databricks.client.jdbc.common.BaseForwardResultSet.next(Unknown Source)
at com.impetus.interaj.dataprovider.rdbms.RDBMSResultSet.checkResultsetStatus(RDBMSResultSet.java:2141)
at com.impetus.interaj.dataprovider.rdbms.RDBMSResultSet.run(RDBMSResultSet.java:2159)
at com.impetus.interaj.utils.IntellicusThreadExecutor.lambda$1(IntellicusThreadExecutor.java:189)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)
ERROR StatusLogger Unable to create Lookup for ctx
 java.lang.ClassCastException: class org.apache.logging.log4j.core.lookup.ContextMapLookup
at java.lang.Class.asSubclass(Class.java:3432)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.lookup.Interpolator.<init>(Interpolator.java:84)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.lookup.Interpolator.<init>(Interpolator.java:105)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.config.AbstractConfiguration.<init>(AbstractConfiguration.java:135)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.config.NullConfiguration.<init>(NullConfiguration.java:32)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.LoggerContext.<clinit>(LoggerContext.java:74)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.selector.ClassLoaderContextSelector.createContext(ClassLoaderContextSelector.java:254)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.selector.ClassLoaderContextSelector.locateContext(ClassLoaderContextSelector.java:218)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:136)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:123)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:117)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:150)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.LogManager.getContext(LogManager.java:196)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:137)
at com.databricks.client.jdbc42.internal.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:61)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:47)
at com.databricks.client.jdbc42.internal.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:33)
at com.databricks.client.jdbc42.internal.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
at com.databricks.client.jdbc42.internal.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
at com.databricks.client.jdbc42.internal.apache.arrow.memory.BaseAllocator.<clinit>(BaseAllocator.java:46)
at com.databricks.client.spark.arrow.ArrowBuffer.<init>(Unknown Source)
at com.databricks.client.spark.jdbc.SparkJDBC42Driver.createArrowBuffer(Unknown Source)
at com.databricks.client.hivecommon.api.HS2Client.makeRowsetBuffer(Unknown Source)
at com.databricks.client.hivecommon.dataengine.BackgroundFetcher.<init>(Unknown Source)
at com.databricks.client.hivecommon.dataengine.HiveJDBCResultSet.moveToNextRow(Unknown Source)
at com.databricks.client.jdbc.common.BaseForwardResultSet.next(Unknown Source)
at com.impetus.interaj.dataprovider.rdbms.RDBMSResultSet.checkResultsetStatus(RDBMSResultSet.java:2141)
at com.impetus.interaj.dataprovider.rdbms.RDBMSResultSet.run(RDBMSResultSet.java:2159)
at com.impetus.interaj.utils.IntellicusThreadExecutor.lambda$1(IntellicusThreadExecutor.java:189)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)
ERROR StatusLogger Unable to create Lookup for date
 java.lang.ClassCastException: class org.apache.logging.log4j.core.lookup.DateLookup
at java.lang.Class.asSubclass(Class.java:3432)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.lookup.Interpolator.<init>(Interpolator.java:84)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.lookup.Interpolator.<init>(Interpolator.java:105)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.config.AbstractConfiguration.<init>(AbstractConfiguration.java:135)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.config.NullConfiguration.<init>(NullConfiguration.java:32)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.LoggerContext.<clinit>(LoggerContext.java:74)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.selector.ClassLoaderContextSelector.createContext(ClassLoaderContextSelector.java:254)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.selector.ClassLoaderContextSelector.locateContext(ClassLoaderContextSelector.java:218)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:136)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:123)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:117)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:150)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.LogManager.getContext(LogManager.java:196)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:137)
at com.databricks.client.jdbc42.internal.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:61)
at com.databricks.client.jdbc42.internal.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:47)
at com.databricks.client.jdbc42.internal.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:33)
at com.databricks.client.jdbc42.internal.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
at com.databricks.client.jdbc42.internal.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
at com.databricks.client.jdbc42.internal.apache.arrow.memory.BaseAllocator.<clinit>(BaseAllocator.java:46)
at com.databricks.client.spark.arrow.ArrowBuffer.<init>(Unknown Source)
at com.databricks.client.spark.jdbc.SparkJDBC42Driver.createArrowBuffer(Unknown Source)
at com.databricks.client.hivecommon.api.HS2Client.makeRowsetBuffer(Unknown Source)
at com.databricks.client.hivecommon.dataengine.BackgroundFetcher.<init>(Unknown Source)
at com.databricks.client.hivecommon.dataengine.HiveJDBCResultSet.moveToNextRow(Unknown Source)
at com.databricks.client.jdbc.common.BaseForwardResultSet.next(Unknown Source)
at com.impetus.interaj.dataprovider.rdbms.RDBMSResultSet.checkResultsetStatus(RDBMSResultSet.java:2141)
at com.impetus.interaj.dataprovider.rdbms.RDBMSResultSet.run(RDBMSResultSet.java:2159)
at com.impetus.interaj.utils.IntellicusThreadExecutor.lambda$1(IntellicusThreadExecutor.java:189)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)
 
0 REPLIES 0

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group