Search code examples
javahibernatejdbcweblogicweblogic12c

Microsoft JDBC driver ClassCastException thrown in Weblogic Datasource pool


This is probably the strangest error I have ever seen since working on Weblogic, and I have no way of resolving.

Currently on our Live server, we're experiencing an issue with our Weblogic datasource. It doesn't happen all the time, but every time it's happened, I've had to restart the whole server to resolve it. This is temporary, of course, but I'm trying to get to the root cause.

The error is thus:

java.lang.ClassCastException: com.microsoft.sqlserver.jdbc.SQLServerConnection cannot be cast to com.microsoft.sqlserver.jdbc.SQLServerConnection at weblogic.jdbc.wrapper.PoolConnection_com_microsoft_sqlserver_jdbc_SQLServerConnection.getAutoCommit(Unknown Source) at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:68) at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:162) at org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1471) at org.greenpole.hibernate.query.HibernateDataAccess.startOperation(HibernateDataAccess.java:43) at org.greenpole.hibernate.threads.dividend.retrieval.DividendWarrantNoMappingWorker_Thread.runner(DividendWarrantNoMappingWorker_Thread.java:51) at org.greenpole.hibernate.threads.dividend.retrieval.DividendWarrantNoMappingWorker_Thread.call(DividendWarrantNoMappingWorker_Thread.java:42) at org.greenpole.hibernate.threads.dividend.retrieval.DividendWarrantNoMappingWorker_Thread.call(DividendWarrantNoMappingWorker_Thread.java:28) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

I'm confused. How is it that SQLServerConnection suddenly can't be cast to SQLServerConnection? Aren't they the same thing?

EDIT:

So, I did a datasource reset and it corrected the error. But I'm still bothered about why it happened in the first place? Plus, this isn't the first time it's happened. So something happens to my datasource at some point, but what could it be?


Solution

  • Datasource reset did the trick. However, the reason for the issue still remains a mystery. It's never occurred again since then.