tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <d...@cornell.edu>
Subject Re: Can't execute servlet project
Date Wed, 03 Sep 2008 02:32:11 GMT
Leave web.xml -- it's the global web.xml.  DBTest.xml can be removed 
without error.  It isn't harming anything here but at the same time it 
doesn't belong here.

--David

sam wun wrote:
> I found there are some xml file in the conf/ directory:
>
> linux:~/tomcat/apache-tomcat-5.5.26/conf # ls
> .   Catalina    catalina.policy      logging.properties  
> server.xml        web.xml
> ..  DBTest.xml  catalina.properties  server-minimal.xml  
> tomcat-users.xml
> linux:~/tomcat/apache-tomcat-5.5.26/conf #
>
> do I need to remove DBTest.xml and web.xml here?
>
> Thanks
>
> Sam
>
>
>
>   
>> ----- Original Message -----
>> From: sam wun
>> Sent: 03/09/08 11:13 am
>> To: Tomcat Users List
>> Subject: Re: Re: Can't execute servlet project
>>
>> 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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message