I use Glassfish 3.1.2.2 (build 5), JPA, EclipseLink, MySQL
I created MySQL pool via Glassfish admin panel. Ping to MySQL from GF admin panel is ok.
I created app with 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>
I tried to deploy it and got the error:
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
Stacktrace in GF log is huge. Started by
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)
....
Does anyone have ideas what happened and what to do?
If you have only created a MySQL connection pool, you must also create a JDBC resource. This can be created from the context menu above the one you used to create the connection pool.
In my Glassfish, my JDBC resource, jdbc/__default is using the connection pool mysql_lemon.