SmartGWT onModuleLoad() threw an exception - gwt

I'm getting the following exception, after I've added SmartGWT to an existing GWT project:
onModuleLoad() threw an exception
Exception while loading module com.smartgwt.client.SmartGwtEntryPoint. See Development Mode for details.
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:525)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Unknown Source)
Caused by: com.google.gwt.core.client.JavaScriptException: (TypeError): Unable to get value of the property 'Browser': object is null or undefined
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:248)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:289)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
at com.smartgwt.client.SmartGwtEntryPoint.init(SmartGwtEntryPoint.java)
at com.smartgwt.client.SmartGwtEntryPoint.onModuleLoad(SmartGwtEntryPoint.java:239)
... 9 more
I've added the jar file to the build path, and also added the inherits node to the *.gwt.xml. What am I missing?

I had this issue. I attempted many different fixes, but in the end it appears that there were some resources (JavaScript files and CSS files) which were not being loaded because of authentication issues (I was using Spring security and forgot to provide access to some subfolders of my web application).
There are some important processes you need to go through when troubleshooting GWT apps. They can cause issues even when there aren't really any.
Clear your Browser cache
Use the code server query string (e.g. http://127.0.0.1:8888/index.html?gwt.codesvr=127.0.0.1:9997)
GWT compile your code
It could also be an issue with Google Chrome (if that's what you're using). The guys at SmartGWT suggest you don't use Chrome for GWT development.
http://forums.smartclient.com/showthread.php?t=8159#aChrome

Related

How to debug a Gluon Application that uses Dagger in Eclipse

I'm trying do create a JavaFX application based on Gluon. Therefor I'm using Eclipse with the Gluon plugin.
I need to say that I am new to Gradle and JavaFX as well, so maybe I disgrace myself with this question, because it's too obvious.
I created a fresh project with the Gluon project wizard that I am able to compile and start via the Gradle task "run". After some toying with the project I produced an error that I would like to debug step by step with the eclipse debugger.
So, how can you debug a Gluon/Gradle application? I'm also interested where I can configure the Gradle tasks. I see the preconfigured ones in the task list, but can only execute them by doubleclick. There isn't even a context menu. One idea was that there was a debug gradle task in the list, but I couldn't find one so far.
UPDATE:
I)
I need to add that I want to use Gluon ignite with dagger and my application can't be started by the eclipse run menu, because the code generation for the dagger modules has not been performed. Debugging and launching without Dagger seems to work. So my question is bit more specific than I thought...
II)
Exception in Application start method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(Unknown Source)
at com.sun.javafx.application.LauncherImpl.launchApplication(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: Module adapter for class com.myapp.main.MyApp$DaggerModule could not be loaded. Please ensure that code generation was run for this module.
at dagger.internal.FailoverLoader$1.create(FailoverLoader.java:45)
at dagger.internal.FailoverLoader$1.create(FailoverLoader.java:40)
at dagger.internal.Memoizer.get(Memoizer.java:56)
at dagger.internal.FailoverLoader.getModuleAdapter(FailoverLoader.java:57)
at dagger.internal.Modules.loadModules(Modules.java:43)
at dagger.ObjectGraph$DaggerObjectGraph.makeGraph(ObjectGraph.java:174)
at dagger.ObjectGraph$DaggerObjectGraph.access$000(ObjectGraph.java:138)
at dagger.ObjectGraph.create(ObjectGraph.java:129)
at com.gluonhq.ignite.dagger.DaggerContext.init(DaggerContext.java:58)
at com.myapp.main.MyApp.start(MyApp.java:85)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(Unknown Source)
... 1 more
Exception running application com.myapp.main.MyApp
Thanks in advance!

gwtbootstrap3 available at compile time but not at runtime?

question is about gwtbootstap3 error that I am receiving when trying to run my GWT application. Everything mentioned here Initial Setup is being done and my code compiles and gets installed using maven. Dependency scope is provided so should I manually copy jar to application server? I am using JBoss 6.1.0 Final. If JAR file needs to be copied manually, where do I put it? Below is error that I receive,
unning GPE launcher for GWT-2.6.x version.
Runing CodeServer with parameters: [-noprecompile, -port, 9876, -bindAddress, 127.0.0.1, com.HouseKeepingGWT]
workDir: /tmp/gwt-codeserver-1867973844823357957.tmp
Loading modules
com.HouseKeepingGWT
Loading inherited module 'com.HouseKeepingGWT'
Loading inherited module 'org.gwtbootstrap3.GwtBootstrap3'
Loading inherited module 'com.HouseKeepingGWT'
[ERROR] Unable to find 'org/gwtbootstrap3/GwtBootstrap3.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
Loading inherited module 'org.gwtbootstrap3.GwtBootstrap3'
[ERROR] Unable to find 'org/gwtbootstrap3/GwtBootstrap3.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
[ERROR] Line 17: Unexpected exception while processing element 'inherits'
[ERROR] Line 17: Unexpected exception while processing element 'inherits'
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:328)
at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:328)
at com.google.gwt.dev.cfg.ModuleDefSchema$BodySchema.__inherits_begin(ModuleDefSchema.java:497)
at com.google.gwt.dev.cfg.ModuleDefSchema$BodySchema.__inherits_begin(ModuleDefSchema.java:497)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.google.gwt.dev.util.xml.HandlerMethod.invokeBegin(HandlerMethod.java:230)
at com.google.gwt.dev.util.xml.HandlerMethod.invokeBegin(HandlerMethod.java:230)
at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.startElement(ReflectiveParser.java:294)
at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.startElement(ReflectiveParser.java:294)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
Looks like, JAR is not available at run time that is why I am receiving error. Please suggest. GwtBootstrap3.gwt.xml is in gwtbootstrap3 jar.
Check this tutorial for configuring JBoss shared libs folder (or find another one on the web, it shouldn't be too hard). However, why are you using the provided scope? If this application is the only one using gwtBootstrap you can remove it so that Maven can package the jar directly inside your application's war.

eclipse hibernate tomcat error

I get this error trying to run web app on tomcat in eclipse:
SEVERE: Allocate exception for servlet Kartoteka
java.lang.ClassNotFoundException: org.hibernate.criterion.Criterion
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1149)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:827)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
It seems that there's no specific library but I have no idea which exactly. I use last hibernate version(4.1.8 final). I've tried to link all libraries from hiberante but it doesn't help. Any suggestions?
The JAR file(s) with webapp's runtime dependencies have to go in /WEB-INF/lib folder. The exception which you're facing suggests that this is not the case. So, to fix it all you have just to make sure that the JAR file(s) are been dropped in the right place.
A common beginner's mistake is that they fiddle in the Build Path property of the project in order to add runtime dependencies. That's thus wrong. It only adds compile time dependencies. You need to undo every change which you made in there in an attempt to solve this problem, or it may still collide.

