GWT Development Mode Errors When Running (No Source Code Available) - gwt

I am trying to run a GWT application with Maven for an old legacy eclipse project that we need to make some changes to. It is using smartgwt 2.8.2 and compiling with JDK 8. When I try to run the development mode in Eclipse I am getting some errors such as:
Line 200: No source code is available for type com.smartgwt.client.types.SelectionStyle; did you forget to inherit a required module?
Line 392: No source code is available for type com.smartgwt.client.widgets.form.fields.ComboBoxItem; did you forget to inherit a required module?
Line 126: No source code is available for type com.smartgwt.client.data.DataSource; did you forget to inherit a required module?
Line 66: No source code is available for type com.smartgwt.client.widgets.tree.TreeGrid; did you forget to inherit a required module?
This goes on for a bit mostly for any classes that are needed from com.smartgwt.*
The error then ends with the following as well:
Starting HTTP on port 8888
Starting Jetty on port 8888
[ERROR] jreLeakPrevention.gcDaemonFail
java.lang.ClassNotFoundException: sun.misc.GC
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at com.google.gwt.dev.shell.jetty.JettyLauncher.jreLeakPrevention(JettyLauncher.java:899)
at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:722)
I am currently unable to run this application due to these issues in Development Mode...if anyone has any experience or is familiar with these errors due let me know. If you need any further information do ask as I am at my wits end here.
Thanks.

Related

How to address Scala error in eclipse 2019?

I am trying to do a basic scala HelloWorld in Eclipse 2019 and I am getting an error.
The following is my code and the error it is producing. Can someone please help me address this error in eclipse? Thanks
package hello
object HelloWorld {
def main(args: Array[String]): Unit = {
println("Hello, world!")
}
}
Error:
Exception in thread "main" java.lang.NoClassDefFoundError:
scala/Predef$
at HelloWorld/hello.HelloWorld$.main(HelloWorld.scala:5)
at HelloWorld/hello.HelloWorld.main(HelloWorld.scala)
Caused by: java.lang.ClassNotFoundException: scala.Predef$
at
java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 2 more
Scala library is already in source path
There are two required places to set your class-path:
Build/compilation time class-path: (i) Right-click on your project, (ii) Buildpath > Configure BuildPath, (iii) Add Library (or jar), (iv) Select the Scala Library. This one you already have as supported by your screenshot.
Run-time compilation class-path: This needs to be explicitly set in the Run-time configuration to also include the scala library: (i) Run configurations..., (ii) Classpath, (iii) Add Jar and use the scala-library jar. For this option, I have not tested whether User vs Bootstrap matters. Furthermore, I was unable to use the Add Library here, only Add jar results in a functioning run within Eclipse.
The second option is the likely cause of the error you are getting.
You need to add Scala library to your classpath.
From Eclipse:
Right-click on your project
Configure Buildpath
Add Library
Select the Scala Library

GWT compilation error, images and deferred binding

