<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Re: Exception when testing Oracle datasource connections
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/fibber">fibber</a> in <i>Datasource Configuration</i> - <a href="http://community.jboss.org/message/560463#560463">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>It seems to be a problem with the <strong>testConnection()</strong> method in <strong>org.jboss.resource.connectionmanager.JBossManagedConnectionPool </strong>because that's where the stack trace is pointing:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><div class="line" id="line-375"> </div><div class="lnm" id="lnm-375"><span style="font-size: 8pt; font-family: courier new,courier; ">@ManagementOperation(description="Test if a connection can be obtained",<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; impact=Impact.WriteOnly)</span><p><span style="font-size: 8pt; font-family: courier new,courier; "><br/></span></p><span style="font-size: 8pt; font-family: courier new,courier; ">&#160;&#160;&#160; public boolean&#160; testConnection()<br/>&#160;&#160;&#160; {<br/>&#160;&#160;&#160;&#160;&#160;&#160; boolean result = false;<br/>&#160;&#160;&#160;&#160;&#160;&#160; ConnectionListener cl = null;</span><p><span style="font-size: 8pt; font-family: courier new,courier; "><br/></span></p></div><div class="lnm" id="lnm-375"><span style="font-size: 8pt; font-family: courier new,courier; ">&#160;&#160;&#160;&#160;&#160;&#160; // first try to get connection with Subject<br/>&#160;&#160;&#160;&#160;&#160;&#160; if (poolingStrategy instanceof BasePool)<br/>&#160;&#160;&#160;&#160;&#160;&#160; {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; BasePool basePool = (BasePool)poolingStrategy;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (basePool.clf instanceof BaseConnectionManager2)<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; try {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; BaseConnectionManager2 baseConnectionMgr = (BaseConnectionManager2)basePool.clf;</span></div><div class="lnm"><span style="font-size: 8pt; font-family: courier new,courier; "><br/></span></div><div class="lnm"> </div><div class="lnm"><p><span style="color: #000080;"><strong style=": ; font-size: 8pt; font-family: courier new,courier; ">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // This is the line that is throwing the exception</strong></span></p><p><span style="color: #000080;"><strong style=": ; font-size: 8pt; font-family: courier new,courier; ">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Subject subject = baseConnectionMgr.getSubjectFactory().createSubject(baseConnectionMgr.getSecurityDomainJndiName());</strong></span></p></div><div class="lnm"> </div><div class="lnm"> </div><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><div class="lnm"><span style="font-size: 8pt; font-family: courier new,courier; ">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; result = internalTestConnection(subject);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; catch ( Exception ignored )&#160; // createSubject could throw security exception, ignore it<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br/>&#160;&#160;&#160;&#160;&#160;&#160; }</span></div><div class="lnm"><p><span style="font-size: 8pt; font-family: courier new,courier; "><br/></span></p></div><div class="lnm"><span style="font-size: 8pt; font-family: courier new,courier; ">&#160;&#160;&#160;&#160;&#160;&#160; // then try to get connection without Subject<br/>&#160;&#160;&#160;&#160;&#160;&#160; if (!result)<br/>&#160;&#160;&#160;&#160;&#160;&#160; {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; result = internalTestConnection(null);<br/>&#160;&#160;&#160;&#160;&#160;&#160; }</span></div><div class="lnm"><span style="font-size: 8pt; font-family: courier new,courier; ">&#160;&#160;&#160;&#160;&#160;&#160; return result;<br/>&#160;&#160;&#160; }<a href="http://grepcode.com/images/1x1.gif"><span> http://grepcode.com/images/1x1.gif </span></a></span></div><div class="lnm"> </div><div class="lnm"> </div><div class="line"> </div><div class="line"> </div><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><div class="line">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.&#160; In any event, I'd like to know why this exception is occurring and how to get rid of it, if possible.&#160; 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.</div><div class="line"> </div><div class="line"> </div><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><div class="line">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.</div><div class="line"> </div></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/560463#560463">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in Datasource Configuration at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2077">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>