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)
Sample Error #3
Oct 28, 2025 10:53:22 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class [com.organization.ui.utilities.WebAppInitializationPostSpring]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mainDataSource' defined in class path resource [com/organization/domainimpl/spring/domain-impl-datasource-context.xml]: Invocation of init method failed; nested exception is com.atomikos.jdbc.AtomikosSQLException: Cannot initialize AtomikosDataSourceBean
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1514)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean_vfun_aroundBody0(AbstractAutowireCapableBeanFactory.java:456)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$VfunAjcClosure1.run(AbstractAutowireCapableBeanFactory.java:1)
	at vfrtshadow.org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:164)
	at com.vfunction.analysis.aspects.spring.SpringCreateBeanAspect.aroundNewBeanInstance(SpringCreateBeanAspect.java:111)
	.....
Caused by: com.atomikos.jdbc.AtomikosSQLException: Cannot initialize AtomikosDataSourceBean
	at com.atomikos.jdbc.AtomikosSQLException.throwAtomikosSQLException(AtomikosSQLException.java:29)
	at com.atomikos.jdbc.AbstractDataSourceBean.init(AbstractDataSourceBean.java:310)
	...
Caused by: java.lang.ClassCastException: vfrtshadow.com.p6spy.engine.wrapper.ConnectionWrapper cannot be cast to oracle.jdbc.OracleConnection
	at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:296)
	at oracle.jdbc.xa.client.OracleXADataSource.getPooledConnection(OracleXADataSource.java:472)
	at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:156)
	at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:101)
	at com.atomikos.datasource.xa.jdbc.JdbcTransactionalResource.createXAConnection(JdbcTransactionalResource.java:167)
	at com.atomikos.datasource.xa.jdbc.JdbcTransactionalResource.refreshXAConnection(JdbcTransactionalResource.java:100)
	at com.atomikos.datasource.xa.XATransactionalResource.refreshXAResource(XATransactionalResource.java:459)
	at com.atomikos.datasource.xa.XATransactionalResource.recover(XATransactionalResource.java:451)
	at com.atomikos.datasource.xa.XATransactionalResource.setRecoveryService(XATransactionalResource.java:416)
	at com.atomikos.icatch.config.Configuration.addResource(Configuration.java:249)
	at com.atomikos.jdbc.AtomikosDataSourceBean.doInit(AtomikosDataSourceBean.java:183)
	at com.atomikos.jdbc.AbstractDataSourceBean.init(AbstractDataSourceBean.java:292)
	... 64 more


Steps to Resolve the Issue

This issue can be resolved by taking the following steps:

  1. SSH or RDP to the VM running the Application where the vFunction Agent is installed
  2. 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
  1. Modify the agent.disable_jdbc settings:
### Before
agent:
  disable_jdbc: false


### After
agent:
  disable_jdbc: true
  1. 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”
  1. Restart the JVM
  2. If an issue occurs with the alternative vFunction DB Tracking mechanism in place, use the OpenTelemetry Java Agent to gather DB Tracking details by opening the installation.yaml associated with the instance
  3. Modify the agent.override_properties setting:
### Before
agent:
  override_properties:
#    -key=value


### After
agent:
  override_properties:
    - com.vfunction.runtime.config.aop.xml.db.tracking.enabled=false
    - com.vfunction.runtime.config.aop.xml.db.tracking.jdbcdriver.enabled=false
    - com.vfunction.runtime.config.aop.xml.otel.jdbc.enabled=true
  1. 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”
  1. Download the OpenTelemetry Java Agent
  2. Add the downloaded OpenTelemetry Java JAR to the filesystem of the Application. For example, it could be added to the base, “vfunction” directory used to install the vFunction Agent
  3. Add the following JVM arguments in addition to what previously existed:
### Replace $PATH_TO with the actual location of the file

-javaagent:/$PATH_TO/opentelemetry-javaagent.jar -Dotel.exporter.otlp.protocol=http/protobuf -Dotel.instrumentation.common.default-enabled=false -Dotel.instrumentation.jdbc.enabled=true -Dotel.metrics.exporter=none -Dotel.logs.exporter=none -Dotel.traces.exporter=none
  1. Restart the JVM
  2. If an issue occurs with the both the alternative vFunction DB Tracking mechanism and the OpenTelemetry Java Agent for gathering DB Tracking details, disable DB Tracking in the installation.yaml:
### Before
agent:
  override_properties:
#    - key=value


### After
agent:
  override_properties:
    - com.vfunction.runtime.config.aop.xml.db.tracking.enabled=false
    - com.vfunction.runtime.config.aop.xml.db.tracking.jdbcdriver.enabled=false
  1. Run the vFunction upgrade 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”
  1. Restart the JVM