<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Please direct questions like this to the forums
<a class="moz-txt-link-freetext" href="https://community.jboss.org/en/wildfly">https://community.jboss.org/en/wildfly</a>. This list is used for
collaboration of WildFly development.<br>
<br>
<div class="moz-cite-prefix">On 04/08/2014 05:54 AM, Juan Manuel
CABRERA wrote:<br>
</div>
<blockquote
cite="mid:CANDP1e_QT9=V4aXFTTun39YdnijoUWigS1m9nywcR3xXc2vD_A@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>Hello devs,<br>
</div>
<div>
<div><br>
I have a wildfly war application at hands, which depends on
a jar which starts its own JPA persistence container with
Spring. This jar has its own `persistence.xml`, with only
one persistence unit.<br>
In the embedded jar, since there is only one persistence
unit, it is injected using a `@PersistenceContext` without a
unit name. Furthermore, the objects having such fields are
not EJBs, they are simple Spring beans...<br>
<br>
On the other hand, the application has also a
`persistence.xml` with two persistence units.<br>
The code of the application has `@PersistenceContext` fields
with a proper `unitName`, which is mandatory since there are
two of them.<br>
<br>
Now, when I start my application, Wildfly (specifically the
jpa module) scans the code from the jar and chokes on the
`@PersistenceContext` without unitNames of my Spring beans:<br>
<br>
DEBUG [org.jboss.as.jpa.messages] (MSC service thread
1-1) persistence unit search for unitName=null referenced
from class=the.spring.Bean
(<a class="moz-txt-link-abbreviated" href="mailto:annotation=@javax.persistence.PersistenceContext">annotation=@javax.persistence.PersistenceContext</a>() on void
the.spring.Bean.setEntityManager(javax.persistence.EntityManager))<br>
<br>
<br>
To cope with this, I would like to exclude the jar: In TomEE
there is a mean to exclude a jar explicitly from being
scanned, but I cannot find a similar functionnality in
WildFly.<br>
I have tried the following configurations without success:<br>
<br>
- `jboss-deployment-structure.xml` which is read but
without noticeable effect:<br>
<br>
<jboss-deployment-structure
xmlns="urn:jboss:deployment-structure:1.2"><br>
<deployment><br>
<exclusions><br>
<module
name="deployment.jee-app.war.spring-app.jar" /><br>
<!-- I have also tried the following --><br>
<!-- <module
name="jee-app.war.spring-app.jar" /> --><br>
<!-- <module name="spring-app.jar" />
--><br>
</exclusions><br>
</deployment><br>
</jboss-deployment-structure> <br>
<br>
- `jboss-scanning.xml` which seems to be ignored<br>
<br>
<scanning xmlns="urn:jboss:scanning:1.0"><br>
<path name="jee-app.war/WEB-INF/lib"><br>
<exclude name="spring-app.jar" /><br>
</path><br>
</scanning><br>
<br>
<br>
Both of these files are in the WEB-INF folder of my war
application.<br>
<br>
Of course, I cannot modify the spring-app.jar (would be too
easy...)<br>
<br>
Needless to say, I have spend a considerable amount of time
in the WildFly doc and on Google without finding anything
else than exluding subsystems, or overriding locally modules
of WildFly...<br>
<br>
Thanks for your help!<br>
<br>
Juan Manuel<br>
<br>
</div>
<div>PS: This question is also posted on StackOverflow: <a
moz-do-not-send="true"
href="http://stackoverflow.com/q/22932015/3509723">http://stackoverflow.com/q/22932015/3509723</a><br>
<br>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
wildfly-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:wildfly-dev@lists.jboss.org">wildfly-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/wildfly-dev">https://lists.jboss.org/mailman/listinfo/wildfly-dev</a></pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
James R. Perkins
JBoss by Red Hat</pre>
</body>
</html>