jQuery in Action, 2nd edition*
The moose likes JBoss/WildFly and the fly likes JBOSS DataSource/Tomcat App - Unable to get connection, DataSource invalid Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "JBOSS DataSource/Tomcat App - Unable to get connection, DataSource invalid" Watch "JBOSS DataSource/Tomcat App - Unable to get connection, DataSource invalid" New topic
Author

JBOSS DataSource/Tomcat App - Unable to get connection, DataSource invalid

Pally Gharmount
Ranch Hand

Joined: Aug 25, 2004
Posts: 34
Let me first say what i am using...i am running Jboss 4.0.2 under windows with Apache Tomcat/5.5.9.

I am trying to deploy an JSTL application under tomcat that uses a data datasource defined in oracle-ds.xml.

Here is the steps I took...

1) Edited E:\Java\jboss-4.0.2\server\default\deploy\oracle-ds.xml

<local-tx-datasource>
<jndi-name>OracleDS</jndi-name>
<connection-url>jdbc racle:thin:@xxx.ad.bgs.ac.uk:1521:xx</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>xxx</user-name>
<password>xxx</password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
</local-tx-datasource>

2) Copied the Oracle Database drivers to E:\Java\jboss-4.0.2\server\default\lib\classes12.jar

3) I edited the file E:\Java\jboss-4.0.2\server\default\deploy\jbossweb-tomcat55.sar\server.xml and added the following line...

<Context path="/master" docBase="E:\Java\MasterContext" debug="1"></Context>

I know that works as I can access a basic JSP page with JSTL.

4) So far so good. Everything seems fine with the DataSource as I have deployed a J2EE app that uses it and it works fine...here is a quick snippet from the

<jbosscmp-jdbc>
<defaults>
<datasource>java:/OracleDS</datasource>
<datasource-mapping>Oracle8</datasource-mapping>
<create-table>false</create-table>
<remove-table>false</remove-table>
<read-only>true</read-only>
<pk-constraint>true</pk-constraint>
<preferred-relation-mapping>foreign-key</preferred-relation-mapping>
</defaults>

5) The problem happens when a try accessing a JSP page with the following JSTL code....dont think its the JSTL bit that's causing the problem

<sql:setDataSource var="Source"
driver="oracle.jdbc.driver.OracleDriver"
url="jdbc racle:thin:@xxx.ad.bgs.ac.uk:1521:xxx"
user="xxx" password="xxx" />

<sql:query var="courses" dataSource="${Source}">
SELECT ID, NAME, DESCRIPTION, ICON, SEQ FROM psg.BGS_DEVELOPERS_INDEX ORDER BY SEQ
</sql:query> <this works fine as i have explicitly defied the DataSource>

<sql:query var="courses2" dataSource="java racleDS">
SELECT ID, NAME, DESCRIPTION, ICON, SEQ FROM psg.BGS_DEVELOPERS_INDEX ORDER BY SEQ
</sql:query> <this is trying to use the DataSource defined oracle-ds.xml and doesnt work, see message below>

<c:forEach var="item" items="${courses.rows}">
<c ut value="${item.name}"/>
</c:forEach>


Error Message

javax.servlet.ServletException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
org.apache.jsp.psg.JSTLExample_jsp._jspService(org.apache.jsp.psg.JSTLExample_jsp:103)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JBOSS DataSource/Tomcat App - Unable to get connection, DataSource invalid