<!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;">
    can not be javax.naming.Reference cast to javax.sql.DataSource
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/gutiaes1024">Oscar Gutierrez</a> in <i>Datasource Configuration</i> - <a href="http://community.jboss.org/message/630156#630156">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hello everyone,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I have trouble getting a JBoss JNDI datasorce of thing happens in particular in windows works correctly at the time of making the lookup of the datasource, but when I do the same exercise in linux I get an error "can not be javax.naming.Reference cast to javax.sql.DataSource " I have tried several ways to solve the problem but I could not,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>has been added to the project all.jar&#160; jbossclient, but the error continues.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>the following test to verify that the lookup was not null, then perform a print of the object, trying to cast the datasource&#160; object to get the following exception can not be cast to javax.naming.Reference&#160; javax.sql.DataSource.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>EXAMPLE</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>DataSource ds = null;</p><p>Connection conn = null;</p><p>Object obj = initContext.lookup("jdbc/gestdoc");</p><p>System.out.println(obj.toString());</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>print console:</p><p>--------------------</p><p>Reference Class Name: javax.sql.DataSource</p><p>Address Type: ProxyData</p><p>AddressContents: ffffffac ffffffed 0 5 73 7d 0 0 0 1 0 14 6a 61 76 61 78 2e 73 71 6c 2e 44 61 74 61 53 6f 75 72 63 65&#160; ...</p><p>Address Type: VMID</p><p>AddressContents: ffffffac ffffffed 0 5 73 72 0 13 6a 61 76 61 2e 72 6d 69 2e 73 65 72 76 65 72 2e 55 49 44 f 12 70 d ffffffbf&#160; ...</p><p>Type: JndiName</p><p>Content: jdbc/gestdoc</p><p>------------------</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>ds = (javax.sql.DataSource)obj;//Generate Exception -&gt; javax.naming.Reference cannot be cast to javax.sql.DataSource</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>the definition xml of the datasource for oracle</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</p><p>&lt;datasources&gt;</p><p>&lt;local-tx-datasource&gt;</p><p>&lt;jndi-name&gt;jdbc/gestdoc&lt;/jndi-name&gt;</p><p>&lt;use-java-context&gt;false&lt;/use-java-context&gt;</p><p>&lt;connection-url&gt;jdbc:oracle:thin:@localhost:1521:xe&lt;/connection-url&gt;</p><p>&lt;driver-class&gt;oracle.jdbc.driver.OracleDriver&lt;/driver-class&gt;</p><p>&lt;user-name&gt;gestdoc&lt;/user-name&gt;</p><p>&lt;password&gt;gestdoc&lt;/password&gt;</p><p>&lt;check-valid-connection-sql&gt;SELECT 1 FROM DUAL&lt;/check-valid-connection-sql&gt;</p><p>&lt;exception-sorter-class-name&gt;org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter&lt;/exception-sorter-class-name&gt;</p><p>&lt;metadata&gt;</p><p>&lt;type-mapping&gt;Oracle&lt;/type-mapping&gt;</p><p>&lt;/metadata&gt;</p><p>&lt;/local-tx-datasource&gt;</p><p>&lt;/datasources&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>thank you very much for the collaboration.</p></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/630156#630156">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>