在jdbc连接列表中找不到属性(pool-name =“pool_name_here”)值

时间:2016-02-28 11:11:24

标签: java mysql jdbc glassfish

问题:

运行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(不确定它是否与池名称问题有关)但没有成功:

  • 的java:应用/ JDBC / k2fitness
  • JDBC / k2fitness

2 个答案:

答案 0 :(得分:1)

池的名称为mysql_k2fitness_rootPool,请参阅jdbc-connection-pool元素的name属性。

答案 1 :(得分:0)

您是否尝试重命名池java:app / k2fitness?错误说无法找到它。