title: Jackson error in the spring boot and Wildfly 26
body: <p>I have a spring boot application in Wildfly 26.0.1.Final with a REST service and I implemented Spring Security in it. In my project, I extend OncePerRequestFilter and override its method doFilterInternal(). I also used jackson dataformat library in my project. When I call an API it throws following an exception. Here is my mvn dependency tree pastebin:- <a href="https://pastebin.com/VYTPETWF" rel="nofollow noreferrer">link</a></p>
  <pre><code>17:30:22,991 ERROR [xxxx.xxxxx.xxxxx.security.UUIDAuthenticationFilter] (default task-1) Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: com.fasterxml.jackson.dataformat.xml.XmlFactory._createContentReference(Ljava/lang/Object;)Lcom/fasterxml/jackson/core/io/ContentReference;: org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: com.fasterxml.jackson.dataformat.xml.XmlFactory._createContentReference(Ljava/lang/Object;)Lcom/fasterxml/jackson/core/io/ContentReference;
          at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1082)
          at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
          at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
          at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:523)
          at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
          at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
          at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
          at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:111)
          at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
          at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
          at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:111)
          at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
          at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327)
          at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115)
          at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
          at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122)
          at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
          at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126)
          at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
          at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
          at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
          at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
          at xxxx.xxxxx.xxxxx.security.UUIDAuthenticationFilter.doFilterInternal(UUIDAuthenticationFilter.java:54)
          at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
          at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103)
          at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
          at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90)
          at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75)
          at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
          at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110)
          at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
          at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55)
          at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
          at xxxx.xxxxx.xxxxx.security.CORSFilter.doFilterInternal(CORSFilter.java:36)
          at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
          at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211)
          at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183)
          at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354)
          at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267)
          at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
          at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
          at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
          at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
          at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
          at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
          at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
          at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
          at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
          at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
          at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:126)
          at org.springframework.boot.web.servlet.support.ErrorPageFilter.access$000(ErrorPageFilter.java:64)
          at org.springframework.boot.web.servlet.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:101)
          at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
          at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:119)
          at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
          at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
          at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
          at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
          at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
          at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
          at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
          at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
          at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
          at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
          at org.wildfly.elytron.web.undertow.server.ElytronRunAsHandler.lambda$handleRequest$1(ElytronRunAsHandler.java:68)
          at org.wildfly.security.auth.server.FlexibleIdentityAssociation.runAsFunctionEx(FlexibleIdentityAssociation.java:103)
          at org.wildfly.security.auth.server.Scoped.runAsFunctionEx(Scoped.java:161)
          at org.wildfly.security.auth.server.Scoped.runAs(Scoped.java:73)
          at org.wildfly.elytron.web.undertow.server.ElytronRunAsHandler.handleRequest(ElytronRunAsHandler.java:67)
          at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
          at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:117)
          at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
          at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
          at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
          at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
          at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
          at org.wildfly.elytron.web.undertow.server.servlet.CleanUpHandler.handleRequest(CleanUpHandler.java:38)
          at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
          at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
          at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
          at org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)
          at io.undertow.servlet.handlers.SendErrorPageHandler.handleRequest(SendErrorPageHandler.java:52)
          at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
          at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:275)
          at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:79)
          at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:134)
          at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:131)
          at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
          at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
          at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1544)
          at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1544)
          at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1544)
          at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1544)
          at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1544)
          at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:255)
          at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:79)
          at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:100)
          at io.undertow.server.Connectors.executeRootHandler(Connectors.java:387)
          at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:852)
          at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
          at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
          at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
          at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1348)
          at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1280)
          at java.lang.Thread.run(Thread.java:748)
  Caused by: java.lang.NoSuchMethodError: com.fasterxml.jackson.dataformat.xml.XmlFactory._createContentReference(Ljava/lang/Object;)Lcom/fasterxml/jackson/core/io/ContentReference;
          at com.fasterxml.jackson.dataformat.xml.XmlFactory.createGenerator(XmlFactory.java:497)
          at com.fasterxml.jackson.dataformat.xml.XmlFactory.createGenerator(XmlFactory.java:30)
          at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.writeInternal(AbstractJackson2HttpMessageConverter.java:425)
          at org.springframework.http.converter.AbstractGenericHttpMessageConverter.write(AbstractGenericHttpMessageConverter.java:104)
          at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:290)
  </code></pre>
  <p>I tried a solution for excluding Jackson module from the Wildfly using StackOverflow <a href="https://stackoverflow.com/questions/37060294/wildfly-9-how-do-i-exclude-jackson">link</a>.
  I create a file <code>jboss-deployment-structure.xml</code> inside <code>/WEB-INF</code></p>
  <pre><code>&lt;jboss-deployment-structure&gt;
      &lt;deployment&gt;
          &lt;exclude-subsystems&gt;
              &lt;subsystem name=&quot;jaxrs&quot; /&gt;
          &lt;/exclude-subsystems&gt;
          &lt;exclusions&gt;
              &lt;module name=&quot;com.fasterxml.jackson.core.jackson-core&quot; /&gt;
              &lt;module name=&quot;com.fasterxml.jackson.core.jackson-databind&quot; /&gt;
              &lt;module name=&quot;com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider&quot; /&gt;
              &lt;module name=&quot;org.jboss.resteasy.resteasy-jackson2-provider&quot; /&gt;
              &lt;module name=&quot;com.fasterxml.jackson.dataformat.jackson-dataformat-yaml&quot; &gt;
                  &lt;resources&gt;
                      &lt;resource-root path=&quot;jackson-dataformat-yaml-2.12.3.jar&quot; &gt;
                          &lt;filter&gt;
                              &lt;exclude path=&quot;com.fasterxml.jackson.dataformat&quot; /&gt;
                          &lt;/filter&gt;
                      &lt;/resource-root&gt;
                  &lt;/resources&gt;
              &lt;/module&gt;
          &lt;/exclusions&gt;
      &lt;/deployment&gt;
  &lt;/jboss-deployment-structure&gt;
  </code></pre>
  <p>I'm using OpenJDK version &quot;1.8.0_322&quot;
  OpenJDK Runtime Environment (build 1.8.0_322-b06)
  OpenJDK 64-Bit Server VM (build 25.322-b06, mixed mode)</p>
  <p>but it's not working.</p>