0
votes

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?

1
What's your import for Connection? - user7294900
Sounds like you have the SQL Server driver in the global classpath of weblogic and in the classpath of your web application itslef. Remove one of those (the one from your web application would probably be best). Classes loaded from different classloaders are separate entities, even if they have the same name. - Mark Rotteveel

1 Answers

0
votes

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