Re: Cannot invoke "org.ecl ipse.microprofile.auth.Log inConfig.authMethod()" bec ause "loginConfig" is null

Richard Zowalla <[email protected]> Sat, 12 Jul 2025 21:59:52 +0200
Newsgroups gmane.comp.java.openejb.user
Message-ID <[email protected]>
------0BDIBHHKN17FWP5XBBPF1D9HTUQ39S
Content-Type: text/plain;
 charset=utf-8
Content-Transfer-Encoding: quoted-printable

Most likely around https://github=2Ecom/apache/tomee/blob/main/mp-jwt/src/m=
ain/java/org/apache/tomee/microprofile/jwt/MPJWTFilter=2Ejava as a start=2E

Am 12=2E Juli 2025 21:41:33 MESZ schrieb Java Entwicklung <javac=2Eaydic@g=
mail=2Ecom>:
>Thanks! Where (which libs and methods) would you set your breakpoints if
>you were to debug why access to the protected method was denied?
>
>On Sat, 12 Jul 2025 at 14:03, Richard Zowalla <rzo1@apache=2Eorg> wrote:
>
>> Hi,
>>
>> I think this is were things are going to be complicated ;-)
>>
>> Hard to say what the reason could possibly be in your EAR setup=2E
>>
>> From what I remember is, that EARs make things always a bit more
>> complicated due to the special classloader hierarchies involved=2E
>>
>> I would double check, that no (api) libs provide by the container are
>> available in the WAR archives, EJB modules or in the shared libs of the=
 EAR=2E
>> Next step would be to remote debug the application for a specific reque=
st
>> to see, what actually goes wrong on the container / configuration side =
of
>> things=2E
>>
>> Gru=C3=9F
>> Richard
>>
>>
>> > Am 12=2E07=2E2025 um 11:08 schrieb Java Entwicklung <javac=2Eaydic@gm=
ail=2Ecom>:
>> >
>> > Hello Richard,
>> >
>> > Yes indeed, that was the problem! It starts just fine on the demo app=
 and
