我正在尝试将已启用数据库的JSP添加到现有的Tomcat 5.5应用程序(GeoServer 2.0.0,如果有帮助的话).
该应用程序本身与Postgres谈话很好,所以我知道数据库已启动,用户可以访问它,所有这些好东西.我想要做的是在我添加的JSP中的数据库查询.我已经在Tomcat数据源示例中使用了配置示例,非常开箱即用.必要的taglibs位于正确的位置 - 如果我只有taglib refs就不会发生错误,因此它会找到那些JAR.postgres jdbc驱动程序postgresql-8.4.701.jdbc3.jar位于$ CATALINA_HOME/common/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>
Run Code Online (Sandbox Code Playgroud)
来自$ 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>
Run Code Online (Sandbox Code Playgroud)
这些行是webapps/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>
Run Code Online (Sandbox Code Playgroud)
最后,例外:
exception
org.apache.jasper.JasperException: Unable …Run Code Online (Sandbox Code Playgroud) 由于Tomcat中的孤立线程,我遇到了内存泄漏.特别是,似乎Guice和JDBC驱动程序没有关闭线程.
Aug 8, 2012 4:09:19 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: A web application appears to have started a thread named [com.google.inject.internal.util.$Finalizer] but has failed to stop it. This is very likely to create a memory leak.
Aug 8, 2012 4:09:19 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: A web application appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak.
Run Code Online (Sandbox Code Playgroud)
我知道这与其他问题(例如这个问题)类似,但在我的情况下,"不要担心它"的答案是不够的,因为它给我带来了问题.我有CI服务器定期更新此应用程序,并且在6-10次重新加载后,CI服务器将挂起,因为Tomcat内存不足.
我需要能够清除这些孤立的线程,以便我可以更可靠地运行我的CI服务器.任何帮助,将不胜感激!
我有一个奇怪的问题,其中两个带有Oracle JDBC驱动程序的Web应用程序会相互冲突.我必须将JDBC驱动程序JAR放在公共文件夹TOMCAT_HOME/lib中.这是什么原因?
当tomcat关闭时,我在catalina.out日志文件中收到以下消息.我正在使用Tomcat 7.x和Tomcat JDBC数据源.
Mar 26, 2013 1:17:52 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [/my_webapp] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Mar 26, 2013 1:17:52 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/my_webapp] appears to have started a thread named [MySQL Statement Cancellation Timer] but has failed to stop it. This is very likely to create a memory …Run Code Online (Sandbox Code Playgroud) tomcat ×3
jdbc ×2
datasource ×1
geoserver ×1
java ×1
memory-leaks ×1
mysql ×1
postgresql ×1
spring ×1
tomcat7 ×1