臭名昭著的java.sql.SQLException:找不到合適的驅動程序我正在嘗試將啟用數據庫的JSP添加到現有的Tomcat 5.5應用程序(Geoserver 2.0.0,如果這有幫助的話)。應用程序本身與Postgres的對話非常好,所以我知道數據庫已經啟動,用戶可以訪問它,所有這些都是好東西。我要做的是添加一個JSP中的數據庫查詢。我在Tomcat數據源示例幾乎是從盒子里拿出來的。必需的標記庫位于正確的位置-如果我只有taglib引用,就不會出現錯誤,所以它正在查找那些JAR。PostgresJDBC驅動程序PostgreSQL8.4.701.jdbc3.jar位于$Catalina_HOME/public/lib中。以下是JSP的頂部:<%@ 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/mmas">
select current_validstart as ValidTime from runoff_forecast_valid_time</sql:query>$Catalina_HOME/conf/server.xml中的相關部分<Host>它反過來又在<Engine>:<Context path="/gs2" allowLinking="true">
<Resource name="jdbc/mmas" type="javax.sql.Datasource"
auth="Container" driverClassName="org.postgresql.Driver"
maxActive="100" maxIdle="30" maxWait="10000"
username="mmas" password="very_secure_yess_precious!"
url="jdbc:postgresql//localhost:5432/mmas" /></Context>這些行是webapp/gs2/web-INF/web.xml中標記中的最后一行:<resource-ref>
<description>
The database resource for the MMAS PostGIS database
</description>
<res-ref-name>
jdbc/mmas </res-ref-name>
<res-type>
javax.sql.DataSource </res-type>
<res-auth>
Container </res-auth></resource-ref>最后,例外情況: exception
org.apache.jasper.JasperException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"
[...wads of ensuing goo elided]
臭名昭著的java.sql.SQLException:找不到合適的驅動程序
阿晨1998
2019-06-01 10:42:11