>> > with my keycloak details it authenticates and authorizes as expected=
=2E
>> > However, in the real app where I need this, it is giving me 403 (mean=
ing
>> > authentication worked but "admin-role" is somehow still unrecognised)=
=2E=2E
>> >
>> > So far I developed and used my custom app without Keycloak=2E I could
>> > delegate the requests to the app-core without issues (because my prox=
y
>> war
>> > app was already there - within the EAR of that backend system=2E
>> > But now, when I'm touching the roles, it seems not to recognise my
>> Keycloak
>> > roles ("admin-role", "user-role") and gives me 403=2E
>> >
>> > ------ here's what I used to ask ChatGPT about the issue but it wasn'=
t
>> much
>> > of a help ----
>> >
>> > My backend app is deployed to TomEE 10 as an EAR=2E That ear consists=
 of
>> > several WARs, most important ones being:
>> > * app-core=2Ewar --> the core of the backend
>> > * app-rest=2Ewar --> the rest layer
>> > * my-custom-proxy-app=2Ewar --> I added this as proxy layer; external
>> backend
>> > clients (like mobile apps, web apps, desktop apps, etc=2E send their
>> requests
>> > to this app and it then delegates to the core backend
>> >
>> > The backend app itself has its own java/tomcat security layer, consis=
ting
>> > of realms, policies, roles, users, etc=2E
>> >
>> > Now, I want my client apps AND my proxy app (my-custom-proxy-app=2Ewa=
r) to
>> > use keycloak for authentication and authorization=2E On the client ap=
ps'
>> end
>> > it is working and the requests are being sent with a valid bearer tok=
en=2E
>> >
>> > In TomEE I'm using MP-JWT and it is able to confirm validity of the t=
oken
>> > so a request to a protected resource doesn't return 401 (sign that it
>> > authenticated successfully) - but rather it is returning 403, meaning
>> that
>> > the role ("admin-role") that is contained in my Keycloak's token is n=
ot
>> > recognized (the role is correctly included under "groups" - it's done=
 on
>> > Keycloak level and is the same keycloak instance I used with the demo
>> app,
>> > where it worked)=2E
>> >
>> > Important:
>> > * I don't need my "admin-role" available across other WARs - just in =
this
>> > my-custom-proxy-app=2Ewar
>> > * role in token is correctly configured - I built a demo app where a
>> single
>> > WAR is deployed to TomEE and I get 200 for a protected resource
>> > * everything else, including annotations and MP config is set exactly=
 how
>> > it is set up in the demo app
>> > * I can see backend's roles being defined in
>> > <EAR>/META-INF/application=2Exml, and then once again in
>> > <EAR>/app-core/WEB-INF/web=2Exml -- I tried adding "admin-role" role
>> > definition to both of those places but it changed nothing=2E
>> >
>> > That means, somehow the whole backend application expects my "admin-r=
ole"
>> > from the token to be part of backend app's security realm=2E The thin=
g is:
>> i
>> > don't know how everything works in such a set up=2E
>> > ---------------------------------------------------------------------
>> >
>> > I hope this sheds some light on my setup and you will know what the i=
ssue
>> > is=2E
>> >
>> >
>> > On Fri, 11 Jul 2025 at 20:03, Richard Zowalla <rzo1@apache=2Eorg> wro=
te:
>> >
>> >> Hi,
>> >>
>> >> Had a quick look at your example:
>> >> https://github=2Ecom/javac9/tomee-with-jwt-demo
>> >>
>> >> You shouldn=E2=80=99t bundle the API=E2=80=99s in your web app=2E In=
 TomEE, these libs are
>> >> shipped with the container, i=2Ee
>> >> should be in compileOnly scope:
>> >>
>> >>    implementation("org=2Eapache=2Etomee:jakartaee-api:10=2E0")
>> >>
>> >>
>> >>
>> implementation("org=2Eeclipse=2Emicroprofile=2Ejwt:microprofile-jwt-aut=
h-api:2=2E1=E2=80=9C)
>> >>
>> >> If you change that and do a full WAR rebuild, the web app will deplo=
y:
>> >>
>> >> tomee   | 11-Jul-2025 18:00:33=2E859 INFO [main]
>> >> org=2Eapache=2Eopenejb=2Eserver=2Ecxf=2Ers=2ECxfRsHttpListener=2Elog=
Endpoints REST
>> >> Application: http://localhost:8080/demoapp/api                ->
>> >> com=2Eexample=2Etomeewithjwtdemo=2EHelloApplication@5fd8302e
>> >> tomee   | 11-Jul-2025 18:00:33=2E862 INFO [main]
>> >> org=2Eapache=2Eopenejb=2Eserver=2Ecxf=2Ers=2ECxfRsHttpListener=2Elog=
Endpoints
>> >> Service URI: http://localhost:8080/demoapp/api/health         -> Poj=
o
>> >> org=2Eapache=2Etomee=2Emicroprofile=2Ehealth=2EMicroProfileHealthChe=
cksEndpoint
>> >> tomee   | 11-Jul-2025 18:00:33=2E862 INFO [main]
>> >> org=2Eapache=2Eopenejb=2Eserver=2Ecxf=2Ers=2ECxfRsHttpListener=2Elog=
Endpoints
>> >>   GET http://localhost:8080/demoapp/api/health         ->      Respo=
nse
>> >> getChecks()
>> >> tomee   | 11-Jul-2025 18:00:33=2E862 INFO [main]
>> >> org=2Eapache=2Eopenejb=2Eserver=2Ecxf=2Ers=2ECxfRsHttpListener=2Elog=
Endpoints
>> >>   GET http://localhost:8080/demoapp/api/health/live    ->      Respo=
nse
>> >> getLiveChecks()
>> >> tomee   | 11-Jul-2025 18:00:33=2E862 INFO [main]
>> >> org=2Eapache=2Eopenejb=2Eserver=2Ecxf=2Ers=2ECxfRsHttpListener=2Elog=
Endpoints
>> >>   GET http://localhost:8080/demoapp/api/health/ready   ->      Respo=
nse
>> >> getReadyChecks()
>> >> tomee   | 11-Jul-2025 18:00:33=2E862 INFO [main]
>> >> org=2Eapache=2Eopenejb=2Eserver=2Ecxf=2Ers=2ECxfRsHttpListener=2Elog=
Endpoints
>> >>   GET http://localhost:8080/demoapp/api/health/started ->      Respo=
nse
>> >> getStartedChecks()
>> >> tomee   | 11-Jul-2025 18:00:33=2E862 INFO [main]
>> >> org=2Eapache=2Eopenejb=2Eserver=2Ecxf=2Ers=2ECxfRsHttpListener=2Elog=
Endpoints
>> >> Service URI: http://localhost:8080/demoapp/api/v1             -> Poj=
o
>> >> com=2Eexample=2Etomeewithjwtdemo=2EHelloResource
>> >> tomee   | 11-Jul-2025 18:00:33=2E862 INFO [main]
>> >> org=2Eapache=2Eopenejb=2Eserver=2Ecxf=2Ers=2ECxfRsHttpListener=2Elog=
Endpoints
>> >>   GET http://localhost:8080/demoapp/api/v1/admin       ->      Strin=
g
>> >> helloAdmin()
>> >> tomee   | 11-Jul-2025 18:00:33=2E862 INFO [main]
>> >> org=2Eapache=2Eopenejb=2Eserver=2Ecxf=2Ers=2ECxfRsHttpListener=2Elog=
Endpoints
>> >>   GET http://localhost:8080/demoapp/api/v1/user        ->      Strin=
g
>> >> hello()
>> >> tomee   | 11-Jul-2025 18:00:33=2E880 INFO [main]
>> >> java=2Elang=2Ereflect=2EMethod=2Einvoke Deployment of web applicatio=
n archive
>> >> [/usr/local/tomee/webapps/demoapp=2Ewar] has finished in [1,420] ms
>> >>
>> >> Since I don=E2=80=99t have a key cloak setup available, it will subs=
equently
>> fail
>> >> ;-)
>> >>
>> >> Gru=C3=9F
>> >> Richard
>> >>
>> >>
>> >>> Am 11=2E07=2E2025 um 14:54 schrieb Java Entwicklung <javac=2Eaydic@=
gmail=2Ecom
>> >:
>> >>>
>> >>> ```
>> >>> # Tested with:
>> >>> tomee docker image: tomee:plus
>> >>> org=2Eeclipse=2Emicroprofile=2Ejwt:microprofile-jwt-auth-api:2=2E1
>> >>>
>> >>> # but same is with:
>> >>> tomee docker image: tomee:10=2E1-jre21-plus
>> >>> org=2Eeclipse=2Emicroprofile=2Ejwt:microprofile-jwt-auth-api:2=2E2-=
RC1
>> >>> ```
>> >>>
>> >>> Hello,
>> >>>
>> >>> I created a demo Jakarta EE 10 app and configured it so it
>> authenticates
>> >>> incoming requests to my protected resource against my Keycloak
>> instance=2E
>> >>>
>> >>> It works successfully with Payara Micro 6 but with TomEE 10=2E0 (wh=
ich is
>> >>> what I need and have to use) it fails on startup with the following=
:
>> >>> ```
>> >>> 11-Jul-2025 11:55:42=2E801 WARNING [main]
>> >>> org=2Eapache=2Ebatchee=2Econtainer=2Eservices=2EServicesManager=2Ei=
nit You didn't
>> >>> specify org=2Eapache=2Ebatchee=2Ejmx=2Eapplication and JMX is alrea=
dy
>> registered,
>> >>> skipping
>> >>> 2025-07-11T11:55:42=2E804794711Z 11-Jul-2025 11:55:42=2E804 INFO [m=
ain]
>> >>> org=2Eapache=2Eopenejb=2Eassembler=2Eclassic=2EAssembler=2EcreateAp=
plication
>> Deployed
>> >>> Application(path=3D/usr/local/tomee/webapps/demoapp)
>> >>> 2025-07-11T11:55:43=2E426149580Z 11-Jul-2025 11:55:43=2E425 INFO [m=
ain]
>> >>> org=2Eapache=2Emyfaces=2Ewebapp=2EMyFacesContainerInitializer=2EonS=
tartup Using
>> >>> org=2Eapache=2Emyfaces=2Ewebapp=2EMyFacesContainerInitializer
>> >>> 2025-07-11T11:55:43=2E614818412Z 11-Jul-2025 11:55:43=2E614 INFO [m=
ain]
>> >>> org=2Eapache=2Emyfaces=2Ewebapp=2EMyFacesContainerInitializer=2EonS=
tartup Added
>> >>> FacesServlet with mappings=3D[/faces/*, *=2Ejsf, *=2Efaces, *=2Exht=
ml]
>> >>> 2025-07-11T11:55:43=2E628173897Z 11-Jul-2025 11:55:43=2E626 SEVERE =
[main]
>> >>> java=2Elang=2Ereflect=2EMethod=2Einvoke Error deploying web applica=
tion archive
>> >>> [/usr/local/tomee/webapps/demoapp=2Ewar]
>> >>> 2025-07-11T11:55:43=2E628209564Z java=2Elang=2EIllegalStateExceptio=
n: Error
>> >>> starting child
>> >>> 2025-07-11T11:55:43=2E628212292Z at
>> >>>
>> >>
>> org=2Eapache=2Ecatalina=2Ecore=2EContainerBase=2EaddChildInternal(Conta=
inerBase=2Ejava:602)
>> >>> 2025-07-11T11:55:43=2E628214272Z at
>> >>> org=2Eapache=2Ecatalina=2Ecore=2EContainerBase=2EaddChild(Container=
Base=2Ejava:571)
>> >>> 2025-07-11T11:55:43=2E628215708Z at
>> >>> org=2Eapache=2Ecatalina=2Ecore=2EStandardHost=2EaddChild(StandardHo=
st=2Ejava:654)
>> >>> 2025-07-11T11:55:43=2E628217070Z at
>> >>> org=2Eapache=2Ecatalina=2Estartup=2EHostConfig=2EdeployWAR(HostConf=
ig=2Ejava:965)
>> >>> 2025-07-11T11:55:43=2E628218545Z at
>> >>>
>> >>
>> org=2Eapache=2Ecatalina=2Estartup=2EHostConfig$DeployWar=2Erun(HostConf=
ig=2Ejava:1903)
>> >>> 2025-07-11T11:55:43=2E628219991Z at
>> >>> java=2Ebase/java=2Eutil=2Econcurrent=2EExecutors$RunnableAdapter=2E=
call(Unknown
>> >>> Source)
>> >>> 2025-07-11T11:55:43=2E628221298Z at
>> >>> java=2Ebase/java=2Eutil=2Econcurrent=2EFutureTask=2Erun(Unknown Sou=
rce)
>> >>> 2025-07-11T11:55:43=2E628222601Z at
>> >>>
>> >>
>> org=2Eapache=2Etomcat=2Eutil=2Ethreads=2EInlineExecutorService=2Eexecut=
e(InlineExecutorService=2Ejava:75)
>> >>> 2025-07-11T11:55:43=2E628224008Z at
>> >>> java=2Ebase/java=2Eutil=2Econcurrent=2EAbstractExecutorService=2Esu=
bmit(Unknown
>> >>> Source)
>> >>> 2025-07-11T11:55:43=2E628236311Z at
>> >>> org=2Eapache=2Ecatalina=2Estartup=2EHostConfig=2EdeployWARs(HostCon=
fig=2Ejava:769)
>> >>> 2025-07-11T11:55:43=2E628238350Z at
>> >>> org=2Eapache=2Ecatalina=2Estartup=2EHostConfig=2EdeployApps(HostCon=
fig=2Ejava:420)
>> >>> 2025-07-11T11:55:43=2E628239666Z at
>> >>> org=2Eapache=2Ecatalina=2Estartup=2EHostConfig=2Estart(HostConfig=
=2Ejava:1621)
>> >>> 2025-07-11T11:55:43=2E628241335Z at
>> >>>
>> >>
>> org=2Eapache=2Ecatalina=2Estartup=2EHostConfig=2ElifecycleEvent(HostCon=
fig=2Ejava:303)
>> >>> 2025-07-11T11:55:43=2E628255587Z at
>> >>>
>> >>
>> org=2Eapache=2Ecatalina=2Eutil=2ELifecycleBase=2EfireLifecycleEvent(Lif=
ecycleBase=2Ejava:109)
>> >>> 2025-07-11T11:55:43=2E628256899Z at
>> >>>
>> >>
>> org=2Eapache=2Ecatalina=2Eutil=2ELifecycleBase=2EsetStateInternal(Lifec=
ycleBase=2Ejava:389)
>> >>> 2025-07-11T11:55:43=2E628258590Z at
>> >>> org=2Eapache=2Ecatalina=2Eutil=2ELifecycleBase=2EsetState(Lifecycle=
Base=2Ejava:336)
>> >>> 2025-07-11T11:55:43=2E628259958Z at
>> >>>
>> >>
>> org=2Eapache=2Ecatalina=2Ecore=2EContainerBase=2EstartInternal(Containe=
rBase=2Ejava:776)
>> >>> 2025-07-11T11:55:43=2E628261506Z at
>> >>>
>> >>
>> org=2Eapache=2Ecatalina=2Ecore=2EStandardHost=2EstartInternal(StandardH=
ost=2Ejava:772)
>> >>> 2025-07-11T11:55:43=2E628263034Z at
>> >>> org=2Eapache=2Ecatalina=2Eutil=2ELifecycleBase=2Estart(LifecycleBas=
e=2Ejava:164)
>> >>> 2025-07-11T11:55:43=2E628274187Z at
>> >>>
>> >>
>> org=2Eapache=2Ecatalina=2Ecore=2EContainerBase$StartChild=2Ecall(Contai=
nerBase=2Ejava:1203)
>> >>> 2025-07-11T11:55:43=2E628275693Z at
>> >>>
>> >>
>> org=2Eapache=2Ecatalina=2Ecore=2EContainerBase$StartChild=2Ecall(Contai=
nerBase=2Ejava:1193)
>> >>> 2025-07-11T11:55:43=2E628277030Z at
>> >>> java=2Ebase/java=2Eutil=2Econcurrent=2EFutureTask=2Erun(Unknown Sou=
rce)
>> >>> 2025-07-11T11:55:43=2E628280369Z at
>> >>>
>> >>
>> org=2Eapache=2Etomcat=2Eutil=2Ethreads=2EInlineExecutorService=2Eexecut=
e(InlineExecutorService=2Ejava:75)
>> >>> 2025-07-11T11:55:43=2E628281839Z at
>> >>> java=2Ebase/java=2Eutil=2Econcurrent=2EAbstractExecutorService=2Esu=
bmit(Unknown
>> >>> Source)
>> >>> 2025-07-11T11:55:43=2E628283322Z at
>> >>>
>> >>
>> org=2Eapache=2Ecatalina=2Ecore=2EContainerBase=2EstartInternal(Containe=
rBase=2Ejava:749)
>> >>> 2025-07-11T11:55:43=2E628284925Z at
>> >>>
>> >>
>> org=2Eapache=2Ecatalina=2Ecore=2EStandardEngine=2EstartInternal(Standar=
dEngine=2Ejava:203)
>> >>> 2025-07-11T11:55:43=2E628286472Z at
>> >>> org=2Eapache=2Ecatalina=2Eutil=2ELifecycleBase=2Estart(LifecycleBas=
e=2Ejava:164)
>> >>> 2025-07-11T11:55:43=2E628287734Z at
>> >>>
>> >>
>> org=2Eapache=2Ecatalina=2Ecore=2EStandardService=2EstartInternal(Standa=
rdService=2Ejava:412)
>> >>> 2025-07-11T11:55:43=2E628289236Z at
>> >>> org=2Eapache=2Ecatalina=2Eutil=2ELifecycleBase=2Estart(LifecycleBas=
e=2Ejava:164)
>> >>> 2025-07-11T11:55:43=2E628290566Z at
>> >>>
>> >>
>> org=2Eapache=2Ecatalina=2Ecore=2EStandardServer=2EstartInternal(Standar=
dServer=2Ejava:870)
>> >>> 2025-07-11T11:55:43=2E628292404Z at
>> >>> org=2Eapache=2Ecatalina=2Eutil=2ELifecycleBase=2Estart(LifecycleBas=
e=2Ejava:164)
>> >>> 2025-07-11T11:55:43=2E628293861Z at
>> >>> org=2Eapache=2Ecatalina=2Estartup=2ECatalina=2Estart(Catalina=2Ejav=
a:761)
>> >>> 2025-07-11T11:55:43=2E628295318Z at
>> >>>
>> java=2Ebase/jdk=2Einternal=2Ereflect=2EDirectMethodHandleAccessor=2Einv=
oke(Unknown
>> >>> Source)
>> >>> 2025-07-11T11:55:43=2E628301199Z at
>> >>> java=2Ebase/java=2Elang=2Ereflect=2EMethod=2Einvoke(Unknown Source)
>> >>> 2025-07-11T11:55:43=2E628302697Z at
>> >>> org=2Eapache=2Ecatalina=2Estartup=2EBootstrap=2Estart(Bootstrap=2Ej=
ava:345)
>> >>> 2025-07-11T11:55:43=2E628304266Z at
>> >>> org=2Eapache=2Ecatalina=2Estartup=2EBootstrap=2Emain(Bootstrap=2Eja=
va:476)
>> >>> 2025-07-11T11:55:43=2E628305690Z Caused by:
>> >>> org=2Eapache=2Ecatalina=2ELifecycleException: Failed to start compo=
nent
>> >>>
>> >>
>> [StandardEngine[Catalina]=2EStandardHost[localhost]=2EStandardContext[/=
demoapp]]
>> >>> 2025-07-11T11:55:43=2E628307498Z at
>> >>>
>> >>
>> org=2Eapache=2Ecatalina=2Eutil=2ELifecycleBase=2EhandleSubClassExceptio=
n(LifecycleBase=2Ejava:406)
>> >>> 2025-07-11T11:55:43=2E628309026Z at
>> >>> org=2Eapache=2Ecatalina=2Eutil=2ELifecycleBase=2Estart(LifecycleBas=
e=2Ejava:179)
>> >>> 2025-07-11T11:55:43=2E628310551Z at
>> >>>
>> >>
>> org=2Eapache=2Ecatalina=2Ecore=2EContainerBase=2EaddChildInternal(Conta=
inerBase=2Ejava:599)
>> >>> 2025-07-11T11:55:43=2E628312065Z =2E=2E=2E 35 more
>> >>> 2025-07-11T11:55:43=2E628313380Z Caused by:
>> java=2Elang=2ENullPointerException:
>> >>> Cannot invoke "org=2Eeclipse=2Emicroprofile=2Eauth=2ELoginConfig=2E=
authMethod()"
>> >>> because "loginConfig" is null
>> >>> 2025-07-11T11:55:43=2E628315144Z at
>> >>>
>> >>
>> org=2Eapache=2Etomee=2Emicroprofile=2Ejwt=2EMPJWTInitializer=2EonStartu=
p(MPJWTInitializer=2Ejava:45)
>> >>> 2025-07-11T11:55:43=2E628316658Z at
>> >>>
>> >>
>> org=2Eapache=2Ecatalina=2Ecore=2EStandardContext=2EstartInternal(Standa=
rdContext=2Ejava:4464)
>> >>> 2025-07-11T11:55:43=2E628320249Z at
>> >>> org=2Eapache=2Ecatalina=2Eutil=2ELifecycleBase=2Estart(LifecycleBas=
e=2Ejava:164)
>> >>> 2025-07-11T11:55:43=2E628321622Z =2E=2E=2E 36 more
>> >>> 2025-07-11T11:55:43=2E632485224Z 11-Jul-2025 11:55:43=2E632 INFO [m=
ain]
>> >>> java=2Elang=2Ereflect=2EMethod=2Einvoke Deployment of web applicati=
on archive
>> >>> [/usr/local/tomee/webapps/demoapp=2Ewar] has finished in [3,177] ms
>> >>> 2025-07-11T11:55:43=2E637611803Z 11-Jul-2025 11:55:43=2E637 INFO [m=
ain]
>> >>> java=2Elang=2Ereflect=2EMethod=2Einvoke Starting ProtocolHandler
>> >> ["http-nio-8080"]
>> >>> 2025-07-11T11:55:43=2E649430271Z 11-Jul-2025 11:55:43=2E649 INFO [m=
ain]
>> >>> java=2Elang=2Ereflect=2EMethod=2Einvoke Server startup in [3311] mi=
lliseconds
>> >>> ```
>> >>> Here's how I configured it:
>> >>>
>> >>> ```
>> >>> @ApplicationScoped
>> >>> @ApplicationPath("/api")
>> >>> @LoginConfig(authMethod=3D"MP-JWT")
>> >>> @DeclareRoles({
>> >>>       "admin-role",
>> >>>       "user-role"
>> >>> })
>> >>> public class HelloApplication extends Application {
>> >>>
>> >>> }
>> >>>
>> >>> // is a separate class
>> >>> @Path("/v1")
>> >>> @Produces("text/plain")
>> >>> public class HelloResource {
>> >>>
>> >>>   @GET
>> >>>   @Path("/admin")
>> >>>   @RolesAllowed("admin-role")
>> >>>   public String helloAdmin() {
>> >>>       return "Hello, Admin!";
>> >>>   }
>> >>>
>> >>>   @GET
>> >>>   @Path("/user")
>> >>>   public String hello() {
>> >>>       return "Hello, user!";
>> >>>   }
>> >>>
>> >>> }
>> >>> ```
>> >>>
>> >>> In `src/main/resources/META-INF/microprofile-config=2Eproperties` I=
 have:
