Title: simultaneous deployment of Java Servlet and Database Connection Pool
Keyword: servlet connection pool
Author: jrq
Body:
Test the web application environment: Win2k Pro + Tomcat 5.0
Pay attention to the deployment sequence of the servlet and connection pool in the web. xml file of the Web application.
In the Web. xml file, in the <web-app> tag, you must first write <servlet> and <servlet-mapping>, and then write <resource-ref>.
Otherwise, the context of the Web application cannot be started normally when Tomcat is started, and the Web application cannot be accessed normally.
A simple example of Web. xml deployed in both the servlet and connection pool is as follows:
---------------
<Web-app>
<Servlet>
<Servlet-Name> query </servlet-Name>
<Servlet-class> bookquery </servlet-class>
</Servlet>
<Servlet-mapping>
<Servlet-Name> query </servlet-Name>
<URL-pattern>/query </url-pattern>
</Servlet-mapping>
<Resource-ref>
<Description> access datasource example </description>
<Res-ref-Name> JDBC/access </RES-ref-Name>
<Res-type> javax. SQL. datasource </RES-type>
<Res-auth> container </RES-auth>
</Resource-ref>
</Web-app>
------------------
by jrq
2004.11.30 in Shi