[jboss-jira] [JBoss JIRA] (WFLY-2680) java:comp/DefaultDataSource doesn't work in persistence.xml

Stuart Douglas (JIRA) issues at jboss.org
Thu Mar 1 17:42:00 EST 2018


     [ https://issues.jboss.org/browse/WFLY-2680?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stuart Douglas resolved WFLY-2680.
----------------------------------
    Resolution: Out of Date


This has been fixed for a while

> 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
>          Components: EE, JPA / Hibernate
>    Affects Versions: 8.0.0.CR1
>            Reporter: arjan tijms
>              Labels: javaee7, jdbc
>
> 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 was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the jboss-jira mailing list