With three friends, I am developing an application with gwt (2.6). A few weeks ago, we started to use super dev mode. Everything works great, except that two of us cant use ImageBundles. It started when I wanted to include a SuggestBox, which apparently loads some images. GWT compile failed. I googled a lot, and I couldn't fix it, so I started to work on something else: Loading some images using an ImageResourceBundle. GWT compile failed. Same error. Workaround: loading images not using ImageResourceBundle. Whats really strange is: two of us are working with windows, one with ubuntu and I'm using a mac. The compile works fine with ubuntu and with one of the windows machines. On the other machines, the compilation error stays always the same no matter what we try:
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
Computing all possible rebind results for 'com.google.gwt.user.client.ui.MenuBar.Resources'
Rebinding com.google.gwt.user.client.ui.MenuBar.Resources
Invoking generator com.google.gwt.resources.rebind.context.InlineClientBundleGenerator
[ERROR] No #com.google.gwt.resources.ext.ResourceGeneratorType was specifed for type com.google.gwt.resources.client.ImageResource or its supertypes
[ERROR] Errors in 'com/google/gwt/user/client/ui/MenuBar.java'
[ERROR] Line 212: Failed to resolve 'com.google.gwt.user.client.ui.MenuBar.Resources' via deferred binding
Computing all possible rebind results for 'com.google.gwt.user.client.ui.impl.ClippedImageImpl.Template'
Rebinding com.google.gwt.user.client.ui.impl.ClippedImageImpl.Template
Invoking generator com.google.gwt.safehtml.rebind.SafeHtmlTemplatesGenerator
Constructing interface com.google.gwt.user.client.ui.impl.ClippedImageImpl.Template
Generating method body for image()
[ERROR] Required annotation #Template not present on interface method public abstract com.google.gwt.safehtml.shared.SafeHtml image(com.google.gwt.safehtml.shared.SafeUri clearImage, com.google.gwt.safecss.shared.SafeStyles style)
[ERROR] Errors in 'com/google/gwt/user/client/ui/impl/ClippedImageImpl.java'
[ERROR] Line 104: Failed to resolve 'com.google.gwt.user.client.ui.impl.ClippedImageImpl.Template' via deferred binding
Computing all possible rebind results for 'com.google.gwt.user.client.ui.impl.ClippedImageImpl.DraggableTemplate'
Rebinding com.google.gwt.user.client.ui.impl.ClippedImageImpl.DraggableTemplate
Invoking generator com.google.gwt.safehtml.rebind.SafeHtmlTemplatesGenerator
Constructing interface com.google.gwt.user.client.ui.impl.ClippedImageImpl.DraggableTemplate
Generating method body for image()
[ERROR] Required annotation #Template not present on interface method public abstract com.google.gwt.safehtml.shared.SafeHtml image(com.google.gwt.safehtml.shared.SafeUri clearImage, com.google.gwt.safecss.shared.SafeStyles style)
[ERROR] Errors in 'com/google/gwt/user/client/ui/impl/ClippedImageImpl.java'
[ERROR] Line 96: Failed to resolve 'com.google.gwt.user.client.ui.impl.ClippedImageImpl.DraggableTemplate' via deferred binding
[ERROR] Compiler returned false
I really don't know what to do. We checked nearly every setting/config-file in eclipse and tomcat. Its all the same. Has anyone an idea where to look? Maybe I'm looking in the wrong places. I appreciate any help you can give me.
Additional information (update):
When building the application with ant the gwt-compile runs without errors.
We use eclipse WITHOUT google plugins.
In dev mode the web application is started via tomcat7.
The super-dev-mode is invoked WITHIN the web application (in Servlet.init()). Therefor we had to add the gwt-dev jars into the classpath of the tomcat launcher.
Including new SuggestBox() anywhere into our gwt source code causes the gwt-compile-error on some machines. Without new SuggestBox() everything compiles everywhere.
I think it is a classpath or gwt-compile-sourcepath problem. But we see no differences on the different machines we use.
When building the application with ant the gwt-compile runs without errors.
1) So if you compare the way you compile it and the way ant compiles it you will see the root cause.
2) In case you don't see any difference or you don't know how Eclipse (or whatever you use) compiles your application try to compile it in this way (we may call it true pure dzen way without any eclipse, ant, maven or other third-party "helpers"):
java -cp gwt-dev.jar;gwt-user.jar;validation-api-1.0.0.GA.jar;validation-api-1.0.0.GA-sources.jar;any/other/lib.jar;path/to/your/module/source/code com.google.gwt.dev.Compiler moduleName
In case your .gwt.xml descriptor is located under com/your/gwt/module/MyModule.gwt.xml you should use com.your.gwt.module.MyModule as a moduleName
As you have not included any code it is hard to guess what could have gone wrong, but here are some possible reasons:
Zero-parameter constructors
This is the one that was mentioned the most in the articles I read (references included below) and seems to create exactly the issue you are having, but I have to admit that I do not know why that would happen just to some of your teammates (maybe it is just needed under certain VMs or something like that).
It might be a deferred binding issue (according to the compiler log you posted) and therefore you should check if all your POJO (plain old java object) classes have a zero-parameter constructor for deferred loading.
Failed to resolve class via deferred binding
Conflicting annotations
Maybe you have some annotations placed wrong, as mentioned here:
Deferred binding failed GWT using uibinder
Some annotations such as #UiConstructor and #UiFactory don't go well together and (even though they are not actually conflicting in this case) can cause similar problems.
References & More
Failed to create an instance of Service via deferred binding
http://www.sencha.com/forum/archive/index.php/t-170786.html?s=fb45a32ac52270e43026da25ff956840
http://samuelcheng.wordpress.com/2011/01/02/deferred-binding-failure-in-gwt/
Deferred binding failed
https://groups.google.com/forum/#!topic/google-web-toolkit/iHajUf7sjtE
If you are using Maven, you can easily do a javac with mvn compile, then you can run mvn gwt:compile. These nasty errors will go away.

Intellij will not run ScalaTests - "Incompatible Class Change Error"

