Right, sorry - you need an instance of Annotation and have just a Class<?
extends Annotation>, my bad.
I checked the code and did my homework on how you get to these qualifiers
and why they come as Strings and now I see that the solution you have is
good, sorry for the noise.
BTW, the specification says this can be basically any Qualifier, but it
doesn't seem to cover qualifiers with binding values
(@SomeQualifier("foo")).
In such a case, you cannot really know what member value to use. Maybe
those should be detected and an exception thrown?
Matej
On Mon, Jul 21, 2025 at 6:36 PM Scott Marlow <smarlow(a)redhat.com> wrote:
On Mon, Jul 21, 2025 at 11:12 AM Matej Novotny <manovotn(a)redhat.com>
wrote:
> Hi and sorry for the late answer, I was away the last few days.
>
> Indeed, you were adding the @Qualifier annotation instead of the actual
> qualifier.
> From the PR you shared, I am not sure what's the point of
> using ScopeProxy though.
> It appears that adding the qualifier the following way would do the trick
> as well?
>
> >
>
beanConfigurator.addQualifier(persistenceUnitMetadata.getClassLoader().loadClass(qualifier).asSubclass(Annotation.class);
>
I tried a few variations of that change but it seems more changes are
needed:
Switched to:
final Class<? extends Annotation> qualifierType =
persistenceUnitMetadata.getClassLoader()
.loadClass(qualifier)
.asSubclass(Annotation.class);
beanConfigurator.addQualifier(qualifierType);
Compile failure is:
wildfly/jpa/subsystem/src/main/java/org/jboss/as/jpa/beanmanager/PersistenceIntegrationWithCDI.java:[111,47]
incompatible types: java.lang.Class<capture#1 of ? extends
java.lang.annotation.Annotation> cannot be converted to
java.lang.annotation.Annotation
Intellij IDE shows failure:
Required type:
Annotation
Provided:
Class
<capture of ? extends Annotation>
Any suggestions?
Thanks,
Scott
>
> Matej
>
> On Fri, Jul 18, 2025 at 2:42 AM Scott Marlow via weld-dev <
> weld-dev(a)lists.jboss.org> wrote:
>
>> James Perkins already answered my question by creating pull request
>>
https://github.com/scottmarlow/wildfly/pull/36 to correct the [1]
>> code.
>>
>> Scott
>>
>> On Thu, Jul 17, 2025 at 1:18 PM Scott Marlow <smarlow(a)redhat.com> wrote:
>>
>>> Any suggestions for what is wrong in [1] that
>>> causes org.jboss.weld.util.Bindings#validateQualifiers() to throw
>>> "MetadataLogger.LOG.notAQualifier" error [2]?
>>>
>>> I tried a few variations of loading an application class that should be
>>> a jakarta.inject.Qualifier but doesn't seem to work correctly.
>>>
>>> In summary, I'm trying to implement the [3] feature that integrates
>>> Persistence + CDI access from a Jakarta EE 11 implementation.
>>>
>>> Thanks,
>>> Scott
>>>
>>> [1]
>>>
https://github.com/wildfly/wildfly/compare/main...scottmarlow:wildfly:WFL...
>>>
>>> [2]
>>> 2025-07-17 12:55:53,714 INFO [org.jboss.as.jpa] (ServerService Thread
>>> Pool -- 84) WFLYJPA0010: Starting Persistence Unit (phase 2 of 2) Service
>>> 'CDIPersistenceTestCase.jar#pu1'
>>> 2025-07-17 12:55:54,364 ERROR [org.jboss.msc.service.fail] (MSC service
>>> thread 1-6) MSC000001: Failed to start service
>>>
jboss.deployment.unit."CDIPersistenceTestCase.jar".WeldStartService:
>>> org.jboss.msc.service.StartException in service
>>>
jboss.deployment.unit."CDIPersistenceTestCase.jar".WeldStartService: Failed
>>> to start service
>>> at org.jboss.msc(a)1.5.6.Final
>>>
//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1545)
>>> at org.jboss.msc(a)1.5.6.Final
>>>
//org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1374)
>>> at org.jboss.threads(a)3.9.1
>>> //org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
>>> at org.jboss.threads(a)3.9.1
>>>
//org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2651)
>>> at org.jboss.threads(a)3.9.1
>>>
//org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2630)
>>> at org.jboss.threads(a)3.9.1
>>>
//org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1622)
>>> at org.jboss.threads(a)3.9.1
>>>
//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1589)
>>> at java.base/java.lang.Thread.run(Thread.java:840)
>>> Caused by: jakarta.enterprise.inject.spi.DefinitionException:
>>> org.jboss.weld.exceptions.DefinitionException: WELD-001111: interface
>>> jakarta.inject.Qualifier defined on Configurator Bean [interface
>>> jakarta.persistence.EntityManager, types: Object, EntityManager,
>>> qualifiers: @Any @Qualifier] is not a qualifier
>>> at org.jboss.weld.core(a)5.1.6.Final
>>>
//org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl.finish(AfterBeanDiscoveryImpl.java:200)
>>> at org.jboss.weld.core(a)5.1.6.Final
>>>
//org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl.fire(AfterBeanDiscoveryImpl.java:76)
>>> at org.jboss.weld.core(a)5.1.6.Final
>>> //org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:463)
>>> at org.jboss.weld.core(a)5.1.6.Final
>>> //org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:87)
>>> at org.jboss.as.weld(a)37.0.0.Final-SNAPSHOT
>>> //org.jboss.as.weld.WeldStartService.start(WeldStartService.java:80)
>>> at org.jboss.msc(a)1.5.6.Final
>>>
//org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1553)
>>> at org.jboss.msc(a)1.5.6.Final
>>>
//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1516)
>>> ... 7 more
>>> Caused by: org.jboss.weld.exceptions.DefinitionException: WELD-001111:
>>> interface jakarta.inject.Qualifier defined on Configurator Bean [interface
>>> jakarta.persistence.EntityManager, types: Object, EntityManager,
>>> qualifiers: @Any @Qualifier] is not a qualifier
>>> at org.jboss.weld.core(a)5.1.6.Final
>>> //org.jboss.weld.util.Bindings.validateQualifiers(Bindings.java:77)
>>> at org.jboss.weld.core(a)5.1.6.Final
>>>
//org.jboss.weld.bean.attributes.ExternalBeanAttributesFactory.validateQualifiers(ExternalBeanAttributesFactory.java:89)
>>> at org.jboss.weld.core(a)5.1.6.Final
>>>
//org.jboss.weld.bean.attributes.ExternalBeanAttributesFactory.validateBeanAttributes(ExternalBeanAttributesFactory.java:71)
>>> at org.jboss.weld.core(a)5.1.6.Final
>>>
//org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl.processBeanRegistration(AfterBeanDiscoveryImpl.java:212)
>>> at org.jboss.weld.core(a)5.1.6.Final
>>>
//org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl.finish(AfterBeanDiscoveryImpl.java:194)
>>> ... 13 more
>>>
>>> [3]
>>>
https://jakarta.ee/specifications/platform/11/jakarta-platform-spec-11.0#...
>>>
>> _______________________________________________
>> weld-dev mailing list -- weld-dev(a)lists.jboss.org
>> To unsubscribe send an email to weld-dev-leave(a)lists.jboss.org
>> Privacy Statement:
https://www.redhat.com/en/about/privacy-policy
>> List Archives:
>>
https://lists.jboss.org/archives/list/weld-dev@lists.jboss.org/message/JE...
>>
>