dlsc-software-consulting-gmbh / GMapsFX

Java API for using Google Maps within a JavaFX application.
http://rterp.github.io/GMapsFX/
Apache License 2.0
319 stars 119 forks source link

usage error #196

Open dragonsKnight5 opened 3 years ago

dragonsKnight5 commented 3 years ago

Hi, I've been trying to follow the LatLong Example but I keep hitting the following issue

java.lang.NullPointerException: Cannot invoke "com.dlsc.gmapsfx.javascript.IWebEngine.executeScript(String)" because "com.dlsc.gmapsfx.javascript.JavascriptRuntime.engine" is null

Could I get some guidance on how to rectify this, since I have no idea where to begin

below is the entire error log

java.lang.NullPointerException: Cannot invoke "com.dlsc.gmapsfx.javascript.IWebEngine.executeScript(String)" because "com.dlsc.gmapsfx.javascript.JavascriptRuntime.engine" is null at com.dlsc.gmapsfx.javascript.JavascriptRuntime.execute(JavascriptRuntime.java:63) at com.dlsc.gmapsfx.javascript.JavascriptObject.(JavascriptObject.java:75) at com.dlsc.gmapsfx.javascript.object.LatLong.(LatLong.java:36) at org.pollardcreations.light_rail_maven.MainController.(MainController.java:84) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500) at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128) at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:350) at java.base/java.lang.Class.newInstance(Class.java:645) at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:938) at javafx.fxml/javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:982) at javafx.fxml/javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:229) at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:754) at javafx.fxml/javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2808) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2634) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3323) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3280) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3249) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3222) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3199) at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:3192) at org.pollardcreations.light_rail_maven.Main.start(Main.java:29) at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428) at java.base/java.security.AccessController.doPrivileged(AccessController.java:391) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427) at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96) at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method) at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277) at java.base/java.lang.Thread.run(Thread.java:832) Exception in Application start method java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464) at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1071) Caused by: java.lang.RuntimeException: Exception in Application start method at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900) at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195) at java.base/java.lang.Thread.run(Thread.java:832) Caused by: java.lang.IllegalAccessError: superclass access check failed: class com.sun.javafx.sg.prism.web.NGWebView (in unnamed module @0x5639d625) cannot access class com.sun.javafx.sg.prism.NGGroup (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.sg.prism to unnamed module @0x5639d625 at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016) at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151) at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:825) at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:723) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:646) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:604) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) at com.dlsc.gmapsfx.GoogleMapView.lambda$new$4(GoogleMapView.java:191) at com.dlsc.gmapsfx.GoogleMapView.(GoogleMapView.java:228) at com.dlsc.gmapsfx.GoogleMapView.(GoogleMapView.java:159) at com.dlsc.gmapsfx.GoogleMapView.(GoogleMapView.java:137) at com.dlsc.gmapsfx.GoogleMapView.(GoogleMapView.java:80) at com.dlsc.gmapsfx.GoogleMapView.(GoogleMapView.java:76) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500) at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128) at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:350) at java.base/java.lang.Class.newInstance(Class.java:645) at javafx.fxml/javafx.fxml.FXMLLoader$InstanceDeclarationElement.constructValue(FXMLLoader.java:1021) at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:756) at javafx.fxml/javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2808) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2634) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3323) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3280) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3249) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3222) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3199) at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:3192) at org.pollardcreations.light_rail_maven.Main.start(Main.java:29) at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428) at java.base/java.security.AccessController.doPrivileged(AccessController.java:391) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427) at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96) at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method) at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277) ... 1 more Exception running application org.pollardcreations.light_rail_maven.Main Command execution failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404) at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166) at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:764) at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:711) at org.codehaus.mojo.exec.ExecMojo.execute (ExecMojo.java:289) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289) at org.apache.maven.cli.MavenCli.main (MavenCli.java:193) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:64) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:564) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)

BUILD FAILURE

Total time: 1.775 s Finished at: 2020-12-13T11:49:45+11:00

GeoffCapper commented 3 years ago

Are you able to get com.dlsc.gmapsfx.MainApp to run? It's been a while since I looked in here but the usual cause of issues like that was not waiting until the mapInitialised listener is called before taking action. Are you running the example as is? I admit I haven't tried it since it was changed to an FXML example, and I have no idea how that works with delayed activation.