[wildfly-dev] Exclusions in WildFly

James R. Perkins jperkins at redhat.com
Wed Apr 16 11:08:17 EDT 2014


Please direct questions like this to the forums 
https://community.jboss.org/en/wildfly. This list is used for 
collaboration of WildFly development.

On 04/08/2014 05:54 AM, Juan Manuel CABRERA wrote:
> Hello devs,
>
> 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.
> 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...
>
> On the other hand, the application has also a `persistence.xml` with 
> two persistence units.
> The code of the application has `@PersistenceContext` fields with a 
> proper `unitName`, which is mandatory since there are two of them.
>
> 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:
>
>     DEBUG [org.jboss.as.jpa.messages] (MSC service thread 1-1) 
> persistence unit search for unitName=null referenced from 
> class=the.spring.Bean 
> (annotation=@javax.persistence.PersistenceContext() on void 
> the.spring.Bean.setEntityManager(javax.persistence.EntityManager))
>
>
> 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.
> I have tried the following configurations without success:
>
>  - `jboss-deployment-structure.xml` which is read but without 
> noticeable effect:
>
>         <jboss-deployment-structure 
> xmlns="urn:jboss:deployment-structure:1.2">
>           <deployment>
>             <exclusions>
>               <module name="deployment.jee-app.war.spring-app.jar" />
>               <!-- I have also tried the following -->
>               <!-- <module name="jee-app.war.spring-app.jar" /> -->
>               <!-- <module name="spring-app.jar" /> -->
>             </exclusions>
>           </deployment>
>         </jboss-deployment-structure>
>
>  - `jboss-scanning.xml` which seems to be ignored
>
>         <scanning xmlns="urn:jboss:scanning:1.0">
>           <path name="jee-app.war/WEB-INF/lib">
>             <exclude name="spring-app.jar" />
>           </path>
>         </scanning>
>
>
> Both of these files are in the WEB-INF folder of my war application.
>
> Of course, I cannot modify the spring-app.jar (would be too easy...)
>
> 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...
>
> Thanks for your help!
>
> Juan Manuel
>
> PS: This question is also posted on StackOverflow: 
> http://stackoverflow.com/q/22932015/3509723
>
>
>
> _______________________________________________
> wildfly-dev mailing list
> wildfly-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/wildfly-dev

-- 
James R. Perkins
JBoss by Red Hat

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/wildfly-dev/attachments/20140416/d8ce3ef5/attachment.html 


More information about the wildfly-dev mailing list