I'm trying to run tests for an sbt-based Scala application in intellij. But I get the following error which I'm not sure how to fix:
Testing started at 21:07 ...
java.lang.IncompatibleClassChangeError: Found class scala.collection.mutable.ArrayOps, but interface was expected
at org.scalatest.tools.Runner$.checkArgsForValidity(Runner.scala:895)
at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:729)
at org.scalatest.tools.Runner$.run(Runner.scala:711)
at org.scalatest.tools.Runner.run(Runner.scala)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.runScalaTest2(ScalaTestRunner.java:144)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.main(ScalaTestRunner.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
When I decorate my classes with the Junit runner attribute they work fine (and it's actually a much better run in terms of the visuals):
#RunWith(classOf[JUnitRunner])
I got the same error when trying to run tests for my Play Framework app. Drilling down into the stack trace, I found that the problem class was FakeRequest, which is in the play-test library. I had two different versions of the library, one for Play 2.4 and one for 2.3. I was able to resolve this issue by removing the play-test version for Play 2.3 (open Module Settings -> Libraries -> find and delete the bad dependency).
Your issue is probably with some other problematic dependency, but following the same steps as above may help fix it.
This seems to be a problem with scala test runner framework. I had come across the same problem; eventually like you suggested end up using junit test runner to make it work. But the problem in my case was it was pulling in a transitive dependency and no such class error.
Make sure the libraries what you are using for the JUnitRunner are same. Most of the times “Incompatible Class Change Error” occurs because of backward compatibility. And also have a look at scala library jar at the time of compiling and running.

GWT emulation issue (Hibernate Validator)

I'm trying to user super-source to emulate classes GWT has no access to the source code. This ran fine first. But when I use those classes in classes that get validated by Bean Validation (JSR 303), I get an error:
[java] com.google.gwt.dev.jjs.InternalCompilerException: Unexpected error during visit.
...
...
[java] Caused by: java.lang.NoClassDefFoundError: somepath/myClass
IMHO this looks like I cannot use Emulations in 'shared' packages but only in the 'client'.
any experiences here?
TIA
ujbi
In GWT:
client package compiled to javascript.
Shared package compiles both to java byte code and javascript.
Most probably while compiling to java code no issues raise.But while compiling to java script you might thrown in to this issue.
IMHO This looks like I cannot use Emulations in
'shared' packages but only in the 'client'.
Yes unfortunately that's true.
The code in the shared package must friendly to Compiler. I.e It should emulate.

Working IntelliJ Scala Plugin Tutorial?

I'm having some trouble getting the scala plugin to work with IntelliJ IDEA 10.5.1 Community Edition on Mac OSX 10.6.8. I'm following these instructions but whenever I try to run the simple HelloWorld application, I get this error:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Didea.launcher.port=7533 -Didea.launcher.bin.path=/Applications/IntelliJ IDEA 10 CE.app/bin -Dfile.encoding=UTF-8 -classpath /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/deploy.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/dt.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/javaws.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jce.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jconsole.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/management-agent.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/plugin.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/sa-jdi.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/alt-rt.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/alt-string.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/charsets.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/classes.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/jsse.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/ui.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/apple_provider.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/dnsns.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/localedata.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunjce_provider.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunpkcs11.jar:/Users/A482930/IdeaProjects/ScalaPractice/out/production/ScalaPractice:/Users/A482930/scala/lib/scala-library.jar:/Users/A482930/scala/lib/scala-swing.jar:/Users/A482930/scala/lib/scala-dbc.jar:/Applications/IntelliJ IDEA 10 CE.app/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain HelloWorld
Exception in thread "main" java.lang.ClassNotFoundException: HelloWorld
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:113)
Process finished with exit code 1
I checked the module settings and the compiler library seems to be set up correctly. The version of scala I'm using is the 2.9.0.1 with the IzPack Installer. I've tried both the IDEA plugin listed under available plugins as well as the July 5 2011 nightly here.
Rather then helping me troubleshoot my specific issue, does anyone know of a step by step tutorial that actually works without issues for a configuration similar to mine? I'm ok with using older versions of scala and even IDEA as long as they work.
I'm not sure you still need help with this, but I just ran a simple example with Scala 2.9.0.1 and it worked. I've been having tons of issues with the plugin though, so I guess it would help to know the exact steps you followed.
In my case, I did this:
Created Project
Added Scala Facet in the Project Wizard and added the Scala libs as a global lib (there are a few issues with this, but it should work here)
Create your HelloWorld example
Create a new Scala Compilation Server Runner. Add the Classpath of your project
Run the project
A colleague of mine created this some months ago, after having some issues getting started:
https://github.com/runeflobakk/sbt-idea-scalatest
Guess it is more SBT focused, but maybe you can find some use in it anyway?