[
https://issues.apache.org/jira/browse/CXF-7586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16287796#comment-16287796
]
gonzalad commented on CXF-7586:
-------------------------------
the problem is that JBoss 7.x scans non managed class.
imo JBoss shouldn't scan non managed classes
See https://jira.spring.io/browse/DATAJPA-213 and
https://issues.jboss.org/browse/WFLY-1032 which explains the issue.
The issue is fixed in Wildflyw https://issues.jboss.org/browse/AS7-4710.
aka just declare <property name="wildfly.jpa.default-unit" value="true"/>
To current CXF version working with JBoss AS 7.1.2 we need to either :
a - add a unitName in @PersistenceContext
b - we remove the @PersistenceContext annotation from JPACMTCodeDataProvider.
This would mean that any project using JPACMTCodeDataProvider will need to
sublass it to add the @PersistenceContext or inject manually the entityManager
wdyt ?
> cxf-rt-rs-security-oauth2 preventing application on JBoss from starting if
> more than 1 PU defined
> -------------------------------------------------------------------------------------------------
>
> Key: CXF-7586
> URL: https://issues.apache.org/jira/browse/CXF-7586
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS Security
> Affects Versions: 3.2.0, 3.2.1
> Reporter: Olivier Paquet
> Attachments: cxf-jpa-example.zip
>
>
> Hi,
> We noticed after switchting from cxf 3.1.7 to 3.2.x that our application is
> not starting anymore.
> After some analysis we found out that the cxf module
> cxf-rt-rs-security-oauth2 contains a class
> org.apache.cxf.rs.security.oauth2.grants.code.JPACMTCodeDataProvider which
> injects an EntityManager using @PersistenceContext without defining a
> unitName. On our JBoss 6.4 EAP (JBoss 7.x) we get the following error
> message:
> {code}
> java.lang.IllegalArgumentException: JBAS011470: Persistence unitName was not
> specified and there are x persistence unit definitions in application
> deployment deployment
> {code}
> With only one persistence unit definition it's working, but we need multiple
> PU's.
> One solution I have in mind is to define a unitName for the
> PersistenceContext on the
> org.apache.cxf.rs.security.oauth2.grants.code.JPACMTCodeDataProvider
> ("CXF_PU") , so that a PU has to be define explicitly in the persistence.xml,
> I mean it's not nice but for us it would be ok.
> Or perhaps there are other macanisms to avoid the persistence context
> injection if this class is not used?
> It currently prevents us from switchting to the newest cxf version.
> I attached a sample maven project to reproduce this issue on a JBoss 7.x .
> Greetings, Olivier
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)