Custom route cannot be added error in OpenIG

This topic contains 2 replies, has 2 voices, and was last updated by  srinath.m 1 year, 1 month ago.

  • Author
    Posts
  • #22386
     srinath.m 
    Participant

    Hi All,

    Iam getting below error on OpenIG start in debug logs and I have added a custom route 01-api-authcontext.json (C:\windows\system32\config\systemprofile\AppData\Roaming\OpenIG\config\routes\01-api-authcontext.json)

    Error in debug.log ::
    ——————————————————————————————
    MON JUN 25 15:20:19 IST 2018 WARNING JwtSession — JWT session support has been enabled but no encryption keys have been configured. A temporary key pair will be used but this means that OpenIG will not be able to decrypt any JWT session cookies after a configuration change, a server restart, nor will it be able to decrypt JWT session cookies encrypted by another OpenIG server.
    MON JUN 25 15:20:20 IST 2018 WARNING {Router}/handler — Heaplet name (‘{Router}/handler’) has been converted to a slug (‘router-handler’) for URL exposition (REST endpoints).
    MON JUN 25 15:20:20 IST 2018 ERROR {Router}/handler — The route defined in file ‘C:\windows\system32\config\systemprofile\AppData\Roaming\OpenIG\config\routes\01-api-authcontext.json’ cannot be added
    MON JUN 25 15:20
    :20 IST 2018 ERROR {Router}/handler — io/jsonwebtoken/ExpiredJwtException
    # java.lang.NoClassDefFoundError: io/jsonwebtoken/ExpiredJwtException
    # at java.lang.Class.forName0(Native Method)
    # at java.lang.Class.forName(Unknown Source)
    # at org.forgerock.openig.util.JsonValues.classForName(JsonValues.java:88)
    # at org.forgerock.openig.util.JsonValues.asClass(JsonValues.java:117)
    # at org.forgerock.openig.heap.HeapImpl.addDeclaration(HeapImpl.java:260)
    # at org.forgerock.openig.heap.HeapImpl.resolve(HeapImpl.java:413)
    # at org.forgerock.openig.heap.HeapImpl.resolve(HeapImpl.java:382)
    # at org.forgerock.openig.util.JsonValues$4.apply(JsonValues.java:301)
    # at org.forgerock.openig.util.JsonValues$4.apply(JsonValues.java:298)
    # at org.forgerock.json.JsonValue.asList(JsonValue.java:727)
    # at org.forgerock.openig.filter.Chain$Heaplet.create(Chain.java:81)
    # at org.forgerock.openig.heap.GenericHeaplet.create(GenericHeaplet.java:92)
    # at org.forgerock.openig.heap.HeapImpl.extract(HeapImpl.java:363)
    # at org.forgerock.openig.heap.HeapImpl.get(HeapImpl.java:310)
    # at org.forgerock.openig.heap.HeapImpl.resolve(HeapImpl.java:415)
    # at org.forgerock.openig.heap.HeapImpl.resolve(HeapImpl.java:382)
    # at org.forgerock.openig.handler.DispatchHandler$Heaplet.create(DispatchHandler.java:145)
    # at org.forgerock.openig.heap.GenericHeaplet.create(GenericHeaplet.java:92)
    # at org.forgerock.openig.heap.HeapImpl.extract(HeapImpl.java:363)
    # at org.forgerock.openig.heap.HeapImpl.get(HeapImpl.java:310)
    # at org.forgerock.openig.heap.HeapImpl.resolve(HeapImpl.java:415)
    # at org.forgerock.openig.heap.HeapImpl.resolve(HeapImpl.java:382)
    # at org.forgerock.openig.heap.HeapImpl.getHandler(HeapImpl.java:588)
    # at org.forgerock.openig.handler.router.RouteBuilder.setupRouteHandler(RouteBuilder.java:205)
    # at org.forgerock.openig.handler.router.RouteBuilder.build(RouteBuilder.java:146)
    # at org.forgerock.openig.handler.router.RouteBuilder.build(RouteBuilder.java:100)
    # at org.forgerock.openig.handler.router.RouterHandler.onAddedFile(RouterHandler.java:209)
    # at org.forgerock.openig.handler.router.RouterHandler.onChanges(RouterHandler.java:194)
    # at org.forgerock.openig.handler.router.DirectoryMonitor.scan(DirectoryMonitor.java:138)
    # at org.forgerock.openig.handler.router.PeriodicDirectoryScanner.scan(PeriodicDirectoryScanner.java:89)
    # at org.forgerock.openig.handler.router.RouterHandler.start(RouterHandler.java:163)
    # at org.forgerock.openig.handler.router.RouterHandler$Heaplet.start(RouterHandler.java:360)
    # at org.forgerock.openig.heap.GenericHeaplet.create(GenericHeaplet.java:99)
    # at org.forgerock.openig.heap.HeapImpl.extract(HeapImpl.java:363)
    # at org.forgerock.openig.heap.HeapImpl.get(HeapImpl.java:310)
    # at org.forgerock.openig.heap.HeapImpl.resolve(HeapImpl.java:415)
    # at org.forgerock.openig.heap.HeapImpl.resolve(HeapImpl.java:382)
    # at org.forgerock.openig.heap.HeapImpl.getHandler(HeapImpl.java:588)
    # at org.forgerock.openig.http.GatewayHttpApplication.start(GatewayHttpApplication.java:214)
    # at org.forgerock.http.servlet.HttpFrameworkServlet.init(HttpFrameworkServlet.java:134)
    # at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    # at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1227)
    # at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1140)
    # at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1027)
    # at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5037)
    # at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5347)
    # at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    # at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753)
    # at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729)
    # at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    # at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:974)
    # at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1850)
    # at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    # at java.util.concurrent.FutureTask.run(Unknown Source)
    # at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    # at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    # at java.lang.Thread.run(Unknown Source)
    # Caused by: java.lang.ClassNotFoundException: io.jsonwebtoken.ExpiredJwtException
    # at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1335)
    # at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1163)
    # … 57 more
    —————————————————————————————————-

    OpenIG version – 4.0.0

    Created a filter class and deployed the jar file under C:\path-to-openig\Tomcat 8.0_Tomcat-openig\webapps\ROOT\WEB-INF\lib

    1.config.json details below

    {  
       "handler":{  
          "type":"Router",
          "audit":"global",
    	   "capture":"all"
       },
       "heap":[  
          {  
             "name":"LogSink",
             "type":"FileLogSink",
             "config":{  
                "file":"C:\\windows\\system32\\config\\systemprofile\\AppData\\Roaming\\OpenIG\\debug.log",
                "level":"DEBUG"
             }
          },
          {  
             "name":"JwtSession",
             "type":"JwtSession"
          },
          {  
             "name":"capture",
             "type":"CaptureDecorator",
             "config":{  
                "captureEntity":false,
                "_captureContext":true
             }
          }
       ]
    }

    2.here is my route 01-api-authcontext.json

    {  
       "handler":{  
          "type":"DispatchHandler",
          "config":{  
             "bindings":[  
                {  
                   "condition":"${request.cookies['iPlanetDirectoryPro'] == null}",
                   "handler":{  
                      "type":"StaticResponseHandler",
                      "config":{  
                         "status":401,
                         "reason":"Unauthorized Access",
                         "entity":"Unauthorized Access"
                      }
                   }
                },
                {  
                   "comment":"This condition is optional, but included for clarity.",
                   "condition":"${request.cookies['iPlanetDirectoryPro'] != null}",
                   "handler":{  
                      "type":"Chain",
                      "config":{  
                         "filters":[  
                            {  
                               "name":"UserContext",
                               "type":"com.ap.test.openig.filter.UserContext",
                               "config":{  
                                  "name":"X-Greeting",
                                  "value":"Welcome to OpenIG"
                               }
                            }
                            
                         ]
                      }
                   }
                }
             ]
          }
       },
       "condition":"${matches(request.uri.path, '^/api/auth-context')}"
    }

    Any idea on this would be appreciated.

    Thanks,
    Srinath

    #22387
     violette 
    Participant

    Hello srinath.m,

    For your issue above, it means that the exception ExpiredJwtException is not loaded by the class loader as it cannot retrieve/found it. It is probably a missing dependency from your custom class “com.ap.test.openig.filter.UserContext” (about the JJWT library).
    Moreover, IG 4.0 is using jackson-databind 2.6.3 and you probably should upgraded it as well (JJWT requires 2.8.x). (see https://github.com/jwtk/jjwt#already-using-an-older-jackson-dependency)

    Have a look to https://backstage.forgerock.com/docs/openig/4/gateway-guide/#custom-handler

    Cheers,
    /Violette.

    #22388
     srinath.m 
    Participant

    Thanks for the quick reply @violette. It is working fine with above suggestions.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

©2019 ForgeRock - we provide an identity and access platform to secure every online relationship for the enterprise market, educational sector and even entire countries. Click to view our privacy policy and terms of use.

Log in with your credentials

Forgot your details?