Application logging throws vfrtshadow ClassCastException


Overview of the Issue

This issue occurs in the following circumstances:

  1. The vFunction Sudo or Sudoless Controller Installation TGZ is installed in a Linux environment
  2. An Application Server is used to run the JVM
  3. After adding the vFunction Agent Startup Parameters into the JVM, the Application is rebooted and the following error occurs
Sample Error #1
2023-10-02 10:47:03,033 [Thread-8] ERROR (LoggingFacility.java:89) -
2023-10-02 10:47:03,033 | 10021047031 | ERROR EventCreate [8007076372]
java.lang.ClassCastException:
vfrtshadow.com.p6spy.engine.wrapper.PreparedStatementWrapper cannot be cast to oracle.jdbc.OraclePreparedStatement
        at
com.organization.business.common.sql.GenericPreparedStatement.setFixedCharIntoPreparedStatement(GenericPreparedStatement.java:24)
        at
com.organization.business.common.sql.ShipmentDetailPreparedStatement$ShipDetailQueryBatchByAwbOrPidOrSdRecKeyPreparedStatementSetter.setValues(ShipmentDetailPreparedStatement.java:734)
        at org.springframework.jdbc.core.JdbcTemplate$1.doInP
Sample Error #2
ERROR|2024-03-12 11:58:08|[CacheUtil.java:89] com.organization.class.name.base.cache.CacheUtil| initializeAppCacheMap - Other error occured
  org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cacheDao': 
  Unsatisfied dependency expressed through field 'dataAccessManager'; 
  nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: 
  Error creating bean with name 'dataAccessManager' defined in com.organization.class.name.config.DataAccessManagerConfig: 
  Unsatisfied dependency expressed through method 'annotationDataAccessManager' parameter 0; 
  nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: 
  Error creating bean with name 'sqlSessionFactory' defined in com.organization.class.name.config.DataAccessManagerConfig: 
  Unsatisfied dependency expressed through method 'sqlSessionFactoryBean' parameter 0; 
  nested exception is org.springframework.beans.factory.BeanCreationException: 
  Error creating bean with name 'dataSource' defined in com.organization.class.name.config.DataAccessManagerConfig: 
  Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: 
  Failed to instantiate [com.organization.class.name.base.dataaccess.kerberos.DataSourceManager]: 
  Factory method 'dataSourceManager' threw exception; 
  nested exception is com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: 
  Failed to initialize pool: class vfrtshadow.com.p6spy.engine.wrapper.ConnectionWrapper cannot be cast to class 
  oracle.jdbc.driver.OracleConnection (vfrtshadow.com.p6spy.engine.wrapper.ConnectionWrapper is in unnamed module of loader 'app'; 
  oracle.jdbc.driver.OracleConnection is in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @233ece92)

Steps to Resolve the Issue

This issue can be resolved by taking the following steps:

  1. Open the installation.yaml for the vFunction Agent. For example, in /etc/sysconfig/vfunction/installation/instances/default-java/installation.yaml
  2. Modify the agent.override_properties:
## Before
agent:
  override_properties:
  #  - key=value


## After
agent:
  override_properties:
    - com.vfunction.runtime.config.aop.xml.db.tracking.enabled=true
    - com.vfunction.runtime.config.aop.xml.db.tracking.jdbcdriver.enabled=false
  1. Run the upgrade.sh script. For example, bash /opt/vfunction/controller-installation/upgrade.sh -i default-java
  2. Restart the JVM