Can we exclude jars from JPA annotation scanner in JBoss EAP 6?

Solution Unverified - Updated -

Issue

Is there a way to exclude a jar from the JPA annotation scanner path? Our project uses multiple persistence units (uses two different datasources) which are specified in a single persistence.xml. JBoss mandates that in such scenarios all @PersistenceContext must specify a "unitName" attribute to avoid ambiguity. We do that in our project but unfortunately one of the Spring Framework jar (Spring Data JPA) has a single class that declares a @PersistenceContext with no unitName specified. This causes JBoss deployer to fail:

JBAS011470: Persistence unitName was not specified and there are 2 persistence unit definitions in application deployment deployment "research.war". Either change the application deployment to have only one persistence unit definition or specify the unitName for each reference to a persistence unit.

~~~
My.war
|
+- WEB-INF
|
|- web.xml
|- classes
+ lib
|- my-core.jar (persistence.xml)
|- spring-data-jpa.jar (Offending @PersistenceContext)
+ *.jar
~~

Can we suppress the annotation scanner at the container level since we use Spring for DI? Attaching the server.log file during server startup and deployment.

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.2.3

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content