<!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;"> </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;"> </p><p>has been added to the project all.jar  jbossclient, but the error continues.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </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  object to get the following exception can not be cast to javax.naming.Reference  javax.sql.DataSource.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>EXAMPLE</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </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;"> </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  ...</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  ...</p><p>Type: JndiName</p><p>Content: jdbc/gestdoc</p><p>------------------</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>ds = (javax.sql.DataSource)obj;//Generate Exception -> javax.naming.Reference cannot be cast to javax.sql.DataSource</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>the definition xml of the datasource for oracle</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><?xml version="1.0" encoding="UTF-8"?></p><p><datasources></p><p><local-tx-datasource></p><p><jndi-name>jdbc/gestdoc</jndi-name></p><p><use-java-context>false</use-java-context></p><p><connection-url>jdbc:oracle:thin:@localhost:1521:xe</connection-url></p><p><driver-class>oracle.jdbc.driver.OracleDriver</driver-class></p><p><user-name>gestdoc</user-name></p><p><password>gestdoc</password></p><p><check-valid-connection-sql>SELECT 1 FROM DUAL</check-valid-connection-sql></p><p><exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name></p><p><metadata></p><p><type-mapping>Oracle</type-mapping></p><p></metadata></p><p></local-tx-datasource></p><p></datasources></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </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>