| Author |
JBoss JSTL Datasource issue
|
MK Shikarpuri
Greenhorn
Joined: Jan 21, 2004
Posts: 9
|
|
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 racle: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
|
 |
Jaikiran Pai
Marshal
Joined: Jul 20, 2005
Posts: 8147
|
|
Can you post the entire exception stacktrace? Also, where have you placed the jar file containing the database driver?
|
[My Blog] [JavaRanch Journal]
|
 |
MK Shikarpuri
Greenhorn
Joined: Jan 21, 2004
Posts: 9
|
|
Got it working. Had to remove the "var" variable from the <sql:setDatasource> tag <sql:setDataSource dataSource="java:/jdbc/oracleDS"/>
|
 |
 |
|
|
subject: JBoss JSTL Datasource issue
|
|
|