Glassfish 不创建 JDBC 资源

Glassfish doesn't create JDBC Resources

我正在尝试使用 glassfish-resources.xml 创建 JDBC 连接池和 JDBC 资源,代码如下。我已尝试使用 Glassfish 4.0、4.1、4.1.1 和 Payara 来完成此操作。我知道 4.1.1 有问题,但它 不会对它们中的任何一个造成影响 。几个小时以来,我一直试图解决这个问题,但没有成功。请帮助。

<resources>
  <jdbc-resource enabled="true"
                 jndi-name="jdbc/affablebean"
                 object-type="user"
                 pool-name="AffableBeanPool">
  </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"
                        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="AffableBeanPool"
                        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 affablebean database</description>
    <property name="URL" value="jdbc:mysql://localhost:3306/affablebean"/>
    <property name="User" value="root"/>
    <property name="Password" value="nbuser"/>
  </jdbc-connection-pool>
</resources>

好的,问题已解决...最新的 NetBeans 8.1 在错误的文件夹中创建了 glassfish-resources.xml。如果您遇到同样的问题,只需将您的 glassfish-resources.xml 从配置文件移至服务器资源...