Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassCastException on XA transaction - software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ClientPreparedStatement #401

Closed
AnshulJain1917 opened this issue Apr 28, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@AnshulJain1917
Copy link

Describe the bug

We are using atomikos transaction manager with aws-jdbc driver, during the query execution using the prepared statement we are getting an error as java.lang.ClassCastException: com.sun.proxy.$Proxy878 cannot be cast to software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ClientPreparedStatement

`[main] WARN atomikos - regdb_mysqlXADBMS: refreshed XAResource
[main] WARN atomikos - norm_mysqlXADBMS: refreshed XAResource
[main] WARN atomikos - norm_trial_mysqlXADBMS: refreshed XAResource
[main] WARN atomikos - wh_mysqlXADBMS: refreshed XAResource
[main] INFO atomikos - USING core version: 3.6.5
[main] INFO atomikos - USING com.atomikos.icatch.console_file_name = tm.out
[main] INFO atomikos - USING com.atomikos.icatch.console_file_count = 1
[main] INFO atomikos - USING com.atomikos.icatch.automatic_resource_registration = true
[main] INFO atomikos - USING com.atomikos.icatch.client_demarcation = false
[main] INFO atomikos - USING com.atomikos.icatch.threaded_2pc = true
[main] INFO atomikos - USING com.atomikos.icatch.serial_jta_transactions = false
[main] INFO atomikos - USING com.atomikos.icatch.log_base_dir = .
[main] INFO atomikos - USING com.atomikos.icatch.console_log_level = WARN
[main] INFO atomikos - USING com.atomikos.icatch.max_actives = -1
[main] INFO atomikos - USING com.atomikos.icatch.checkpoint_interval = 500
[main] INFO atomikos - USING com.atomikos.icatch.enable_logging = false
[main] INFO atomikos - USING com.atomikos.icatch.lock_logs = false
[main] INFO atomikos - USING com.atomikos.icatch.output_dir = .
[main] INFO atomikos - USING com.atomikos.icatch.log_base_name = tmlog
[main] INFO atomikos - USING com.atomikos.icatch.console_file_limit = -1
[main] INFO atomikos - USING com.atomikos.icatch.max_timeout = 3600000
[main] INFO atomikos - USING java.naming.factory.initial = com.sun.jndi.rmi.registry.RegistryContextFactory
[main] INFO atomikos - USING com.atomikos.icatch.tm_unique_name = 192.168.29.250.tm
[main] INFO atomikos - USING java.naming.provider.url = rmi://localhost:1099
[main] INFO atomikos - USING com.atomikos.icatch.service = com.atomikos.icatch.standalone.UserTransactionServiceFactory
[main] INFO atomikos - USING com.atomikos.icatch.force_shutdown_on_vm_exit = false
[main] INFO atomikos - USING com.atomikos.icatch.default_jta_timeout = 10000
2023-04-28 11:40:48,924 [main] com.product.core.search.ext.AppConfigPropertyLoader ERROR - [Enterprise :] [User:] exception occurred while loading the properties file..The security token included in the request is expired (Service: SecretsManager, Status Code: 400, Request ID: 1435d58e-3fed-4042-a87e-1725a3a047ee)
2023-04-28 11:40:50,629 [main] com.product.core.server.preference.UserPreferences INFO - [Enterprise :] [User:] LRUMap MAX_SIZE System Property:null
2023-04-28 11:40:50,633 [main] com.product.core.server.preference.UserPreferences INFO - [Enterprise :] [User:] LRUMap MAX_SIZE set as:500
2023-04-28 11:41:03,514 [main] com.product.core.rules.agent.RuleBaseAgentCache INFO - [Enterprise :] [User:] RuleBaseAgentCache instance created..
2023-04-28 11:41:04,497 [main] com.product.core.custom.event.multicaster.SMXApplicationEventMulticaster INFO - [Enterprise :] [User:] Event added to synchronousevent listener: org.springframework.security.concurrent.SessionRegistryImpl@fefb1c
2023-04-28 11:41:05,476 [main] com.product.core.custom.event.multicaster.SMXApplicationEventMulticaster INFO - [Enterprise :] [User:] Event added to synchronousevent listener: org.springframework.security.event.authentication.LoggerListener@db6183a
[main] INFO com.nice.smx.aws.sqs.client.SQSClient - SQS Client Initialized
[main] WARN atomikos - Attempt to create a transaction with a timeout that exceeds com.atomikos.icatch.max_timeout - truncating to: 3600000
[main] INFO atomikos - createCompositeTransaction ( 5000000 ): created new ROOT transaction with id 192.168.29.250.tm0000100024
[main] INFO atomikos - commit() done (by application) of transaction 192.168.29.250.tm0000100024
[main] WARN atomikos - Attempt to create a transaction with a timeout that exceeds com.atomikos.icatch.max_timeout - truncating to: 3600000
[main] INFO atomikos - createCompositeTransaction ( 5000000 ): created new ROOT transaction with id 192.168.29.250.tm0000200024
[main] INFO atomikos - commit() done (by application) of transaction 192.168.29.250.tm0000200024
[main] WARN atomikos - Attempt to create a transaction with a timeout that exceeds com.atomikos.icatch.max_timeout - truncating to: 3600000
[main] INFO atomikos - createCompositeTransaction ( 5000000 ): created new ROOT transaction with id 192.168.29.250.tm0000300024
[main] INFO atomikos - AtomikosDataSoureBean 'regdb_mysqlXADBMS': getConnection ( null )...
[main] INFO atomikos - AtomikosDataSoureBean 'regdb_mysqlXADBMS': init...
[main] INFO atomikos - setting isolation level to 2
[main] INFO atomikos - atomikos connection proxy for software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ConnectionWrapper@14200fed: calling toString...
[main] INFO atomikos - atomikos connection proxy for software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ConnectionWrapper@14200fed: calling toString...
[main] INFO atomikos - atomikos connection proxy for software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ConnectionWrapper@14200fed: calling getMetaData...
[main] INFO atomikos - addParticipant ( XAResourceTransaction: 3139322E3136382E32392E3235302E746D30303030333030303234:3139322E3136382E32392E3235302E746D31 ) for transaction 192.168.29.250.tm0000300024
[main] INFO atomikos - XAResource.start ( 3139322E3136382E32392E3235302E746D30303030333030303234:3139322E3136382E32392E3235302E746D31 , XAResource.TMNOFLAGS ) on resource regdb_mysqlXADBMS represented by XAResource instance software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.MysqlXAConnection@4aa39a18
[main] INFO atomikos - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@f7ceaf81 ) for transaction 192.168.29.250.tm0000300024
[main] INFO atomikos - atomikos connection proxy for software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ConnectionWrapper@14200fed: calling prepareStatement...
[main] INFO atomikos - atomikos connection proxy for software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ConnectionWrapper@14200fed: calling toString...
[main] INFO atomikos - atomikos connection proxy for software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ConnectionWrapper@14200fed: calling toString...
2023-04-28 11:41:38,104 [main] com.product.core.server.persistence.spi.ibatis.sqlmap.engine.execution.SqlExecutor WARN - WARNING FOR NON-TIMINGOUT QUERY Query Statement: SELECT * FROM some_table WHERE column1 = ? AND column2 = ? with Query Parameters: [null, ENTERPRISE] FAILED AFTER 1682662298 seconds WHILE TIMEOUT VALUE IS 0
[main] INFO atomikos - atomikos connection proxy for software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ConnectionWrapper@14200fed: calling getMetaData...
[main] INFO atomikos - atomikos connection proxy for software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ConnectionWrapper@14200fed: close()...
[main] INFO atomikos - XAResource.end ( 3139322E3136382E32392E3235302E746D30303030333030303234:3139322E3136382E32392E3235302E746D31 , XAResource.TMSUCCESS ) on resource regdb_mysqlXADBMS represented by XAResource instance software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.MysqlXAConnection@4aa39a18
[Atomikos:5] INFO atomikos - XAResource.rollback ( 3139322E3136382E32392E3235302E746D30303030333030303234:3139322E3136382E32392E3235302E746D31 ) on resource regdb_mysqlXADBMS represented by XAResource instance software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.MysqlXAConnection@4aa39a18
[main] INFO atomikos - rollback() done of transaction 192.168.29.250.tm0000300024
2023-04-28 11:41:38,145 [main] com.product.core.util.BaseClassPathXmlApplicationContext WARN - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'providerFileTransformUtil' defined in URL [***]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.product.core.server.persistence.io.importer.ProviderFileTransformUtil]: Constructor threw exception; nested exception is org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0];
--- The error occurred in ***.
--- The error occurred while executing query.
--- Check the SELECT * FROM some_table WHERE column1 = ? AND column2 = ? .
--- Check the SQL Statement (preparation failed).
--- Cause: java.lang.ClassCastException: com.sun.proxy.$Proxy878 cannot be cast to software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ClientPreparedStatement; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in ***.
--- The error occurred while executing query.
--- Check the SELECT * FROM some_table WHERE column1 = ? AND column2 = ? .
--- Check the SQL Statement (preparation failed).
--- Cause: java.lang.ClassCastException: com.sun.proxy.$Proxy878 cannot be cast to software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ClientPreparedStatement

at com.product.core.server.persistence.io.importer.SeedEnterprisesCommand.<init>(SeedEnterprisesCommand.java:65)
at com.product.core.server.persistence.io.importer.SeedEnterprisesCommand.main(SeedEnterprisesCommand.java:205)

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'providerFileTransformUtil' defined in URL [***]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.product.core.server.persistence.io.importer.ProviderFileTransformUtil]: Constructor threw exception; nested exception is org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0];
--- The error occurred in ***.
--- The error occurred while executing query.
--- Check the SELECT * FROM some_table WHERE column1 = ? AND column2 = ? .
--- Check the SQL Statement (preparation failed).
--- Cause: java.lang.ClassCastException: com.sun.proxy.$Proxy878 cannot be cast to software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ClientPreparedStatement; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in ***.
--- The error occurred while executing query.
--- Check the SELECT * FROM some_table WHERE column1 = ? AND column2 = ? .
--- Check the SQL Statement (preparation failed).
--- Cause: java.lang.ClassCastException: com.sun.proxy.$Proxy878 cannot be cast to software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ClientPreparedStatement
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1039)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:985)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:487)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:636)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:938)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:93)
at com.product.core.util.BaseClassPathXmlApplicationContext.(BaseClassPathXmlApplicationContext.java:66)
at com.product.core.util.BaseClassPathXmlApplicationContext.(BaseClassPathXmlApplicationContext.java:54)
at com.product.core.util.ClassPathXmlApplicationContextFactory.getApplicationContext(ClassPathXmlApplicationContextFactory.java:111)
at com.product.core.util.ClassPathXmlApplicationContextFactory.getApplicationContext(ClassPathXmlApplicationContextFactory.java:80)
at com.product.core.server.security.AuthenticationUtil.(AuthenticationUtil.java:47)
... 2 more
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.product.core.server.persistence.io.importer.ProviderFileTransformUtil]: Constructor threw exception; nested exception is org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0];
--- The error occurred in ***.
--- The error occurred while executing query.
--- Check the SELECT * FROM some_table WHERE column1 = ? AND column2 = ? .
--- Check the SQL Statement (preparation failed).
--- Cause: java.lang.ClassCastException: com.sun.proxy.$Proxy878 cannot be cast to software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ClientPreparedStatement; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in ***.
--- The error occurred while executing query.
--- Check the SELECT * FROM some_table WHERE column1 = ? AND column2 = ? .
--- Check the SQL Statement (preparation failed).
--- Cause: java.lang.ClassCastException: com.sun.proxy.$Proxy878 cannot be cast to software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ClientPreparedStatement
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1032)
... 19 more
Caused by: org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0];
--- The error occurred in ***.
--- The error occurred while executing query.
--- Check the SELECT * FROM some_table WHERE column1 = ? AND column2 = ? .
--- Check the SQL Statement (preparation failed).
--- Cause: java.lang.ClassCastException: com.sun.proxy.$Proxy878 cannot be cast to software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ClientPreparedStatement; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in ***.
--- The error occurred while executing query.
--- Check the SELECT * FROM some_table WHERE column1 = ? AND column2 = ? .
--- Check the SQL Statement (preparation failed).
--- Cause: java.lang.ClassCastException: com.sun.proxy.$Proxy878 cannot be cast to software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ClientPreparedStatement
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:206)
at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:296)
at com.product.core.server.persistence.BaseQueryDAO.queryBeanList(BaseQueryDAO.java:37)
at com.product.core.server.regdb.BaseRegistrationEntityManagerService.queryBeanList(BaseRegistrationEntityManagerService.java:355)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy600.queryBeanList(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at com.product.core.server.util.EntityManagerMethodInterceptor.invoke(EntityManagerMethodInterceptor.java:52)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy601.queryBeanList(Unknown Source)
at com.product.core.server.regdb.DefaultRegistrationEntityUtilService.getRegistrationBean(DefaultRegistrationEntityUtilService.java:2692)
at com.product.core.server.regdb.DefaultRegistrationEntityUtilService.getProductType(DefaultRegistrationEntityUtilService.java:4907)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy840.getProductType(Unknown Source)
at com.product.core.server.persistence.AuditHelper.getProductType(AuditHelper.java:357)
at com.product.core.server.security.SecurityContextUtil.isBasicProductType(SecurityContextUtil.java:1263)
at com.product.core.server.persistence.io.importer.ProviderFileTransformUtil.(ProviderFileTransformUtil.java:186)
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 org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148)
... 21 more
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in ***.
--- The error occurred while executing query.
--- Check the SELECT * FROM some_table WHERE column1 = ? AND column2 = ? .
--- Check the SQL Statement (preparation failed).
--- Cause: java.lang.ClassCastException: com.sun.proxy.$Proxy878 cannot be cast to software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ClientPreparedStatement
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:201)
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:136)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:440)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:423)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:119)
at org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:298)
at org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:296)
at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:203)
... 79 more
Caused by: java.lang.ClassCastException: com.sun.proxy.$Proxy878 cannot be cast to software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ClientPreparedStatement
at software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.PreparedStatementWrapper.toString(PreparedStatementWrapper.java:613)
at java.lang.String.valueOf(String.java:2994)
at java.lang.StringBuffer.append(StringBuffer.java:263)
at com.atomikos.jdbc.AtomikosConnectionProxy.invoke(AtomikosConnectionProxy.java:132)
at com.sun.proxy.$Proxy876.prepareStatement(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy$TransactionAwareInvocationHandler.invoke(TransactionAwareDataSourceProxy.java:239)
at com.sun.proxy.$Proxy875.prepareStatement(Unknown Source)
at com.product.core.server.persistence.spi.ibatis.sqlmap.engine.execution.SqlExecutor.prepareStatement(SqlExecutor.java:585)
at com.product.core.server.persistence.spi.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:253)
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery(MappedStatement.java:218)
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:186)
... 86 more
Disconnected from the target VM, address: '127.0.0.1:62534', transport: 'socket'
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0

Process finished with exit code 1
`

