oauth-2.0solrazure-web-app-service

solr - Error after changing security.json to JWT - Searching for Solr? You must type the correct path. Solr will respond


Im very new in SOLR and have to deploy a solr. I am using Azure App Service with Docker compose. It worked well with Basic Auth configured.

But i want to use Azure OAuth2, since Auth provider is not suported for app service with docker compose, i configured the security.json according this article.

{
  "authentication": {
    "class": "solr.JWTAuthPlugin",
    "blockUnknown": true,
    "redirectUris": "https://<app-service-name>.azurewebsites.net/solr/",
    "principalClaim": "name",
    "rolesClaim": "roles",
    "adminUiScope": "api://<client-id>/admin",
    "issuers": [
        {
           "name": "AzureAD",
            "wellKnownUrl": "https://login.microsoftonline.com/<tenant-id>/v2.0/.well-known/openid-configuration",
            "clientId": "<client-id>",
            "aud": "api://<client-id>",
            "iss": "https://sts.windows.net/<tenant-id>/"
        }
    ]
}
}

if i direct to the app service base url it redirect me to /solr but the browser displays this message:

Searching for Solr?
You must type the correct path.
Solr will respond.

Also if I enter the api endpoints (with and withouth bearer), that worked before, i get 404 with the same html response.

This is what the logs say:

2024-05-23T15:31:37.065383014Z: [INFO]  2024-05-23 15:31:37.064 ERROR (qtp2131597042-25) [   ] o.a.s.s.CoreContainerProvider Error processing the request. CoreContainer is either not initialized or shutting down.
2024-05-23T15:31:37.115067067Z: [INFO]  2024-05-23 15:31:37.067 WARN  (qtp2131597042-25) [   ] o.e.j.s.HttpChannel /solr/ => javax.servlet.ServletException: javax.servlet.UnavailableException: Error processing the request. CoreContainer is either not initialized or shutting down.
2024-05-23T15:31:37.115104866Z: [INFO]      at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:157)
2024-05-23T15:31:37.115110566Z: [INFO]  javax.servlet.ServletException: javax.servlet.UnavailableException: Error processing the request. CoreContainer is either not initialized or shutting down.
2024-05-23T15:31:37.115114266Z: [INFO]      at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:157) ~[jetty-server-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115129766Z: [INFO]      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122) ~[jetty-server-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115133666Z: [INFO]      at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:301) ~[jetty-rewrite-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115214666Z: [INFO]      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122) ~[jetty-server-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115219466Z: [INFO]      at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:822) ~[jetty-server-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115222966Z: [INFO]      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122) ~[jetty-server-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115226466Z: [INFO]      at org.eclipse.jetty.server.Server.handle(Server.java:563) ~[jetty-server-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115229865Z: [INFO]      at org.eclipse.jetty.server.HttpChannel$RequestDispatchable.dispatch(HttpChannel.java:1598) ~[jetty-server-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115233265Z: [INFO]      at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:753) ~[jetty-server-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115236765Z: [INFO]      at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:501) ~[jetty-server-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115240065Z: [INFO]      at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:287) ~[jetty-server-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115243765Z: [INFO]      at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314) ~[jetty-io-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115247165Z: [INFO]      at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100) ~[jetty-io-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115261565Z: [INFO]      at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53) ~[jetty-io-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115265965Z: [INFO]      at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:421) ~[jetty-util-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115269565Z: [INFO]      at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:390) ~[jetty-util-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115272965Z: [INFO]      at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:277) ~[jetty-util-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115276365Z: [INFO]      at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:199) ~[jetty-util-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115279765Z: [INFO]      at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411) ~[jetty-util-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115283265Z: [INFO]      at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969) ~[jetty-util-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115286565Z: [INFO]      at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194) ~[jetty-util-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115297165Z: [INFO]      at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149) ~[jetty-util-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115301365Z: [INFO]      at java.base/java.lang.Thread.run(Unknown Source) [?:?]
2024-05-23T15:31:37.115304965Z: [INFO]  Caused by: javax.servlet.UnavailableException: Error processing the request. CoreContainer is either not initialized or shutting down.
2024-05-23T15:31:37.115308365Z: [INFO]      at org.apache.solr.servlet.CoreContainerProvider.waitForCoreContainer(CoreContainerProvider.java:156) ~[?:?]
2024-05-23T15:31:37.115311765Z: [INFO]      at org.apache.solr.servlet.CoreContainerProvider.getCoreContainer(CoreContainerProvider.java:125) ~[?:?]
2024-05-23T15:31:37.115315065Z: [INFO]      at org.apache.solr.servlet.SolrDispatchFilter.getCores(SolrDispatchFilter.java:174) ~[?:?]
2024-05-23T15:31:37.115318465Z: [INFO]      at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:192) ~[?:?]
2024-05-23T15:31:37.115321765Z: [INFO]      at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:210) ~[jetty-servlet-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115325165Z: [INFO]      at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635) ~[jetty-servlet-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115329065Z: [INFO]      at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527) ~[jetty-servlet-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115332565Z: [INFO]      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131) ~[jetty-server-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115335865Z: [INFO]      at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:598) ~[jetty-security-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115339265Z: [INFO]      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122) ~[jetty-server-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115342565Z: [INFO]      at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223) ~[jetty-server-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115345965Z: [INFO]      at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1580) ~[jetty-server-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115349265Z: [INFO]      at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221) ~[jetty-server-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115352865Z: [INFO]      at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1384) ~[jetty-server-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115356265Z: [INFO]      at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176) ~[jetty-server-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115359665Z: [INFO]      at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484) ~[jetty-servlet-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115363165Z: [INFO]      at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1553) ~[jetty-server-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115366365Z: [INFO]      at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174) ~[jetty-server-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115369765Z: [INFO]      at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1306) ~[jetty-server-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115376464Z: [INFO]      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129) ~[jetty-server-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115379864Z: [INFO]      at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:149) ~[jetty-server-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115383264Z: [INFO]      at org.eclipse.jetty.server.handler.InetAccessHandler.handle(InetAccessHandler.java:228) ~[jetty-server-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115386664Z: [INFO]      at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:141) ~[jetty-server-10.0.20.jar:10.0.20]
2024-05-23T15:31:37.115389964Z: [INFO]      ... 22 more

Can someone help me?

EDIT: after digging through the log files I found and important part of the error message that was cutted out in the azure log view:

2024-05-23 20:06:47.575 INFO  (main) [   ] o.a.s.c.CoreContainer Initializing authentication plugin: solr.JWTAuthPlugin
2024-05-23 20:06:47.614 ERROR (main) [   ] o.a.s.s.CoreContainerProvider Could not start Solr. Check solr/home property and the logs => org.apache.solr.common.SolrException:  Error loading class 'solr.JWTAuthPlugin'
    at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:551)
org.apache.solr.common.SolrException:  Error loading class 'solr.JWTAuthPlugin'
    at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:551) ~[?:?]


Solution

  • After I found the crucial part of the logs I also found the problem.

    The JWTAuthPlugin Module needs to be enabled.

    I did this by adding this in the solr.xml as child of th <solr> tag:

    <str name="modules">jwt-auth</str>

    Hope that helps someone.