[jboss-jira] [JBoss JIRA] (WFLY-2680) java:comp/DefaultDataSource doesn't work in persistence.xml
arjan tijms (JIRA)
issues at jboss.org
Sun Dec 22 08:25:32 EST 2013
arjan tijms created WFLY-2680:
---------------------------------
Summary: java:comp/DefaultDataSource doesn't work in persistence.xml
Key: WFLY-2680
URL: https://issues.jboss.org/browse/WFLY-2680
Project: WildFly
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Reporter: arjan tijms
Having a persistence.xml with the following content fails the deployment on WildFly 8 CR1:
{code:xml}
<?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>
{code}
It results in the following error:
{noformat}
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]"]}
{noformat}
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.
See also WFLY-2027 and WFLY-2158
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list