我使用 Glassfish 3.1.2.2 (build 5)、JPA、EclipseLink、MySQL
我通过 Glassfish 管理面板创建了 MySQL 池。从 GF 管理面板 Ping 到 MySQL 没问题。
我用 persistence.xml 创建了应用程序:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
<persistence-unit name="myUnit">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/myDBName"/>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="javax.persistence.jdbc.user" value="root"/>
<property name="javax.persistence.jdbc.password" value="myPass"/>
<property name="javax.persistence.ddl-generation" value="drop-and-create-tables"/>
</properties>
</persistence-unit>
我尝试部署它并收到错误:
Invalid resource : jdbc/__default__pm
[#|2012-11-16T02:20:59.480+0400|SEVERE|glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=43;_ThreadName=Thread-2;|Invalid resource : jdbc/__default__pm
java.lang.RuntimeException: Invalid resource : jdbc/__default__pm
GF 日志中的 Stacktrace 非常庞大。开始于
at com.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:540)
at com.sun.enterprise.connectors.ConnectorRuntime.lookupPMResource(ConnectorRuntime.java:469)
at org.glassfish.persistence.common.PersistenceHelper.lookupPMResource(PersistenceHelper.java:63)
at org.glassfish.persistence.jpa.ProviderContainerContractInfoBase.lookupDataSource(ProviderContainerContractInfoBase.java:71)
....
有谁知道发生了什么以及该怎么做?