Skip to content

AWS Xray : Can we have AWSXRayServletFilter bean along with a OncePerRequestFilter request filter ? #394

@isururandika

Description

@isururandika

I have a simple spring boot application undertow application server integrated and i want to configure aws xray to trace incoming requests and down stream aspects of the application.

Basic flow of a incoming request as folows -
OncePerRequestFilter -> Controller Layer -> Service Layer -> DAO Layer

When i annotation the RequestFilter class where authentication happening of all requests with @XRayEnabled im getting folowing error at the startup of the application.

org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Undertow at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181) at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155) at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123) at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:937) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) at com.pearson.assessments.result.ResultServiceApplication.main(ResultServiceApplication.java:41) Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Undertow at org.springframework.boot.web.embedded.undertow.UndertowWebServer.start(UndertowWebServer.java:130) at org.springframework.boot.web.servlet.context.WebServerStartStopLifecycle.start(WebServerStartStopLifecycle.java:43) at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178) ... 14 common frames omitted Caused by: java.lang.NullPointerException: null at org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:241) at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:111) at io.undertow.servlet.core.ManagedFilter.createFilter(ManagedFilter.java:86) at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:594) at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:559) at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42) at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) at io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:601) at org.springframework.boot.web.embedded.undertow.DeploymentManagerHttpHandlerFactory$DeploymentManagerHandler.<init>(DeploymentManagerHttpHandlerFactory.java:66) at org.springframework.boot.web.embedded.undertow.DeploymentManagerHttpHandlerFactory.getHandler(DeploymentManagerHttpHandlerFactory.java:47) at org.springframework.boot.web.embedded.undertow.UndertowWebServer.createHttpHandler(UndertowWebServer.java:170) at org.springframework.boot.web.embedded.undertow.UndertowServletWebServer.createHttpHandler(UndertowServletWebServer.java:72) at org.springframework.boot.web.embedded.undertow.UndertowWebServer.createUndertowServer(UndertowWebServer.java:162) at org.springframework.boot.web.embedded.undertow.UndertowWebServer.start(UndertowWebServer.java:114) ... 16 common frames omitted

Can anyone help me on this ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions