3 Replies Latest reply on Dec 29, 2019 5:47 AM by mukund_sawant

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'undertowServletWebServerFactory'

    mukund_sawant

      Hi ,

       

       

      I am working on migration project from Spring to SpringBoot and also we are changing Web app server to Redhat Enterprise App server . Currently I am trying to run the project after doing all changes on my machine where EAP has been installed .

       

      I tried to find and remove the duplicate declaration in pom.xml , removed all default dependancy of Tomcat from pom file but still I am facing the same issue . Please note that SpringBootServletInitializer has been extended in main class and configure method has been overriden , not sure if this is relevant or not .

       

      Following is an error when I deploy to RedHat EAP 7.2.0.ga (WildFly Core 6.0.11.Final-redhat-00001)

       

      WFLYCTL0186: Services which failed to start: service jboss.deployment.unit."servicename.war".undertow-deployment: java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'undertowServletWebServerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryConfiguration$EmbeddedUndertow.class]: Initialization of bean failed; nested exception is java.lang.LinkageError: loader constraint violation: when resolving field "MAX_HEADER_SIZE" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the referring class, io/undertow/UndertowOptions, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for the field's resolved type, org/xnio/Option, have different Class objects for that type

      at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:81) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35) at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378) at java.lang.Thread.run(Thread.java:748) at org.jboss.threads.JBossThread.run(JBossThread.java:485)

      Caused by: java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'undertowServletWebServerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryConfiguration$EmbeddedUndertow.class]: Initialization of bean failed; nested exception is java.lang.LinkageError: loader constraint violation: when resolving field "MAX_HEADER_SIZE" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the referring class, io/undertow/UndertowOptions, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for the field's resolved type, org/xnio/Option, have different Class objects for that type at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:252) at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:96) at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:78) ... 8 more

      I am not able to deploy the project in JBoss EAP 7.2.0.GA (WildFly Core 6.0.11.Final-redhat-00001) due to mentioned exception.

       

       

      Regards,

      Mukund