关于这个问题似乎有几个话题,但是找不到答案。我对JSF不太熟悉,并且想使用以下方法创建一个postgresql连接池:
但是tomcat总是给我一个HTTP Status 500-实例化servlet类错误的错误(帖子末尾的堆栈跟踪)您能帮我吗?
我的文件:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>Postgresql</display-name>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<context-param>
<description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<resource-ref>
<description>Postgres Test</description>
<res-ref-name>jdbc/einfuehrungsaufgabe</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
Run Code Online (Sandbox Code Playgroud)
<context>
<Resource name="jdbc/einfuehrungsaufgabe" auth="Container"
type="javax.sql.Datasource" maxActive="20" maxIdle="5" maxWait="10000"
username="foo" password="foo" driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://foo.de/foo">
</Resource>
</context> …Run Code Online (Sandbox Code Playgroud)