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
This could happen due to a NetBeans bug they say they had fixed but seemingly they had not. As a solution, I ended up removing glassfish-resources.xml
altogether (as I couldn't make persistence.xml
pick it up with any kind of the workarounds) and using @DataSourceDefinition
annotation instead.
My configuration uses a separate DataSourceBean.java
file for @DataSourceDefinition
:
@Singleton
@Startup
@DataSourceDefinition(name="java:global/jdbc/myDataSource",
className="com.microsoft.sqlserver.jdbc.SQLServerDataSource",
url="jdbc:sqlserver://127.0.0.1:1433;databaseName=myDB",
user="myuser",
password="mypassword"
)
public class DataSourceBean {
}
persistence.xml
looks like that:
java:global/jdbc/myDataSource