Have a look into org.jboss.resource.adapter.jdbc.vendor for some vendor specific ExceptionSorter implementations (currently only Oracle/Sybase). I am not sure, but I guess that a propper ExceptionSorter implementation for your database might do the job. By returning true for a fatal error (based on the database specific error code) the associated connection should be removed from the connection pool by the connection manager (at least this is my expectation ?!?) If you follow this guess, please give a feedback on success/failure.
Thanks Ulf for the tip. It wasn't directly applicable as I am using JMS which doesn't have any relations to jdbc and ExceptionSorter. However, it pointed me in the right direction.
I've solved this problem using the following approach:
1. The problem is that the JmsManagedConnection does not register an ExceptionListener for the JMS Connection.
2. I extended the JmsManagedConnection class with my own. My version of setup() sets an exception listener on the JMS Connection.
3. I also extended the JmsManagedConnectionFactory so that it instantiates my extended version of JmsManagedConnection.
4. I then created a new JMS RAR which defines a new Jms Provider which uses my extended JmsManagedConnectionFactory.
5. I then create a new pool of JMS Connections, and use this pool.
It works. There's one bit that's messy: How the exception listener removes the connection from the pool. I couldn't figure this one out. Trying to destroy the ManagedConnection doesn't work, because it will only be flushed from the pool after one user tries to use it (and gets an error that the ManagedConnection has been destroyd).
So, because I was desperate I hacked it so that it calls the flush() method on the ManagedConnectionPool MBean.
If anyone knows how a ManagedConnection can remove itself from a ManagedConnectionPool cleanly without being used anymore, I'd love to hear it.
Thanks to all who considered this problem,
Excellent. I see now why the ManagedConnections do not get flushed from the pool on a ConnectionError.
Thanks all again.
I face similiar problems for failover for HAJMS when singleton node moves.
I tried the link posted by firstname.lastname@example.org at last-two reply
which does not make sense for me.
Arisa, Can you explain what is your point?