[wildfly-dev] How to deal with resource refs when deploying JPA container managed entity managers (WFLY-2841)

Martin Andersson martin.andersson at purplescout.se
Fri Jan 31 07:08:17 EST 2014


Thanks for the quick feedback!

I removed the typo in persistence.xml and updated the code at
https://github.com/umartin/wfds/

But as you say, the deployment still fails.

Br,
Martin Andersson
Java EE developer at www.purplescout.se


On Fri, Jan 31, 2014 at 12:25 PM, arjan tijms <arjan.tijms at gmail.com> wrote:

> Hi,
>
> I looks like there's one bug in the example.
>
> jboss-web.xml defines jdbc/MyDS
>
> But persistence.xml references java:comp/env/MyDS
>
> Shouldn't the last one be at least java:comp/env/jdbc/MyDS? Regardless,
> even with matching names it indeed doesn't work.
>
> Kind regards,
> Arjan Tijms
>
>
>
>
>
>
>
>
>
> On Thu, Jan 30, 2014 at 9:52 PM, Scott Marlow <smarlow at redhat.com> wrote:
>
>> WFLY-2841 reports a deployment failure that occurs when a deployments
>> [1] persistence.xml, tries to use a resource reference [2] for the
>> datasource [3].  The error [4] mentions an unresolved (DataSource)
>> service dependency that is added to the persistence unit service [5],
>> instead of resolving the resource reference (and using the underlying
>> DataSource).
>>
>> How should we handle resource references for this case?  Is there a way
>> to resolve the resource reference directly from deployers?  Or do we
>> represent the resource reference as a service?
>>
>> Scott
>>
>> [1] test app is at https://github.com/umartin/wfds/
>>
>> [2] jboss-web.xml
>> <jboss-web>
>>          <context-root>/wfds</context-root>
>>          <resource-ref>
>>                  <res-ref-name>jdbc/MyDS</res-ref-name>
>>                  <res-type>javax.sql.DataSource</res-type>
>>                  <jndi-name>java:jboss/datasources/ExampleDS</jndi-name>
>>          </resource-ref>
>> </jboss-web>
>>
>> [3] persistence.xml pu def
>> <persistence-unit name="wfdsPU" transaction-type="JTA">
>>          <jta-data-source>java:comp/env/MyDS</jta-data-source>
>> </persistence-unit>
>>
>> [4] {"JBAS014771: Services with missing/unavailable dependencies" =>
>> ["jboss.persistenceunit.\"wfds-1.0-SNAPSHOT.war#wfdsPU\".__FIRST_PHASE__
>> is missing
>>
>> [jboss.naming.context.java.module.\"wfds-1.0-SNAPSHOT\".\"wfds-1.0-SNAPSHOT\".env.MyDS]"]}
>>
>>
>> [5]
>>
>> https://github.com/wildfly/wildfly/blob/master/jpa/core/src/main/java/org/jboss/as/jpa/processor/PersistenceUnitServiceHandler.java#L358
>> _______________________________________________
>> wildfly-dev mailing list
>> wildfly-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/wildfly-dev
>>
>
>
> _______________________________________________
> wildfly-dev mailing list
> wildfly-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/wildfly-dev
>



-- 
Hälsningar,
Martin Andersson
Purple Scout AB
+46 732 05 14 01
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/wildfly-dev/attachments/20140131/32fa1c1d/attachment.html 


More information about the wildfly-dev mailing list