]
Scott Marlow commented on WFLY-4096:
------------------------------------
I know about the CDI issue. There are other issues as well. The persistence unit has to
be started, very early in deployment (before any application classes are loaded so that
entity class rewriting works), but the CDI beanmanager will not be ready until very late.
Same is true for datasources created in the deployment (@DataSourceDefinition).
Can we start the CDI beanmanager earlier? I was told no, as the application classloader
is expected to be used.
Can we start application defined datasources early? I was told no on that as well. This
all came up on the as7 or wildfly development email list before.
Regarding the hibernate.temp.use_jdbc_metadata_defaults property, did you get any further
in Hibernate with that (if you looked at the deployment exception call stack?)
Datasource Defined in web.xml Does Not Work with JPA Entity Manager
-------------------------------------------------------------------
Key: WFLY-4096
URL:
https://issues.jboss.org/browse/WFLY-4096
Project: WildFly
Issue Type: Bug
Components: JPA / Hibernate, Web (JBoss Web)
Affects Versions: 8.1.0.Final
Environment: Windows 7
Java 8u25
WildFly 8.1.0.Final
Reporter: shinzey shinzey
Assignee: Scott Marlow
Priority: Critical
Labels: datasource, deployment, jpa, persistence.xml, persistenceUnit
The datasource defined in web.xml:
{quote}
<data-source>
<name>java:/datasources/test</name>
<class-name>org.apache.derby.jdbc.ClientDataSource</class-name>
<database-name>test</database-name>
<url>jdbc:derby://localhost:1527/test</url>
<user>test</user>
<password>test</password>
</data-source>
{quote}
The persistence unit:
{quote}
<persistence-unit name="wtpu" transaction-type="JTA">
<jta-data-source>java:/datasources/test</jta-data-source>
</persistence-unit>
{quote}
The deployment error:
{quote}
17:57:10,813 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015876:
Starting deployment of "WebTest.war" (runtime-name: "WebTest.war")
17:57:11,078 INFO [org.jboss.as.jpa] (MSC service thread 1-2) JBAS011401: Read
persistence.xml for wtpu
17:57:11,172 ERROR [org.jboss.as.controller.management-operation]
(DeploymentScanner-threads - 1) JBAS014613: Operation ("deploy") failed -
address: ([("deployment" => "WebTest.war")]) - failure description:
("JBAS014771: Services with missing/unavailable dependencies" =>
["jboss.persistenceunit.\"WebTest.war#wtpu\".__FIRST_PHASE__ is missing
[jboss.naming.context.java.datasources.test]"])
17:57:11,187 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS018559:
Deployed "WebTest.war" (runtime-name : "WebTest.war")
17:57:11,187 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1) JBAS014774:
Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.naming.context.java.datasources.test (missing) dependents: [service
jboss.persistenceunit."WebTest.war#wtpu".__FIRST_PHASE__]
{quote}
If I remove the persistence unit, the datasource can be successfully bound:
{quote}
17:55:47,851 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread
1-3) JBAS010400: Bound data source [java:/datasources/test]
{quote}
The same code works as expected in GlassFish 4.1, and the @DataSourceDefinition
annotation has the same issue.