1 Reply Latest reply on Sep 24, 2007 9:40 AM by mkumar79

    JBoss JSTL Datasource issue

    mkumar79 Newbie

      JBoss version: jboss-4.2.1.GA

      Hello,
      I have configured my Oracle datasource successfully and it works but when I extract data using Connection Pool. But when I try to use the same datasource for a JSTL <sql:setDataSource> tag, I get the following error:

      org.apache.jasper.JasperException: An exception occurred processing JSP page /showAirCrafts.jsp at line 9

      7: <sql:setDataSource var="ds" dataSource="java:/jdbc/oracleDS"/>
      8:
      9: <sql:query dataSource="${ds}" var="date" sql="SELECT sysdate FROM DUAL"/>

      Stacktrace:
      org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:518)
      ...

      root cause

      javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "No suitable driver"


      *************** oracle-ds.xml ************

      <local-tx-datasource>
      <jndi-name>jdbc/oracleDS</jndi-name>
      <connection-url>
      jdbc:oracle:thin:@xxx.xxx.xx.xxx:1521:f35test
      </connection-url>
      <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
      <user-name>xxxxxx</user-name>
      xxxxxxx
      ...
      </local-tx-datasource>

      ************************************

      ***********DBConnection.java******(THIS WORKS)
      ...
      javax.sql.DataSource ds = (javax.sql.DataSource) initialContext
      .lookup("java:comp/env/jdbc/oracleDS");
      ...
      ************************************

      *******************jboss-web.xml*********
      ...
      <resource-ref>
      <res-ref-name>jdbc/pmaDS</res-ref-name>
      <jndi-name>java:/jdbc/pmaDS</jndi-name>
      </resource-ref>
      ...
      ***************************************

      ****************web.xml*****************
      ...
      <resource-ref>
      Oracle Connection
      <res-ref-name>jdbc/oracleDS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>
      ...
      ************************************

      **************JSP (THIS DOESN'T WORK)*****
      <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
      ...
      <sql:setDataSource var="ds" dataSource="java:/jdbc/oracleDS"/>

      <sql:query dataSource="${ds}" var="date" sql="SELECT sysdate FROM DUAL"/>
      ...
      *****************************************


      I am new to JSTL. Any help would be appreciated.

      Thank you