Thursday, February 25, 2016

Failed to link org/wildfly/swarm/container/runtime/RuntimeServer

I got the following error running the WildFly Swarm jaxrs-cdi example:


 Exception in thread "main" java.lang.reflect.InvocationTargetException  
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)  
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
      at java.lang.reflect.Method.invoke(Method.java:498)  
      at org.wildfly.swarm.bootstrap.Main.invoke(Main.java:86)  
      at org.wildfly.swarm.bootstrap.Main.run(Main.java:50)  
      at org.wildfly.swarm.bootstrap.Main.main(Main.java:45)  
 Caused by: java.lang.NoClassDefFoundError: Failed to link org/wildfly/swarm/container/runtime/RuntimeServer (Module "org.wildfly.swarm.container:runtime" from BootModuleLoader@29ca901e for finders [BootstrapClasspathModuleFinder, BootstrapModuleFinder(org.wildfly.swarm.bootstrap:main), ClasspathModuleFinder, ApplicationModuleFinder(swarm.application:main)]): org/wildfly/swarm/container/Server  
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)  
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)  
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)  
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)  
      at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)  
      at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)  
      at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)  
      at org.jboss.modules.Module.loadModuleClass(Module.java:605)  
      at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)  
      at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)  
      at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)  
      at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)  
      at org.wildfly.swarm.container.Container.createServer(Container.java:218)  
      at org.wildfly.swarm.container.Container.<init>(Container.java:146)  
      at org.wildfly.swarm.container.Container.<init>(Container.java:124)  
      at org.wildfly.swarm.Swarm.simpleMain(Swarm.java:64)  
      at org.wildfly.swarm.Swarm.main(Swarm.java:57)  
      ... 7 more  

The fix was pretty simple: rebuild WildFly Swarm itself.  After a quick mvn clean install everything was up and running.