问题描述
我正在尝试使用下面的代码使用glassfish-resources.xml创建JDBC连接池和JDBC资源。我试图用Glassfish 4.0,4.1,4.1.1和Payara做到这一点。我知道4.1.1有问题,但不会创建其中的任何一个。我一直试图解决这个问题几个小时,但没有成功。 PLZ HELP。
I'm trying to create JDBC Connection Pool and JDBC Resource using glassfish-resources.xml with code below. I've tried to do it with Glassfish 4.0, 4.1, 4.1.1 and Payara. I know there was a problem with 4.1.1, but it doesnt create to any of them. I've been trying to solve this problem for several hours, but without a success. PLZ HELP.
<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从配置文件移动到服务器资源...
Ok, problem solved... the newest NetBeans 8.1 creates glassfish-resources.xml in the wrong folder. If you have the same problem, just move your glassfish-resources.xml from Configuration Files to Server Resources...
这篇关于Glassfish不会创建JDBC资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!