1 Reply Latest reply on Dec 1, 2016 3:20 PM by eliasbalasis1

    Arquillian Wildfly Embedded Container - Unexpected Fatal Error

    eliasbalasis1

      When running Arquillian Wildfly Embedded Container,

       

      if one of the deployed applications under test depends on spring-web framework

       

      Arquillian embedded contained gives the error

       

      Caused by: java.util.ServiceConfigurationError: javax.servlet.ServletContainerInitializer: Provider org.springframework.web.SpringServletContainerInitializer not found

        at java.util.ServiceLoader.fail(ServiceLoader.java:239) [rt.jar:1.8.0_92]

        at java.util.ServiceLoader.access$300(ServiceLoader.java:185) [rt.jar:1.8.0_92]

        at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:372) [rt.jar:1.8.0_92]

        at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) [rt.jar:1.8.0_92]

        at java.util.ServiceLoader$1.next(ServiceLoader.java:480) [rt.jar:1.8.0_92]

        at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.deploy(ServletContainerInitializerDeploymentProcessor.java:110)

        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:156) [wildfly-server-1.0.0.Final.jar:1.0.0.Final]

        ... 5 more

       

      The same problem does not occur when running with Managed Container.

       

      My suspicion is about classpath resolution inside embedded container.

      It looks like it is considering the jboss module loader only for classpath resolution.

       

      I have attached a Maven project that reproduces the problem as soon as the "spring-web" dependency is enabled

       

      I have posted this on both "Arquillian" and "Arquillian Development" groups under same title for convenience.

       

      Any ideas?

        • 1. Re: Arquillian Wildfly Embedded Container - Unexpected Fatal Error
          eliasbalasis1

          Some more information,

           

          This is reproducible on Wildfly 10.1.0 as well, which implies it is not Wildfly implementation issue, rather an Embedded container implementation issue.

           

          Furthermore,

          the problem occurs at java.util.ServiceLoader.LazyIterator.nextService() under Class.forName(cn, false, loader)

           

          "loader" here is the JBoss module class loader instance

           

          putting a break-point and

           

          evaluating Class.forName("javax.servlet.ServletContainerInitializer", false, loader) generates "java.util.ServiceConfigurationError: javax.servlet.ServletContainerInitializer: Provider org.springframework.web.SpringServletContainerInitializer not found"

           

          evaluating Class.forName("javax.servlet.ServletContainerInitializer", false, loader.getParent()) does not reproduce the error

           

          This is clearly a problem with the Embedded container module class loader

           

          Any thoughts anyone?