Application logging throws vfrtshadow ClassCastException
Overview of the Issue
This issue occurs in the following circumstances:
- The vFunction Sudo or Sudoless Controller Installation TGZ is installed in a Linux environment
- An Application Server is used to run the JVM
- 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:
- SSH or RDP to the VM running the Application where the vFunction Agent is installed
- Open the installation.yaml associated with the instance
- Linux Sudo sample location: /etc/sysconfig/vfunction/installation/instances/default-java/installation.yaml
- Linux Sudoless sample location: /tmp/vfunction/etc/sysconfig/vfunction/installation/instances/default-java/installation.yaml
- Windows sample location: C:\vfunction\config\installation\instances\default-java\installation.yaml
- To the agent.override_properties, add the following Keys and Values:
### 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
- Run the upgrade.sh script
- Linux Sudo sample upgrade flow: sudo bash /opt/vfunction/controller-installation/upgrade.sh -i default-java
- Linux Sudoless sample upgrade flow: bash /tmp/vfunction/opt/vfunction/controller-installation/upgrade.sh -i default-java
- Windows sample upgrade flow: powershell -NoProfile -ExecutionPolicy unrestricted -Command “C:\vfunction\controller-installation\upgrade.ps1 -instance default-java”
- Restart the JVM