Web tier: servlets, JSP, Web frameworks: Having trouble with DataSource in Tomcat 4.0.4

  1. Having trouble with DataSource in Tomcat 4.0.4 (1 messages)

    Here is my server.xml entry (with substitutions):

    <Resource name="jdbc/sybase" auth="Container" type="javax.sql.DataSource" />
    <ResourceParams name="jdbc/sybase">

    Here is the JSP scriplet I am using to test it:

    try {
    Context ctx = new InitialContext();
    Context envCtx = (Context) ctx.lookup("java:comp/env");
    DataSource ds = (DataSource)envCtx.lookup("jdbc/sybase");
    Connection con = ds.getConnection();
    } catch(Exception ex) {
        out.println(ex); // print exception

    When I execute this page, I get this:
    javax.naming.NamingException: Exception creating DataSource: tyrex/jdbc/xa/EnabledDataSource

    In my Tomcat console I get a stack trace that starts with:

    TyrexDataSourceFactory: Cannot create DataSource, Exception
    java.lang.NoClassDefFoundError: tyrex/jdbc/xa/EnabledDataSource

    Any ideas? :p
  2. Put your JDBC driver in your classpath. That might work !