>> >>> ```
>> >>> # JWT Configuration
>> >>> mp=2Ejwt=2Everify=2Eissuer=3Dhttp://auth=2Elocalhost:8090/realms/my=
realm
>> >>> mp=2Ejwt=2Everify=2Epublickey=2Elocation=3D
>> >>>
>> http://auth=2Elocalhost:8090/realms/myrealm/protocol/openid-connect/cer=
ts
>> >>> ```
>> >>> and my `src/main/webapp/WEB-INF/web=2Exml` contains:
>> >>> ```
>> >>> <?xml version=3D"1=2E0" encoding=3D"UTF-8"?>
>> >>> <web-app xmlns=3D"https://jakarta=2Eee/xml/ns/jakartaee"
>> >>>        xmlns:xsi=3D"http://www=2Ew3=2Eorg/2001/XMLSchema-instance"
>> >>>        xsi:schemaLocation=3D"https://jakarta=2Eee/xml/ns/jakartaee
>> >>> https://jakarta=2Eee/xml/ns/jakartaee/web-app_6_0=2Exsd"
>> >>>        version=3D"6=2E0">
>> >>>
>> >>>
>> >>> </web-app>
>> >>> ```
>> >>>
>> >>> I run gradle war, mount it to my tomee container's deployment dir a=
nd
>> >> start
>> >>> it=2E Again, this exact setup worked perfectly with Payara - the id=
ea was
>> >> to
>> >>> make sure the config is correct before trying to solve startup issu=
e in
>> >>> TomEE (sure, TomEE might require something differently)=2E
>> >>>
>> >>>
>> >>> Note that removing `@LoginConfig(authMethod=3D"MP-JWT")` annotation=
 on
>> the
>> >>> class and using:
>> >>> ```
>> >>> <login-config>
>> >>> <auth-method>MP-JWT</auth-method>
>> >>> </login-config>
>> >>> ```
>> >>> doesn't have the same effect! There is no such startup error but al=
l
>> >>> resources return `404 Not found`=2E
>> >>>
>> >>> Also note that I have tested with various other TomEE flavours of
>> version
>> >>> 10 - but no difference=2E
>> >>
>> >>
>>
>>

------0BDIBHHKN17FWP5XBBPF1D9HTUQ39S--