【发布时间】:2014-10-08 05:07:59
【问题描述】:
(滚动到结尾可能涉及的错误。)
这个连接池看起来是对的,至少ping成功了,但是EJB模块到底是怎么引用的呢?
thufir@dur:~$
thufir@dur:~$ glassfish-4.1/glassfish/bin/asadmin
Use "exit" to exit and "help" for online help.
asadmin>
asadmin> list-jdbc-connection-pools
CLI031: Warning: Option "target" is obsolete and will be ignored.
CLI031: Warning: Option "target" is obsolete and will be ignored.
__TimerPool
DerbyPool
SamplePool
connectionPool
legacy_on_glassfish
Command list-jdbc-connection-pools executed successfully.
asadmin>
asadmin> ping-connection-pool legacy_on_glassfish
Command ping-connection-pool executed successfully.
asadmin>
asadmin> list-jdbc-resources
jdbc/sample
jdbc/__TimerPool
jdbc/__default
jdbc/local
jdbc/legacy_resource
Command list-jdbc-resources executed successfully.
asadmin>
(我不确定如何使用 asadmin 输出 jdbc 连接属性)
使用 Netbeans 向导,这是生成的 persistence.xml 文件:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="EnterpriseLegacyJDBC-ejbPU" transaction-type="JTA">
<jta-data-source>jdbc/legacy_resource</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.schema-generation.database.action" value="create"/>
</properties>
</persistence-unit>
</persistence>
但是,选择“来自数据库的新实体类”会导致:
在 Glassfish 控制台中,数据源的驱动程序类的名称是什么?
查看控制台,Datasource Classname 是 com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource,而 Driver Classname 不可编辑:
-------------------------错误报告-- -------------------------------------
strayan@netbeans.org 2013-11-25 09:13:49 UTC
抱歉,当您从 NetBean IDE 就像教程中提到的一样,它像你一样工作得很好 说过。但是选择外面创建的数据源(使用 GlassFish Server Admin console) 的 IDE 我们在 IDE 中显示 查看错误。
https://netbeans.org/bugzilla/show_bug.cgi?id=238667#c19
但是,我不确定使用 GlassFish Server 管理控制台创建的 DataSource 是什么意思——只是找不到该选项。
另见:
http://computingat40s.wordpress.com/how-to-setup-a-jdbc-connection-in-glassfish/
【问题讨论】:
标签: jakarta-ee netbeans jdbc glassfish connection-pooling