[
https://issues.jboss.org/browse/WFLY-2727?page=com.atlassian.jira.plugin....
]
Scott Marlow edited comment on WFLY-2727 at 1/8/14 1:10 PM:
------------------------------------------------------------
Its a timing issue. By default, we use the persistence unit definition before the
@DataSourceDefinition is available as for various timing reasons. If we wait for the
DataSourceDefinition to be available, we can't use CDI (application classloader will
have been used by that point).
Could you check if adding persistence unit (hint) property
"wildfly.jpa.twophasebootstrap" set to false, works around the failure.
{quote}
persistence providers (like Hibernate ORM 4.3.x via EntityManagerFactoryBuilder), allow a
two phase persistence unit bootstrap, which improves JPA integration with CDI. Setting
the wildfly.jpa.twophasebootstrap hint to false, disables the two phase bootstrap (for the
persistence unit that contains the hint).
{quote}
was (Author: smarlow):
Its a timing issue. By default, we use the persistence unit definition before the
@DataSourceDefinition is available as for various timing reasons. Could you check if
adding persistence unit (hint) property "wildfly.jpa.twophasebootstrap" set to
false, works around the failure.
{quote}
persistence providers (like Hibernate ORM 4.3.x via EntityManagerFactoryBuilder), allow a
two phase persistence unit bootstrap, which improves JPA integration with CDI. Setting
the wildfly.jpa.twophasebootstrap hint to false, disables the two phase bootstrap (for the
persistence unit that contains the hint).
{quote}
@DataSourceDefinition defined data source can't be used in
persistence.xml
--------------------------------------------------------------------------
Key: WFLY-2727
URL:
https://issues.jboss.org/browse/WFLY-2727
Project: WildFly
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: EE, JPA / Hibernate
Affects Versions: 8.0.0.CR1
Reporter: arjan tijms
Assignee: Scott Marlow
Defining a data source from within the application using either {{@DataSourceDefinition}}
on a class or the {{data-source}} element in {{web.xml}}, and then using this in
{{persistence.xml}} will cause a deployment failure.
E.g.
{code:xml|title=web.xml}
<data-source>
<name>java:app/MyApp/MyDS</name>
<class-name>org.h2.jdbcx.JdbcDataSource</class-name>
<url>jdbc:h2:mem:test</url>
</data-source>
{code}
and
{code:xml|title=persistence.xml}
<persistence-unit name="testPU">
<jta-data-source>java:app/MyApp/MyDS</jta-data-source>
</persistence-unit>
{code}
will result in:
{noformat}
ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 3)
JBAS014613: Operation ("deploy") failed - address: ([("deployment"
=> "dca783dd-b383-4a16-85a4-1331a2f89354.war")]) - failure description:
{"JBAS014771: Services with missing/unavailable dependencies" =>
["jboss.persistenceunit.\"dca783dd-b383-4a16-85a4-1331a2f89354.war#testPU\".__FIRST_PHASE__
is missing
[jboss.naming.context.java.app.dca783dd-b383-4a16-85a4-1331a2f89354.MyApp.MyDS]"]}
ERROR [org.jboss.as.server] (management-handler-thread - 3) JBAS015870: Deploy of
deployment "dca783dd-b383-4a16-85a4-1331a2f89354.war" was rolled back with the
following failure message: {"JBAS014771: Services with missing/unavailable
dependencies" =>
["jboss.persistenceunit.\"dca783dd-b383-4a16-85a4-1331a2f89354.war#testPU\".__FIRST_PHASE__
is missing
[jboss.naming.context.java.app.dca783dd-b383-4a16-85a4-1331a2f89354.MyApp.MyDS]"]}
{noformat}
--
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