You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2001/09/21 02:03:08 UTC

DO NOT REPLY [Bug 3754] New: - DataSource Requires Tyrex

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3754>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3754

DataSource Requires Tyrex

           Summary: DataSource Requires Tyrex
           Product: Tomcat 4
           Version: 4.0 Final
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Unknown
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: dan@wellogic.com


I'm having some difficulty creating a DataSource using the default Tyrex 
factory provided in Tomcat 4.  In the DefaultContext, I have:
 
              <ResourceParams name="jdbc/SomeDB">
                  <parameter>
                      <name>user</name>
                      <value>username</value>
                  </parameter>
                  <parameter>
                      <name>password</name>
                      <value>pass</value>
                  </parameter>
                  <parameter>
                      <name>driverClassName</name>
                      <value>com.jnetdirect.jsql.JSQLDriver</value>
                  </parameter>
                  <parameter>
                      <name>driverName</name>
 
<value>jdbc:JSQLConnect://dbhost/database=somedata</value>
                  </parameter>
              </ResourceParams>
 
And in my code I:
 
            Context initCtx = new InitialContext();
            Context envCtx = (Context) initCtx.lookup("java:comp/env");
            DataSource ds = (DataSource) envCtx.lookup("jdbc/SomeDB");
            Connection conn = ds.getConnection();
 
However, at runtime, I get the following error on the third line of the above 
code fragment:
 
        java.lang.ClassCastException: tyrex.jdbc.xa.EnabledDataSource

If I change DataSource to EnabledDataSource, and import the appropriate Tyrex 
class, then things work perfectly, as expected, but shouldn't I be able to 
cast an EnabledDataSource to a DataSource?

I do not have the Tyrex jar in my classpath at compile time, and I don't 
believe I should have to.  I recognize this is probably a defect in Tyrex 
itself, but this certainly affects Tomcat's usability, and even it's 
specification compliance, from what I can tell.