Exception thrown while running JUnit tests using maven

I got the following exception while running JUnit tests in Maven.
java.lang.IllegalStateException: Native library for Attach API not available in this JRE
at mockit.internal.startup.JDK6AgentLoader.getVirtualMachineImplementationFromEmbeddedOnes(JDK6AgentLoader.java:81)
at mockit.internal.startup.JDK6AgentLoader.loadAgent(JDK6AgentLoader.java:54)
at mockit.internal.startup.AgentInitialization.initializeAccordingToJDKVersion(AgentInitialization.java:21)
at mockit.internal.startup.Startup.initializeIfNeeded(Startup.java:96)
at mockit.integration.junit4.JMockit.<clinit>(JMockit.java:23)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.apache.maven.surefire.junit4.JUnit4TestSet.<init>(JUnit4TestSet.java:45)
at org.apache.maven.surefire.junit4.JUnit4DirectoryTestSuite.createTestSet(JUnit4DirectoryTestSuite.java:56)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSets(AbstractDirectoryTestSuite.java:96)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.booter.SurefireBooter.getTestSets(SurefireBooter.java:455)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesForkPerTestSet(SurefireBooter.java:406)
at org.apache.maven.surefire.booter.SurefireBooter.run(SurefireBooter.java:249)
at org.apache.maven.plugin.surefire.SurefirePlugin.execute(SurefirePlugin.java:537)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: java.lang.UnsatisfiedLinkError: Native Library C:\Program Files\Java\jdk1.6.0_25\jre\bin\attach.dll already loaded in another classloader
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1772)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1724)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at sun.tools.attach.WindowsVirtualMachine.<clinit>(WindowsVirtualMachine.java:169)
at mockit.internal.startup.JDK6AgentLoader.getVirtualMachineImplementationFromEmbeddedOnes(JDK6AgentLoader.java:68)
... 44 more
I have used mocking in my tests.The framework used is JMockit. Any help is appreciated.
I don't know why this duplicate loading of "attach.dll" occurs (will investigate later), but you can avoid the problem by using the "-javaagent" JVM initialization parameter. See here for details.
I'll give it a try. Here it says something like:
Caused by: java.lang.UnsatisfiedLinkError: Native Library C:\Program Files\Java\jdk1.6.0_25\jre\bin\attach.dll already loaded in another classloader
My guess is that you try to load the dll twice? Once maybe it's loaded as a maven dependency and once as from the jdk?
Try adding tools.jar to your classpath. If you've downloaded a JDK, it is typically in Contents/Home/lib/tools.jar under your JDK root. If you're using Eclipse, check out this answer on another question.

Jar cannot be opened on different Computer ("Can not find main class")

Today I programmed myself a Little game, which I compiled into a jar through Eclipse - I made sure its a executable jar, or runnable jar or however you want to call it.
I've sent the jar to a friend of mine, but oddly he's not able to open it.
He's always receiving the "Can not find main class" error, which shouldn't pop up since it works perfectly for me. I've already googled but was not able to find a answer.
If you're interested, you can take a look here, if it works for you:
http://www.file-upload.net/download-3939961/WidzDeluxe.jar.html
Now the question I have is kind of obvious I guess, is the error only for him or do you all have the same problem? What's the cause of it?
If people wish, I also upload the code.
You have compiled class files bundled inside this jar with a different (higher) version of Java. Presumably it was Java 1.7 and the friend of yours is trying to open it with Java 1.6.
Here is the stacktrace I received trying to open your executable jar with Java 1.6.0_21:
Exception in thread "main" java.lang.UnsupportedClassVersionError: NewJFrame : Unsupported major.min
or version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: NewJFrame. Program will exit.
One possible solution that came to my ming would be to set the compliance level to let's say 6.0 in Java Compiler settings in Eclipse. That should to the trick.
I had this same problem, found I was compiling the program for Java 1.7. I ended up updating Java on all my computers that I was running it on and it worked great.