If the context xml file is in /tomcat/apache-tomcat-5.5.26/conf/Catalina/localhost, it should be named after your webapp (e.g.: DBTest.xml). It's only named context.xml when in your webapp's META-INF folder.

--David

sam wun wrote:
After moved the context.xml file to /tomcat/apache-tomcat-5.5.26/conf/Catalina/localhost/

with the content changed to:

<Context>

    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>

<!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->
<Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"
               maxActive="100" maxIdle="30" maxWait="10000"
username="javauser" password="javadude" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/javatest" validationQuery="select 1" />
</Context>
(I have the exact db, table and username/password created like this).

And I have removed the context.xml file in webapps/DBTest/WEB-INF/lib/

My testdb.jsp in /tomcat/apache-tomcat-5.5.26/webapps/DBTest looks is shown below:

<%@ taglib uri="http://java.sun.com/jsp/jstl/sql"; prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>

<sql:query var="rs" dataSource="jdbc/TestDB">
select id, foo, bar from testdata
</sql:query>

<html>
  <head>
    <title>DB Test</title>
  </head>
  <body>

  <h2>Results</h2>

<c:forEach var="row" items="${rs.rows}">
    Foo ${row.foo}<br/>
    Bar ${row.bar}<br/>
</c:forEach>

  </body>
</html>



Then shudown and restarted tomcat server.


I m still getting the DataSource Invalid errors:



HTTP Status 500 -
type Exception report

message description The server encountered an internal error () that prevented it from fulfilling this request.

exception org.apache.jasper.JasperException: Unable to get connection, DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'"
        
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
        
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

root cause javax.servlet.ServletException: Unable to get connection, DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'"
        
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
        
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
        org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:82)
        org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)

...





        javax.servlet.http.HttpServlet.service(HttpServlet.java:803)



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to