Hi,
I switched my Eclipse Texo generated source across from Jetty to Play. But despite following the JavaJPA documentation to the letter I find the DataSource defined in my application.conf and conf/META-INF/persistence.xml is not set in the JNDI context, so if fails to find it.
Exception Description: Cannot acquire data source [DefaultDS].
Internal Exception: javax.naming.NameNotFoundException: DefaultDS not found
at org.eclipse.persistence.exceptions.ValidationException.cannotAcquireDataSource(ValidationException.java:520) ~[eclipselink-2.5.0.jar:2.5.0.v20130507-3faac2b]
at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:109) ~[eclipselink-2.5.0.jar:2.5.0.v20130507-3faac2b]
Here is the relevant part of my application.conf
db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:file://C:/Users/olddave/git/pss/db/pss_db;DB_CLOSE_ON_EXIT=FALSE;AUTO_SERVER=TRUE"
db.default.user="sa"
db.default.password="pss@1234"
db.default.jndiName=DefaultDS
#
# You can expose this datasource via JNDI if needed (Useful for JPA)
jpa.default=default
And my persistence.xml
<persistence-unit name="default" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<non-jta-data-source>DefaultDS</non-jta-data-source>
<class>com.example.pss.AdvancedConfig</class>
...
<properties>
<property name="eclipselink.target-database" value="org.eclipse.persistence.platform.database.H2Platform"/>
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
<property name="javax.persistence.jdbc.url" value="jdbc:h2:file://C:/Users/olddave/git/pss/db/pss_db;DB_CLOSE_ON_EXIT=FALSE;AUTO_SERVER=TRUE"/>
<property name="javax.persistence.jdbc.user" value="sa"/>
<property name="javax.persistence.jdbc.password" value="********"/>
<property name="eclipselink.ddl-generation" value="none" />
<property name="eclipselink.ddl-generation.output-mode" value="both" />
</properties>
</persistence-unit>
</persistence>
and the relevant part of build.sbt
libraryDependencies ++= Seq(
"org.eclipse.persistence" % "eclipselink" % "2.5.0",
cache,
javaWs,
javaJpa
)
Any ideas?