-
Feature Request
-
Resolution: Obsolete
-
Major
-
None
-
8.0.0.CR1
Having a persistence.xml with the following content fails the deployment on WildFly 8 CR1:
<?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="testPU"> <jta-data-source>java:comp/DefaultDataSource</jta-data-source> </persistence-unit> </persistence>
It results in the following error:
13:51:40,367 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "dynamic-named-query.war")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"dynamic-named-query.war#testPU\".__FIRST_PHASE__ is missing [jboss.naming.context.java.module.dynamic-named-query.dynamic-named-query.DefaultDataSource]"]}
When I proposed the feature for the default data source over at the Java EE JIRA (https://java.net/jira/browse/JAVAEE_SPEC-4) I intended this to work. In the description I hinted that the standard JNDI name would be the standard alternative for java:jboss/datasources/ExampleDS on JBoss. The latter indeed does work in persistence.xml using WildFly 8 CR1.
Omitting the jta-data-source element altogether does work, which is great. However, I foresee a lot of users tripping over this in the future and just giving up the idea of using a default data source, especially since the error message is very cryptic for new developers.
In GlassFish 4 using java:comp/DefaultDataSource in persistence.xml does work.