[jboss-user] [Datasource Configuration] - Re: Exception when testing Oracle datasource connections

Fibber McGee do-not-reply at jboss.com
Thu Sep 9 11:24:52 EDT 2010

fibber [http://community.jboss.org/people/fibber] created the discussion

"Re: Exception when testing Oracle datasource connections"

To view the discussion, visit: http://community.jboss.org/message/560463#560463

It seems to be a problem with the *testConnection()* method in *org.jboss.resource.connectionmanager.JBossManagedConnectionPool* because that's where the stack trace is pointing:

@ManagementOperation(description="Test if a connection can be obtained",

    public boolean  testConnection()
       boolean result = false;
       ConnectionListener cl = null;

       // first try to get connection with Subject
       if (poolingStrategy instanceof BasePool)
          BasePool basePool = (BasePool)poolingStrategy;
          if (basePool.clf instanceof BaseConnectionManager2)
             try {
                BaseConnectionManager2 baseConnectionMgr = (BaseConnectionManager2)basePool.clf;

*                // This is the line that is throwing the exception*
*                Subject subject = baseConnectionMgr.getSubjectFactory().createSubject(baseConnectionMgr.getSecurityDomainJndiName());*

                result = internalTestConnection(subject);
             catch ( Exception ignored )  // createSubject could throw security exception, ignore it

       // then try to get connection without Subject
       if (!result)
          result = internalTestConnection(null);
       return result;
    } http://grepcode.com/images/1x1.gif  (http://grepcode.com/images/1x1.gif)

Although I don't know why ignoring a security exception is a good thing, I find it strange that the exception is logged before being thrown - not always the best practice.  In any event, I'd like to know why this exception is occurring and how to get rid of it, if possible.  Of course, it's always possible that the answer is that this is simply a manifestation of some sloppiness or defect in the design, and I'll need to ignore exceptions created when I test my Oracle connection.

The reason that I can't currently accept this explanation is that the DefaultDS does not throw the exception when testing its connection, which leads me to believe that there is either something wrong with my Oracle datasource setup, or that the DefaultDS setup includes additional security configurations that I'm not aware of.

Reply to this message by going to Community

Start a new discussion in Datasource Configuration at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100909/d0e95ddd/attachment-0001.html 

More information about the jboss-user mailing list