1 Reply Latest reply on Sep 9, 2015 7:46 PM by Eric Fulton

    Testing Spring MVC in Wildfly managed with Arquillian

    Eric Fulton Newbie

      Hey there,

       

      I'm trying to run a spring mvc s in wildfly managed.  I keep getting errors like these when I try to run a test:

       

      13:18:04,994 WARN  [org.jboss.modules] (weld-worker-1) Failed to define class com.blahblah.arquilliantest.AppInitializer in Module "deployment.14ce235d-5af5-4d83-889e-e361b2012429.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link com/blahblah/arquilliantest/AppInitializer (Module "deployment.14ce235d-5af5-4d83-889e-e361b2012429.war:main" from Service Module Loader)

        at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:487) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:277) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:92) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.Module.loadModuleClass(Module.java:568) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.as.weld.WeldModuleResourceLoader.classForName(WeldModuleResourceLoader.java:68) [wildfly-weld-8.2.1.Final.jar:8.2.1.Final]

        at org.jboss.weld.bootstrap.AnnotatedTypeLoader.loadClass(AnnotatedTypeLoader.java:65) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.bootstrap.AnnotatedTypeLoader.loadAnnotatedType(AnnotatedTypeLoader.java:60) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.bootstrap.FastAnnotatedTypeLoader.loadAnnotatedType(FastAnnotatedTypeLoader.java:89) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:97) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$1.doWork(ConcurrentBeanDeployer.java:65) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$1.doWork(ConcurrentBeanDeployer.java:62) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0_60]

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_60]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_60]

        at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_60]

      Caused by: java.lang.NoClassDefFoundError: org/springframework/web/WebApplicationInitializer

        at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.8.0_60]

        at java.lang.ClassLoader.defineClass(ClassLoader.java:760) [rt.jar:1.8.0_60]

        at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:361) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:482) [jboss-modules.jar:1.3.3.Final]

        ... 21 more

      Caused by: java.lang.ClassNotFoundException: org.springframework.web.WebApplicationInitializer from [Module "deployment.14ce235d-5af5-4d83-889e-e361b2012429.war:main" from Service Module Loader]

        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final]

        ... 25 more

       

       

       

       

      13:18:05,001 INFO  [org.jboss.weld.Bootstrap] (weld-worker-1) WELD-000119: Not generating any bean definitions from com.blahblah.arquilliantest.AppInitializer because of underlying class loading error: Type org.springframework.web.WebApplicationInitializer from [Module "deployment.14ce235d-5af5-4d83-889e-e361b2012429.war:main" from Service Module Loader] not found.  If this is unexpected, enable DEBUG logging to see the full error.

      13:18:04,999 WARN  [org.jboss.modules] (weld-worker-4) Failed to define class com.blahblah.arquilliantest.SpringMvcConfig in Module "deployment.a52c8c95-1c56-4857-8f71-ceb42a62aaa8.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link com/blahblah/arquilliantest/SpringMvcConfig (Module "deployment.a52c8c95-1c56-4857-8f71-ceb42a62aaa8.war:main" from Service Module Loader)

        at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:487) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:277) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:92) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.Module.loadModuleClass(Module.java:568) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.as.weld.WeldModuleResourceLoader.classForName(WeldModuleResourceLoader.java:68) [wildfly-weld-8.2.1.Final.jar:8.2.1.Final]

        at org.jboss.weld.bootstrap.AnnotatedTypeLoader.loadClass(AnnotatedTypeLoader.java:65) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.bootstrap.AnnotatedTypeLoader.loadAnnotatedType(AnnotatedTypeLoader.java:60) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.bootstrap.FastAnnotatedTypeLoader.loadAnnotatedType(FastAnnotatedTypeLoader.java:89) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:97) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$1.doWork(ConcurrentBeanDeployer.java:65) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$1.doWork(ConcurrentBeanDeployer.java:62) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0_60]

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_60]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_60]

        at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_60]

      Caused by: java.lang.NoClassDefFoundError: org/springframework/web/servlet/config/annotation/WebMvcConfigurerAdapter

        at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.8.0_60]

        at java.lang.ClassLoader.defineClass(ClassLoader.java:760) [rt.jar:1.8.0_60]

        at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:361) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:482) [jboss-modules.jar:1.3.3.Final]

        ... 21 more

      Caused by: java.lang.ClassNotFoundException: org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter from [Module "deployment.a52c8c95-1c56-4857-8f71-ceb42a62aaa8.war:main" from Service Module Loader]

        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final]

        ... 25 more

       

       

       

       

      13:18:05,000 WARN  [org.jboss.modules] (weld-worker-2) Failed to define class com.blahblah.arquilliantest.SpringMvcConfig in Module "deployment.14ce235d-5af5-4d83-889e-e361b2012429.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link com/blahblah/arquilliantest/SpringMvcConfig (Module "deployment.14ce235d-5af5-4d83-889e-e361b2012429.war:main" from Service Module Loader)

        at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:487) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:277) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:92) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.Module.loadModuleClass(Module.java:568) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.as.weld.WeldModuleResourceLoader.classForName(WeldModuleResourceLoader.java:68) [wildfly-weld-8.2.1.Final.jar:8.2.1.Final]

        at org.jboss.weld.bootstrap.AnnotatedTypeLoader.loadClass(AnnotatedTypeLoader.java:65) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.bootstrap.AnnotatedTypeLoader.loadAnnotatedType(AnnotatedTypeLoader.java:60) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.bootstrap.FastAnnotatedTypeLoader.loadAnnotatedType(FastAnnotatedTypeLoader.java:89) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:97) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$1.doWork(ConcurrentBeanDeployer.java:65) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$1.doWork(ConcurrentBeanDeployer.java:62) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0_60]

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_60]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_60]

        at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_60]

      Caused by: java.lang.NoClassDefFoundError: org/springframework/web/servlet/config/annotation/WebMvcConfigurerAdapter

        at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.8.0_60]

        at java.lang.ClassLoader.defineClass(ClassLoader.java:760) [rt.jar:1.8.0_60]

        at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:361) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:482) [jboss-modules.jar:1.3.3.Final]

        ... 21 more

      Caused by: java.lang.ClassNotFoundException: org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter from [Module "deployment.14ce235d-5af5-4d83-889e-e361b2012429.war:main" from Service Module Loader]

        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final]

        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final]

        ... 25 more

       

      And so forth.  Is there some extra step I need to take in order for the dependencies to show up?  The test class is attached.

      Does anyone have any suggestions?

       

      Thanks

        • 1. Re: Testing Spring MVC in Wildfly managed with Arquillian
          Eric Fulton Newbie

          So when you construct a ShrinkWrap, you've got to call .addAsLibraries(<array of file[]>).  Personally I had to add spring-webmvc.  I used shrinkwrap-resolver-depchain to call something like:

          Maven

            .resolver()

            .resolve(artifact)

            .withTransitivity()

            .as(File.class), files)

           

          where the artifact was:

          org.springframework:spring-webmvc:<VERSION>

           

          I hope someone else benefits.  If you want more details PM.