问题:

运行java ee projet时出错:


  严重:部署应用程序[K2Fitness-war]时发生异常:
  javax.resource.ResourceException:javax.resource.ResourceException:
  在列表中找不到属性值(池名称= 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名称(不确定是否与池名称问题有关):


java:app / jdbc / k2fitness
jdbc / k2fitness

最佳答案

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

07-25 22:23