We are using the spring(v3.2.17) application in which bean is configured with xml based configurations. Please find the attached file for reference.
aws-ticket-jdbc.txt

Expected Behavior

User should be able to run the query with atomikos XA transaction manager and aws-jdbc driver

Current Behavior

Getting an error as java.lang.ClassCastException: com.sun.proxy.$Proxy878 cannot be cast to software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ClientPreparedStatement

Reproduction Steps

Run preparedstatement db operation with atomikos xa transaction manager (v3.6.5) and aws-jdbc driver (v1.1.5)

Possible Solution

No response

Additional Information/Context

No response

The AWS JDBC Driver for MySQL version used

1.1.5

JDK version used

JDK 8

Operating System and version

Windows 11 and Amazon Linux 2

@AnshulJain1917 AnshulJain1917 added the bug Something isn't working label Apr 28, 2023
@crystall-bitquill
Copy link
Contributor

Hi @AnshulJain1917

Thanks for reaching out to us and raising this issue.

We will be taking a look at this and keep you up to date with any updates as we investigate.

Thank you for your patience!

@crystall-bitquill
Copy link
Contributor

Hi @AnshulJain1917,

We've just merged a fix (#404) for the class cast exception, could you kindly check out our latest snapshot build and let us know if the issue persists?

Additionally, the logs you've provided contain a second error about an expired security token, so you may also need to verify that your tokens are up to date.

Thank you!

@crystall-bitquill
Copy link
Contributor

Hi @AnshulJain1917,

I wanted to check in to see if the issue was resolved with the snapshot build.

If there are no more updates on this ticket in the next few days, it will be closed. However, if you have any further questions or comments please feel free to create a new issue or to reopen this one.

Thank you!

@AnshulJain1917
Copy link
Author

Hi @crystall-bitquill ,
I verified that the fix solves our issue
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants