0

I've followed the latest Errai getting started guide from their website.

Basically for every single Java class I make that extends Composite (ie all Errai @Templated controller classes) throw similar to the following error when I use mvn clean gwt:run

[INFO] WARN  [org.jboss.modules] Failed to define class com.justinvesting.client.local.pages.NamePage in Module "deployment.errai-test.war:main" from Service Module
Loader: java.lang.LinkageError: Failed to link com/justinvesting/client/local/pages/NamePage (Module "deployment.errai-test.war:main" from Service Module Loader)
[INFO]  at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:487) [jboss-modules-1.3.3.Final.jar:1.3.3.Final]
[INFO]  at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:277) [jboss-modules-1.3.3.Final.jar:1.3.3.Final]
[INFO]  at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:92) [jboss-modules-1.3.3.Final.jar:1.3.3.Final]
[INFO]  at org.jboss.modules.Module.loadModuleClass(Module.java:568) [jboss-modules-1.3.3.Final.jar:1.3.3.Final]
[INFO]  at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205) [jboss-modules-1.3.3.Final.jar:1.3.3.Final]
[INFO]  at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules-1.3.3.Final.jar:1.3.3.Final]
[INFO]  at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules-1.3.3.Final.jar:1.3.3.Final]
[INFO]  at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules-1.3.3.Final.jar:1.3.3.Final]
[INFO]  at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules-1.3.3.Final.jar:1.3.3.Final]
[INFO]  at org.jboss.as.weld.WeldModuleResourceLoader.classForName(WeldModuleResourceLoader.java:68) [wildfly-weld-8.1.0.Final.jar:8.1.0.Final]
[INFO]  at org.jboss.weld.bootstrap.BeanDeployer.loadClass(BeanDeployer.java:106) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
[INFO]  at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:94) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
[INFO]  at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$1.doWork(ConcurrentBeanDeployer.java:62) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
[INFO]  at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$1.doWork(ConcurrentBeanDeployer.java:60) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
[INFO]  at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
[INFO]  at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
[INFO]  at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0_60]
[INFO]  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_60]
[INFO]  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_60]
[INFO]  at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_60]
[INFO] Caused by: java.lang.NoClassDefFoundError: com/google/gwt/user/client/ui/Composite
[INFO]  at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.8.0_60]
[INFO]  at java.lang.ClassLoader.defineClass(ClassLoader.java:760) [rt.jar:1.8.0_60]
[INFO]  at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:361) [jboss-modules-1.3.3.Final.jar:1.3.3.Final]
[INFO]  at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:482) [jboss-modules-1.3.3.Final.jar:1.3.3.Final]
[INFO]  ... 19 more
[INFO] Caused by: java.lang.ClassNotFoundException: com.google.gwt.user.client.ui.Composite from [Module "deployment.errai-test.war:main" from Service Module Loader

However, this doesn't appear to actually stop the application compiling and running. I can still successfully get to my Errai GWT app once it finishes. But the more classes I create, the longer this stacktrace gets!

Any ideas?

Nick Foote
  • 2,425
  • 9
  • 36
  • 47

2 Answers2

0

This error means that a required jar is on a build path but not available at runtime. Make sure it is included in WEB-INF/lib folder before you deploy your app.

Andrei Volgin
  • 40,755
  • 6
  • 49
  • 58
  • I realise thats what a classnotfoundexception means, but in context of GWT and Errai what and where exactly am I missing? As I mentoned, the app still runs up in GWT's dev mode fine and I can use the webapp perfectly fine. These compile time errors don't appear to make any difference ... yet! – Nick Foote Oct 30 '15 at 12:20
  • There is another possibility - you have two copies of this class, for example, because you have two versions of the same jar. Check your WEB-INF/lib folder to make sure you included all jars, but only one copy of each. If you use Eclipse, it can actually give you a warning in Problems tab that a resource is not available at run-time. – Andrei Volgin Oct 30 '15 at 19:57
0

You should have gwt-server.jar in your runtime classpath. Composite class is present in gwt-servlet.jar.

Mohit
  • 1,740
  • 1
  • 15
  • 19
  • Do you have any further info in the context of Errai? As I mention above, the app still runs fine and the webapp is totally usable, it just logs these errors as the GWT dev mode thing is starting up. Frustratingly I've followed the Errai getting started guide so I don't know what is wrong. Equally I've cloned a couple of Errai's demo projects and they don't suffer this issue when running up, but I can't see any likely differences in any pom or config files anywhere! :( – Nick Foote Oct 30 '15 at 12:22
  • Can you post your project pom and gwt xml files? – Mohit Oct 30 '15 at 12:45
  • In the pom.xml of ErraiTest, gwt-user library is added with 'provided' scope. It means this library won't be packaged into the WEB-INF/lib. Either this library should be present on classpath externally, or you should change remove the scope 'provided' from your pom so that it is included in WEB-INF/lib. – Mohit Nov 03 '15 at 04:14
  • Ah awesome, that resolves that issue! I'll mark this as the right answer so you get the credit. Unfortunately the build still complains about missing HasModel but its far less annoying than the Component one that appeared for every single component. – Nick Foote Nov 03 '15 at 17:55