Tomcat (TomEE)/7.0.62 (1.7.2) XML 配置文件最佳实践
Tomcat (TomEE)/7.0.62 (1.7.2) XML Configuration Files best practices
我已经在 C://
中解压缩了一个二进制分发包,但是我很难让 JDBC
和 JDNI
工作...它没有从我的数据库中获取数据所以我假设我没有正确的文件配置。
Strangely, i'm able to see data with <c:forEach var="cartItem" items="${cart.items}" varStatus="iter"/>
but no data displays with <c:forEach var="product" items="${categoryProducts}" varStatus="iter"/>
编辑
server.xml: /conf
<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" at this level.
Documentation at /docs/config/server.html
-->
<Server port="8005" shutdown="SHUTDOWN">
<!-- TomEE plugin for Tomcat -->
<Listener className="org.apache.tomee.catalina.ServerListener"/>
<Listener className="org.apache.catalina.startup.VersionLoggerListener"/>
<!-- Security listener. Documentation at /docs/config/listeners.html
<Listener className="org.apache.catalina.security.SecurityListener" />
-->
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
<Listener className="org.apache.catalina.core.JasperListener"/>
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
<!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
</GlobalNamingResources>
<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" Note: A "Service" is not itself a "Container",
so you may not define subcomponents such as "Valves" at this level.
Documentation at /docs/config/service.html
-->
<Service name="Catalina">
<!--The connectors can use a shared executor, you can define one or more named thread pools-->
<!--
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="150" minSpareThreads="4"/>
-->
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1"
redirectPort="8443"/>
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- Define a SSL HTTP/1.1 Connector on port 8443
This connector uses the BIO implementation that requires the JSSE
style configuration. When using the APR/native implementation, the
OpenSSL style configuration is required as described in the APR/native
documentation -->
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" xpoweredBy="false" server="Apache TomEE" />
-->
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>
<!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host).
Documentation at /docs/config/engine.html -->
<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
-->
<Engine defaultHost="localhost" name="Catalina">
<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->
<!-- Use the LockOutRealm to prevent attempts to guess user passwords
via a brute-force attack -->
<Realm className="org.apache.catalina.realm.LockOutRealm">
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
</Realm>
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log." suffix=".txt"/>
</Host>
</Engine>
</Service>
</Server>
context.xml: /META-INF
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/Application">
<!-- maxActive: Maximum number of database connections in pool. Make sure you
configure your mysqld max_connections large enough to handle
all of your db connections. Set to -1 for no limit.
-->
<!-- maxIdle: Maximum number of idle database connections to retain in pool.
Set to -1 for no limit. See also the DBCP documentation on this
and the minEvictableIdleTimeMillis configuration parameter.
-->
<!-- maxWait: Maximum time to wait for a database connection to become available
in ms, in this example 10 seconds. An Exception is thrown if
this timeout is exceeded. Set to -1 to wait indefinitely.
-->
<!-- username and password: MySQL username and password for database connections -->
<!-- driverClassName: Class name for the old mm.mysql JDBC driver is
org.gjt.mm.mysql.Driver - we recommend using Connector/J though.
Class name for the official MySQL Connector/J driver is com.mysql.jdbc.Driver.
-->
<!-- url: The JDBC connection url for connecting to your MySQL database.
-->
<resources>
<jdbc-resource enabled="true" jndi-name="jdbc/application" object-type="user" pool-name="ApplicationPool">
<description/>
</jdbc-resource>
<jdbc-connection-pool allow-non-component-callers="false"
associate-with-thread="false"
connection-creation-retry-attempts="0"
connection-creation-retry-interval-in-seconds="10"
connection-leak-reclaim="false"
connection-leak-timeout-in-seconds="0"
connection-validation-method="auto-commit"
datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
fail-all-connections="false"
idle-timeout-in-seconds="300"
is-connection-validation-required="false"
is-isolation-level-guaranteed="true"
lazy-connection-association="false"
lazy-connection-enlistment="false"
match-connections="false"
max-connection-usage-count="0"
max-pool-size="32"
max-wait-time-in-millis="60000"
name="ApplicationPool"
non-transactional-connections="false"
pool-resize-quantity="2"
res-type="javax.sql.ConnectionPoolDataSource"
statement-timeout-in-seconds="-1"
steady-pool-size="8"
validate-atmost-once-period-in-seconds="0"
wrap-jdbc-objects="false">
<description>Connects to the database</description>
<property name="URL" value="jdbc:mysql://localhost:3306/application?zeroDateTimeBehavior=convertToNull"/>
<property name="User" value="root"/>
<property name="Password" value="password"/>
</jdbc-connection-pool>
</resources>
</Context>
第二次编辑
我在 $CATALINA_HOME/lib 中添加了这些罐子:
- javaee-api-6.0-6.jar
- javax.servlet.jsp.jstl-1.2.1.jar
没有 WAR 文件被分解,因为目前我正在 Netbeans 8.0.2 中进行本地开发,但如果它与部署相同,服务器会自动在 Web Applications
(如果相同,请原谅我的无知。
今天的日志:
WARNING: No rules found matching 'Context/resources/jdbc-resource/description'.
Jun 23, 2015 8:10:12 PM org.apache.tomcat.util.digester.Digester endElement
WARNING: No rules found matching 'Context/resources/jdbc-resource'.
Jun 23, 2015 8:10:12 PM org.apache.tomcat.util.digester.Digester endElement
WARNING: No rules found matching 'Context/resources/jdbc-connection-pool/description'.
Jun 23, 2015 8:10:12 PM org.apache.tomcat.util.digester.Digester endElement
WARNING: No rules found matching 'Context/resources/jdbc-connection-pool/property'.
Jun 23, 2015 8:10:12 PM org.apache.tomcat.util.digester.Digester endElement
WARNING: No rules found matching 'Context/resources/jdbc-connection-pool/property'.
Jun 23, 2015 8:10:12 PM org.apache.tomcat.util.digester.Digester endElement
WARNING: No rules found matching 'Context/resources/jdbc-connection-pool/property'.
Jun 23, 2015 8:10:12 PM org.apache.tomcat.util.digester.Digester endElement
WARNING: No rules found matching 'Context/resources/jdbc-connection-pool'.
Jun 23, 2015 8:10:12 PM org.apache.tomcat.util.digester.Digester endElement
WARNING: No rules found matching 'Context/resources'.
Jun 23, 2015 8:10:15 PM org.apache.openejb.config.ConfigurationFactory configureApplication
INFO: Configuring enterprise application: C:\Users\PC\Documents\NetBeansProjects\Mebzone\build\web
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.PagerTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.ParamTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.ItemTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.IndexTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.FirstTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.PrevTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.PageTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.PagesTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.NextTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.LastTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.SkipTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.PagerTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.ParamTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.ItemTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.IndexTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.FirstTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.PrevTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.PageTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.PagesTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.NextTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.LastTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.SkipTag
resource.xml 不是 Apache Tomcat 配置文件。 persistence.xml 不是 Apache Tomcat 配置文件。
server.xml 必须位于 conf 目录中。
context.xml您还有更多选择,但我建议您使用 Web 应用程序的 META-INF 目录。
如果您需要配置方面的帮助,则需要提供更多信息,包括:
- 完整Tomcat版本
- 您added/edited
的配置文件
- 您放置 WAR 文件/分解目录的位置
- 您添加的任何其他 JAR 以及放置它们的位置
- 日志中的任何错误消息
提供以上信息后更新
数据源配置错误。 Tomcat 不支持 也不支持 标签。如果 TomEE 提供了对这些的支持,那么我帮不了你(我只知道 Tomcat)。在 Tomcat 中,我希望看到 元素。
对于 Tomcat(我怀疑是 TomEE),您需要在 $CATALINA_BASE/lib.
中提供 MySQL JDBC 驱动程序 JAR
我已经在 C://
中解压缩了一个二进制分发包,但是我很难让 JDBC
和 JDNI
工作...它没有从我的数据库中获取数据所以我假设我没有正确的文件配置。
Strangely, i'm able to see data with
<c:forEach var="cartItem" items="${cart.items}" varStatus="iter"/>
but no data displays with<c:forEach var="product" items="${categoryProducts}" varStatus="iter"/>
编辑
server.xml: /conf
<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" at this level.
Documentation at /docs/config/server.html
-->
<Server port="8005" shutdown="SHUTDOWN">
<!-- TomEE plugin for Tomcat -->
<Listener className="org.apache.tomee.catalina.ServerListener"/>
<Listener className="org.apache.catalina.startup.VersionLoggerListener"/>
<!-- Security listener. Documentation at /docs/config/listeners.html
<Listener className="org.apache.catalina.security.SecurityListener" />
-->
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
<Listener className="org.apache.catalina.core.JasperListener"/>
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
<!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
</GlobalNamingResources>
<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" Note: A "Service" is not itself a "Container",
so you may not define subcomponents such as "Valves" at this level.
Documentation at /docs/config/service.html
-->
<Service name="Catalina">
<!--The connectors can use a shared executor, you can define one or more named thread pools-->
<!--
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="150" minSpareThreads="4"/>
-->
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1"
redirectPort="8443"/>
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- Define a SSL HTTP/1.1 Connector on port 8443
This connector uses the BIO implementation that requires the JSSE
style configuration. When using the APR/native implementation, the
OpenSSL style configuration is required as described in the APR/native
documentation -->
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" xpoweredBy="false" server="Apache TomEE" />
-->
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>
<!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host).
Documentation at /docs/config/engine.html -->
<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
-->
<Engine defaultHost="localhost" name="Catalina">
<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->
<!-- Use the LockOutRealm to prevent attempts to guess user passwords
via a brute-force attack -->
<Realm className="org.apache.catalina.realm.LockOutRealm">
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
</Realm>
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log." suffix=".txt"/>
</Host>
</Engine>
</Service>
</Server>
context.xml: /META-INF
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/Application">
<!-- maxActive: Maximum number of database connections in pool. Make sure you
configure your mysqld max_connections large enough to handle
all of your db connections. Set to -1 for no limit.
-->
<!-- maxIdle: Maximum number of idle database connections to retain in pool.
Set to -1 for no limit. See also the DBCP documentation on this
and the minEvictableIdleTimeMillis configuration parameter.
-->
<!-- maxWait: Maximum time to wait for a database connection to become available
in ms, in this example 10 seconds. An Exception is thrown if
this timeout is exceeded. Set to -1 to wait indefinitely.
-->
<!-- username and password: MySQL username and password for database connections -->
<!-- driverClassName: Class name for the old mm.mysql JDBC driver is
org.gjt.mm.mysql.Driver - we recommend using Connector/J though.
Class name for the official MySQL Connector/J driver is com.mysql.jdbc.Driver.
-->
<!-- url: The JDBC connection url for connecting to your MySQL database.
-->
<resources>
<jdbc-resource enabled="true" jndi-name="jdbc/application" object-type="user" pool-name="ApplicationPool">
<description/>
</jdbc-resource>
<jdbc-connection-pool allow-non-component-callers="false"
associate-with-thread="false"
connection-creation-retry-attempts="0"
connection-creation-retry-interval-in-seconds="10"
connection-leak-reclaim="false"
connection-leak-timeout-in-seconds="0"
connection-validation-method="auto-commit"
datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
fail-all-connections="false"
idle-timeout-in-seconds="300"
is-connection-validation-required="false"
is-isolation-level-guaranteed="true"
lazy-connection-association="false"
lazy-connection-enlistment="false"
match-connections="false"
max-connection-usage-count="0"
max-pool-size="32"
max-wait-time-in-millis="60000"
name="ApplicationPool"
non-transactional-connections="false"
pool-resize-quantity="2"
res-type="javax.sql.ConnectionPoolDataSource"
statement-timeout-in-seconds="-1"
steady-pool-size="8"
validate-atmost-once-period-in-seconds="0"
wrap-jdbc-objects="false">
<description>Connects to the database</description>
<property name="URL" value="jdbc:mysql://localhost:3306/application?zeroDateTimeBehavior=convertToNull"/>
<property name="User" value="root"/>
<property name="Password" value="password"/>
</jdbc-connection-pool>
</resources>
</Context>
第二次编辑
我在 $CATALINA_HOME/lib 中添加了这些罐子:
- javaee-api-6.0-6.jar
- javax.servlet.jsp.jstl-1.2.1.jar
没有 WAR 文件被分解,因为目前我正在 Netbeans 8.0.2 中进行本地开发,但如果它与部署相同,服务器会自动在 Web Applications
(如果相同,请原谅我的无知。
今天的日志:
WARNING: No rules found matching 'Context/resources/jdbc-resource/description'.
Jun 23, 2015 8:10:12 PM org.apache.tomcat.util.digester.Digester endElement
WARNING: No rules found matching 'Context/resources/jdbc-resource'.
Jun 23, 2015 8:10:12 PM org.apache.tomcat.util.digester.Digester endElement
WARNING: No rules found matching 'Context/resources/jdbc-connection-pool/description'.
Jun 23, 2015 8:10:12 PM org.apache.tomcat.util.digester.Digester endElement
WARNING: No rules found matching 'Context/resources/jdbc-connection-pool/property'.
Jun 23, 2015 8:10:12 PM org.apache.tomcat.util.digester.Digester endElement
WARNING: No rules found matching 'Context/resources/jdbc-connection-pool/property'.
Jun 23, 2015 8:10:12 PM org.apache.tomcat.util.digester.Digester endElement
WARNING: No rules found matching 'Context/resources/jdbc-connection-pool/property'.
Jun 23, 2015 8:10:12 PM org.apache.tomcat.util.digester.Digester endElement
WARNING: No rules found matching 'Context/resources/jdbc-connection-pool'.
Jun 23, 2015 8:10:12 PM org.apache.tomcat.util.digester.Digester endElement
WARNING: No rules found matching 'Context/resources'.
Jun 23, 2015 8:10:15 PM org.apache.openejb.config.ConfigurationFactory configureApplication
INFO: Configuring enterprise application: C:\Users\PC\Documents\NetBeansProjects\Mebzone\build\web
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.PagerTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.ParamTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.ItemTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.IndexTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.FirstTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.PrevTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.PageTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.PagesTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.NextTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.LastTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.SkipTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.PagerTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.ParamTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.ItemTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.IndexTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.FirstTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.PrevTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.PageTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.PagesTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.NextTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.LastTag
Jun 23, 2015 8:10:17 PM org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans deploy
SEVERE: Unable to load tag library tag class: com.jsptags.navigation.pager.SkipTag
resource.xml 不是 Apache Tomcat 配置文件。 persistence.xml 不是 Apache Tomcat 配置文件。
server.xml 必须位于 conf 目录中。
context.xml您还有更多选择,但我建议您使用 Web 应用程序的 META-INF 目录。
如果您需要配置方面的帮助,则需要提供更多信息,包括:
- 完整Tomcat版本
- 您added/edited 的配置文件
- 您放置 WAR 文件/分解目录的位置
- 您添加的任何其他 JAR 以及放置它们的位置
- 日志中的任何错误消息
提供以上信息后更新
数据源配置错误。 Tomcat 不支持
对于 Tomcat(我怀疑是 TomEE),您需要在 $CATALINA_BASE/lib.
中提供 MySQL JDBC 驱动程序 JAR