运行java ee projet时出错:
严重:部署应用程序时出现异常[K2Fitness-war]: javax.resource.ResourceException:javax.resource.ResourceException: 列表中找不到属性值(pool-name = java:app / k2fitness) jdbc连接池。
与GlassFish ressources.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
<resources>
<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" 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="mysql_k2fitness_rootPool" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
<property name="serverName" value="localhost"/>
<property name="portNumber" value="3306"/>
<property name="databaseName" value="k2fitness"/>
<property name="User" value="root"/>
<property name="Password" value="root"/>
<property name="URL" value="jdbc:mysql://localhost:3306/k2fitness?zeroDateTimeBehavior=convertToNull"/>
<property name="driverClass" value="com.mysql.jdbc.Driver"/>
</jdbc-connection-pool>
<jdbc-resource enabled="true" jndi-name="java:apps/jdbc:mysql://localhost:3306/k2fitness" object-type="user" pool-name="k2fitness"/>
</resources>
在glassfish管理面板上,我有以下内容:
JDBC RESOURCES
-> jdbc/k2fitness (JNDI-NAME | Connected to k2fitness pool )
JDBC CONNECTION POOLS
-> k2fitness (POOL NAME | Ping successful )
k2fitness网址:jdbc:mysql://localhost:3306/k2fitness
为什么在显然存在时,无法在连接池列表中找到池名称“k2fitness”。任何明确的建议都会有所帮助。
我试图更改jndi-name(不确定它是否与池名称问题有关)但没有成功:
答案 0 :(得分:1)
池的名称为mysql_k2fitness_rootPool
,请参阅jdbc-connection-pool
元素的name属性。
答案 1 :(得分:0)
您是否尝试重命名池java:app / k2fitness?错误说无法找到它。