Error building native image with gluonfx-maven-plugin 1.0.14 - java

I'm trying to build a native image using:
GraalVM: 22.2.0
GluonFx maven Plugin: 1.0.14
And I get the following error:
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] [1/7] Initializing... (0.0s # 0.42GB)
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] Fatal error: java.lang.IllegalAccessError: class com.oracle.svm.core.genscavenge.graal.HeapFeature (in unnamed module #0x499d741f) cannot access class com.oracle.svm.core.SubstrateOptions (in module org.graalvm.nativeimage.builder) because module org.graalvm.nativeimage.builder does not export com.oracle.svm.core to unnamed module #0x499d741f
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] at com.oracle.svm.core.genscavenge.graal.HeapFeature.isInConfiguration(HeapFeature.java:65)
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.registerFeature(FeatureHandler.java:183)
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.registerFeatures(FeatureHandler.java:128)
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:838)
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:561)
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:521)
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:407)
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:585)
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] ------------------------------------------------------------------------------------------------------------------------
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] 1.7s (8.7% of total time) in 17 GCs | Peak RSS: 1.48GB | CPU load: 2.23
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] ========================================================================================================================
Thanks in advance for any help you can provide me
Updated:
By the suggestion of #peterz I've downgraded the version of GraalVM, now running with 22.1.0, and the error is different:
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB]
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] [1/7] Initializing... (0.0s # 0.56GB)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] Error: ImageSingletons.add must not overwrite existing key com.oracle.svm.core.jdk.ProtectionDomainSupport
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] Existing value: com.oracle.svm.core.jdk.ProtectionDomainSupport#1ff463bb
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] New value: com.oracle.svm.core.jdk.ProtectionDomainSupport#3b9c9b8b
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] com.oracle.svm.core.util.UserError$UserException: ImageSingletons.add must not overwrite existing key com.oracle.svm.core.jdk.ProtectionDomainSupport
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] Existing value: com.oracle.svm.core.jdk.ProtectionDomainSupport#1ff463bb
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] New value: com.oracle.svm.core.jdk.ProtectionDomainSupport#3b9c9b8b
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.core.util.UserError.abort(UserError.java:72)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.hosted.ImageSingletonsSupportImpl$HostedManagement.doAdd(ImageSingletonsSupportImpl.java:109)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.hosted.ImageSingletonsSupportImpl.add(ImageSingletonsSupportImpl.java:39)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at org.graalvm.sdk/org.graalvm.nativeimage.ImageSingletons.add(ImageSingletons.java:73)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.hosted.ProtectionDomainFeature.afterRegistration(ProtectionDomainFeature.java:48)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGenerator.lambda$setupNativeImage$14(NativeImageGenerator.java:832)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:74)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:832)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:555)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:515)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:407)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:585)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:615)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] ------------------------------------------------------------------------------------------------------------------------
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] 1.7s (9.6% of total time) in 16 GCs | Peak RSS: 1.39GB | CPU load: 3.91
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] ========================================================================================================================

Related

Error while building APK using GluonFX 1.0.16

Our app was already using GluonFX 1.0.12. And we were able to build APK (with OpenJDK 11).
I've updated the GluonFX to 1.0.16 now. I am able to run the app. And running the app through mvn gluonfx:runagent goal is also working fine. But building using mvn gluonfx:build gluonfx:package -Pandroid results in error.
So I generated a sample project from start.gluon.io and tried to build APK with same configuration, and it also failed returing same error, as shown below.
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] [1/7] Initializing... (0.0s # 0.13GB)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] Fatal error: java.lang.UnsupportedClassVersionError: javafx/application/Application has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.lang.ClassLoader.defineClass1(Native Method)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:555)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.security.AccessController.doPrivileged(Native Method)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.lang.ClassLoader.defineClass1(Native Method)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:555)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.security.AccessController.doPrivileged(Native Method)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.lang.Class.forName0(Native Method)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.lang.Class.forName(Class.java:398)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at com.oracle.svm.hosted.ImageClassLoader.forName(ImageClassLoader.java:291)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at com.oracle.svm.hosted.ImageClassLoader.forName(ImageClassLoader.java:287)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at com.oracle.svm.hosted.ImageClassLoader.forName(ImageClassLoader.java:296)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:343)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:585)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:615)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] Error: Image build request failed with exit status 1
[Wed Dec 28 15:02:03 IST 2022][FINE] Result for compile: 1
[Wed Dec 28 15:02:03 IST 2022][SEVERE] Process compile failed with result: 1
Check the log files under /home/manikandan/git/hellojavafx/target/gluonfx/aarch64-android/gvm/log
And please check https://docs.gluonhq.com/ for more information.
[Wed Dec 28 15:02:03 IST 2022][INFO] Logging process [compile] to file: /home/manikandan/git/hellojavafx/target/gluonfx/log/process-compile-1672219923249.log
[Wed Dec 28 15:02:03 IST 2022][SEVERE] Compiling failed.
Check the log files under /home/manikandan/git/hellojavafx/target/gluonfx/aarch64-android/gvm/log
And please check https://docs.gluonhq.com/ for more information.
Complete log can be found here
Here's the pom.xml file.
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.manikandan</groupId>
<artifactId>myapplication</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>HelloJavafx</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>11</maven.compiler.release>
<javafx.version>19</javafx.version>
<javafx.plugin.version>0.0.8</javafx.plugin.version>
<gluonfx.plugin.version>1.0.16</gluonfx.plugin.version>
<main.class>com.manikandan.sample.Main</main.class>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-base</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${javafx.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>${javafx.plugin.version}</version>
<configuration>
<mainClass>${main.class}</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>gluonfx-maven-plugin</artifactId>
<version>${gluonfx.plugin.version}</version>
<configuration>
<target>${gluonfx.target}</target>
<mainClass>${main.class}</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>android</id>
<properties>
<gluonfx.target>android</gluonfx.target>
</properties>
</profile>
<profile>
<id>ios</id>
<properties>
<gluonfx.target>ios</gluonfx.target>
</properties>
</profile>
</profiles>
</project>
I am using OpenJDK 11.0,14.
manikandan#manikandan-VirtualBox:~/git/hellojavafx$ java -version
openjdk version "11.0.14.1" 2022-02-08
OpenJDK Runtime Environment (build 11.0.14.1+1-Ubuntu-0ubuntu1.20.04)
OpenJDK 64-Bit Server VM (build 11.0.14.1+1-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)
And I am using graalvm-svm-java11-linux-gluon-22.1.0.1-Final.
manikandan#manikandan-VirtualBox:~/git/hellojavafx$ echo $GRAALVM_HOME
/media/sf_linux_softwares/graalvm-svm-java11-linux-gluon-22.1.0.1-Final
Please let me know what is the cause of this error?
Update 1:-
As suggested, I've added javafxStaticSdkVersion-19 to gluonfx configuration.
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>gluonfx-maven-plugin</artifactId>
<version>${gluonfx.plugin.version}</version>
<configuration>
<target>${gluonfx.target}</target>
<mainClass>${main.class}</mainClass>
<javafxStaticSdkVersion>19</javafxStaticSdkVersion>
</configuration>
</plugin>
But now the build fails at linking stage.
[Thu Dec 29 11:13:04 IST 2022][INFO] ==================== LINK TASK ====================
[Thu Dec 29 11:13:07 IST 2022][INFO] [SUB] /media/sf_linux_softwares/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: unrecognized option '--rosegment'
[Thu Dec 29 11:13:07 IST 2022][INFO] [SUB] /media/sf_linux_softwares/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: use the --help option for usage information
[Thu Dec 29 11:13:07 IST 2022][INFO] [SUB] clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[Thu Dec 29 11:13:07 IST 2022][SEVERE] Process link failed with result: 1
Check the log files under /home/manikandan/git/hellojavafx/target/gluonfx/aarch64-android/gvm/log
And please check https://docs.gluonhq.com/ for more information.
[Thu Dec 29 11:13:07 IST 2022][INFO] Logging process [link] to file: /home/manikandan/git/hellojavafx/target/gluonfx/log/process-link-1672292587129.log
[Thu Dec 29 11:13:07 IST 2022][SEVERE] Linking failed.
Check the log files under /home/manikandan/git/hellojavafx/target/gluonfx/aarch64-android/gvm/log
And please check https://docs.gluonhq.com/ for more information.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 06:35 min
[INFO] Finished at: 2022-12-29T11:13:07+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.gluonhq:gluonfx-maven-plugin:1.0.16:link (default-cli) on project myapplication: Linking failed -> [Help 1]
I am using android-ndk-r21b. Does gluonfx 1.0.16 require latest version of ndk ?
Update2:-
I let the plugin download the SDK, and I separately downloaded NDK r25b and updated PATH of 'ANDROID_NDK'
Now the build fails with "error: 127, clang not found" (shown below)
[Fri Dec 30 16:46:09 IST 2022][INFO] ==================== COMPILE TASK ====================
[Fri Dec 30 16:46:11 IST 2022][INFO] We will now compile your code for aarch64-linux-android. This may take some time.
[Fri Dec 30 16:46:11 IST 2022][FINE] Extracting native libs to: /home/manikandan/git/hellojavafx/target/gluonfx/aarch64-android/gvm/lib
[Fri Dec 30 16:46:11 IST 2022][FINE] Looking for resource: /native/android/c/dummy.c
[Fri Dec 30 16:46:11 IST 2022][FINE] Looking for resource: /native/android/c/launcher.c
[Fri Dec 30 16:46:11 IST 2022][FINE] Looking for resource: /native/android/c/javafx_adapter.c
[Fri Dec 30 16:46:11 IST 2022][FINE] Looking for resource: /native/android/c/touch_events.c
[Fri Dec 30 16:46:11 IST 2022][FINE] Looking for resource: /native/android/c/glibc_shim.c
[Fri Dec 30 16:46:11 IST 2022][FINE] Looking for resource: /native/android/c/attach_adapter.c
[Fri Dec 30 16:46:11 IST 2022][FINE] Looking for resource: /native/android/c/logger.c
[Fri Dec 30 16:46:11 IST 2022][FINE] Looking for resource: /native/android/c/grandroid.h
[Fri Dec 30 16:46:11 IST 2022][FINE] Looking for resource: /native/android/c/grandroid_ext.h
[Fri Dec 30 16:46:11 IST 2022][FINE] PB Command for compile-additional-sources: /media/sf_linux_softwares/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -c -DSUBSTRATE -target aarch64-linux-android -I. -fPIC -I/home/manikandan/git/hellojavafx/target/gluonfx/aarch64-android/gvm/HelloJavafx dummy.c launcher.c javafx_adapter.c touch_events.c glibc_shim.c attach_adapter.c logger.c
[Fri Dec 30 16:46:11 IST 2022][FINE] Start process compile-additional-sources...
[Fri Dec 30 16:46:11 IST 2022][FINE] [SUB] /media/sf_linux_softwares/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang: 1: clang-14: not found
[Fri Dec 30 16:46:11 IST 2022][FINE] Result for compile-additional-sources: 127
[Fri Dec 30 16:46:11 IST 2022][SEVERE] Process compile-additional-sources failed with result: 127
Check the log files under /home/manikandan/git/hellojavafx/target/gluonfx/aarch64-android/gvm/log
And please check https://docs.gluonhq.com/ for more information.
[Fri Dec 30 16:46:11 IST 2022][INFO] Logging process [compile-additional-sources] to file: /home/manikandan/git/hellojavafx/target/gluonfx/log/process-compile-additional-sources-1672398971174.log
[Fri Dec 30 16:46:11 IST 2022][SEVERE] Compiling failed.
Check the log files under /home/manikandan/git/hellojavafx/target/gluonfx/aarch64-android/gvm/log
And please check https://docs.gluonhq.com/ for more information.
But I checked the directory specified in error log, and clang-14 is there.
How to handle this error ?

GraalVM Library is not linking in linux mint

I have built a native image application using (GraalVM 22.1.0) in Mac OS environment and it worked, but when trying to build the same application on linux the gluonfx:links fails, with an error of
undefined reference to Java_com_sun_security_auth_module_UnixSystem_getUnixInfo
undefined reference to JNI_OnLoad_jaas
I thought the problem was the libjaas.a not linking as it was not presented in the log file, so i added <arg>-ljaas</arg> but gave me another error which was /usr/bin/ld: cannot find -ljaas
Here is the POM file:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>5.8.1</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>17.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>17.0.1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>2.1.214</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>gluonfx-maven-plugin</artifactId>
<version>1.0.15</version>
<configuration>
<mainClass>com.example.demo4.Driver</mainClass>
<linkerArgs>
<arg>-ljaas</arg>
</linkerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<executions>
<execution>
<!-- Default configuration for running with: mvn clean javafx:run -->
<id>default-cli</id>
<configuration>
<mainClass>com.example.demo4/com.example.demo4.HelloApplication</mainClass>
<launcher>app</launcher>
<jlinkZipName>app</jlinkZipName>
<jlinkImageName>app</jlinkImageName>
<noManPages>true</noManPages>
<stripDebug>true</stripDebug>
<noHeaderFiles>true</noHeaderFiles>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Main Class:
package com.example.demo4;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.stage.Stage;
import java.sql.*;
public class Driver extends Application {
#Override
public void start(Stage stage) throws Exception {
Class.forName("org.h2.Driver");
Connection connection =DriverManager.getConnection("","","");
String str = connection.toString();
connection.close();
Scene scene = new Scene(new Label(str),500,500);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Error gluonfx:link
[Mon Sep 05 11:37:26 EEST 2022][INFO] We will now compile your code for x86_64-linux-linux. This may take some time.
[Mon Sep 05 11:37:27 EEST 2022][INFO] [SUB] Warning: Ignoring server-mode native-image argument --no-server.
[Mon Sep 05 11:37:29 EEST 2022][INFO] [SUB] ========================================================================================================================
[Mon Sep 05 11:37:29 EEST 2022][INFO] [SUB] GraalVM Native Image: Generating 'com.example.demo4.driver' (shared library)...
[Mon Sep 05 11:37:29 EEST 2022][INFO] [SUB] ========================================================================================================================
[Mon Sep 05 11:37:29 EEST 2022][INFO] [SUB] [GluonFeature] enabled for config com.oracle.svm.hosted.FeatureImpl$IsInConfigurationAccessImpl#7cc586a8
[Mon Sep 05 11:37:30 EEST 2022][INFO] [SUB] GluonFeature enabled in setup com.oracle.svm.hosted.FeatureImpl$DuringSetupAccessImpl#65f58c6e
[Mon Sep 05 11:37:31 EEST 2022][INFO] [SUB] [1/7] Initializing... (3.7s # 0.20GB)
[Mon Sep 05 11:37:31 EEST 2022][INFO] [SUB] Version info: 'GraalVM 22.1.0 Java 17 CE'
[Mon Sep 05 11:37:31 EEST 2022][INFO] [SUB] C compiler: gcc (linux, x86_64, 9.3.0)
[Mon Sep 05 11:37:31 EEST 2022][INFO] [SUB] Garbage collector: Serial GC
[Mon Sep 05 11:37:31 EEST 2022][INFO] [SUB] 1 user-provided feature(s)
[Mon Sep 05 11:37:31 EEST 2022][INFO] [SUB] - com.gluonhq.substrate.feature.GluonFeature
[Mon Sep 05 11:38:17 EEST 2022][INFO] [SUB] [2/7] Performing analysis... [***********] (45.6s # 3.08GB)
[Mon Sep 05 11:38:17 EEST 2022][INFO] [SUB] 13,299 (91.34%) of 14,560 classes reachable
[Mon Sep 05 11:38:17 EEST 2022][INFO] [SUB] 25,151 (67.63%) of 37,189 fields reachable
[Mon Sep 05 11:38:17 EEST 2022][INFO] [SUB] 70,391 (66.36%) of 106,070 methods reachable
[Mon Sep 05 11:38:17 EEST 2022][INFO] [SUB] 663 classes, 185 fields, and 2,147 methods registered for reflection
[Mon Sep 05 11:38:17 EEST 2022][INFO] [SUB] 114 classes, 144 fields, and 182 methods registered for JNI access
[Mon Sep 05 11:38:20 EEST 2022][INFO] [SUB] [3/7] Building universe... (3.2s # 2.60GB)
[Mon Sep 05 11:38:23 EEST 2022][INFO] [SUB] [4/7] Parsing methods... [**] (3.0s # 3.00GB)
[Mon Sep 05 11:38:30 EEST 2022][INFO] [SUB] [5/7] Inlining methods... [****] (6.2s # 2.27GB)
[Mon Sep 05 11:39:03 EEST 2022][INFO] [SUB] [6/7] Compiling methods... [******] (32.8s # 3.51GB)
[Mon Sep 05 11:39:11 EEST 2022][INFO] [SUB]
[Mon Sep 05 11:39:11 EEST 2022][INFO] [SUB] ------------------------------------------------------------------------------------------------------------------------
[Mon Sep 05 11:39:11 EEST 2022][INFO] [SUB] 10.0s (9.6% of total time) in 59 GCs | Peak RSS: 5.27GB | CPU load: 6.42
[Mon Sep 05 11:39:11 EEST 2022][INFO] [SUB] ------------------------------------------------------------------------------------------------------------------------
[Mon Sep 05 11:39:11 EEST 2022][INFO] [SUB] Produced artifacts:
[Mon Sep 05 11:39:11 EEST 2022][INFO] [SUB] /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/demo4/graal_isolate.h (header)
[Mon Sep 05 11:39:11 EEST 2022][INFO] [SUB] /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/demo4/com.example.demo4.driver.h (header)
[Mon Sep 05 11:39:11 EEST 2022][INFO] [SUB] /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/demo4/graal_isolate_dynamic.h (header)
[Mon Sep 05 11:39:11 EEST 2022][INFO] [SUB] /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/demo4/com.example.demo4.driver_dynamic.h (header)
[Mon Sep 05 11:39:11 EEST 2022][INFO] [SUB] /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/demo4/com.example.demo4.driver.build_artifacts.txt
[Mon Sep 05 11:39:11 EEST 2022][INFO] [SUB] ========================================================================================================================
[Mon Sep 05 11:39:11 EEST 2022][INFO] [SUB] Finished generating 'com.example.demo4.driver' in 1m 43s.
[INFO]
[INFO] --- gluonfx-maven-plugin:1.0.15:link (default-cli) # demo4 ---
[Mon Sep 05 11:39:12 EEST 2022][INFO] Substrate is tested with the Gluon's GraalVM build which you can find at https://github.com/gluonhq/graal/releases.
While you can still use other GraalVM builds, there is no guarantee that these will work properly with Substrate
[Mon Sep 05 11:39:12 EEST 2022][INFO] ==================== LINK TASK ====================
[Mon Sep 05 11:39:13 EEST 2022][INFO] [SUB] /usr/bin/ld: /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/tmp/SVM-1662367049997/com.example.demo4.driver.o:(.data+0x6d8): undefined reference to `JNI_OnLoad_jaas'
[Mon Sep 05 11:39:13 EEST 2022][INFO] [SUB] /usr/bin/ld: /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/tmp/SVM-1662367049997/com.example.demo4.driver.o:(.data+0x1050): undefined reference to `Java_com_sun_security_auth_module_UnixSystem_getUnixInfo'
[Mon Sep 05 11:39:13 EEST 2022][INFO] [SUB] collect2: error: ld returned 1 exit status
[Mon Sep 05 11:39:13 EEST 2022][SEVERE] Process link failed with result: 1
Check the log files under /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/log
And please check https://docs.gluonhq.com/ for more information.
[Mon Sep 05 11:39:13 EEST 2022][INFO] Logging process [link] to file: /home/yousef66/Desktop/demo4/target/gluonfx/log/process-link-1662367153279.log
[Mon Sep 05 11:39:13 EEST 2022][SEVERE] Linking failed.
Check the log files under /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/log
And please check https://docs.gluonhq.com/ for more information.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:49 min
[INFO] Finished at: 2022-09-05T11:39:13+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.gluonhq:gluonfx-maven-plugin:1.0.15:link (default-cli) on project demo4: Linking failed -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:50 min
[INFO] Finished at: 2022-09-05T11:39:13+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.gluonhq:gluonfx-maven-plugin:1.0.15:build (default-cli) on project demo4: Error, gluonfx:build failed -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Log file
[Mon Sep 05 12:46:34 EEST 2022][INFO] ==================== LINK TASK ====================
[Mon Sep 05 12:46:34 EEST 2022][FINE] Looking for resource: /native/linux/launcher.c
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for compile-additional-sources: gcc -c -DSUBSTRATE -I/home/yousef66/Desktop/graalvm-ce-java17-22.1.0/include -I/home/yousef66/Desktop/graalvm-ce-java17-22.1.0/include/linux -DGVM_17 -I/home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/demo4 launcher.c
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process compile-additional-sources...
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for compile-additional-sources: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for libavcodec: /usr/bin/pkg-config --libs libavcodec
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for libavcodec...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lavcodec
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for libavcodec: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg libavcodec provided flags: [-lavcodec]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for libavformat: /usr/bin/pkg-config --libs libavformat
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for libavformat...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lavformat
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for libavformat: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg libavformat provided flags: [-lavformat]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for libavutil: /usr/bin/pkg-config --libs libavutil
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for libavutil...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lavutil
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for libavutil: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg libavutil provided flags: [-lavutil]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for alsa: /usr/bin/pkg-config --libs alsa
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for alsa...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lasound
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for alsa: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg alsa provided flags: [-lasound]
[Mon Sep 05 12:46:34 EEST 2022][FINE] All flags: [-lgstreamer-lite, -lavcodec, -lavformat, -lavutil, -lasound]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for gl: /usr/bin/pkg-config --libs gl
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for gl...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lGL
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for gl: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg gl provided flags: [-lGL]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for x11: /usr/bin/pkg-config --libs x11
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for x11...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lX11
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for x11: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg x11 provided flags: [-lX11]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for gtk+-x11-3.0: /usr/bin/pkg-config --libs gtk+-x11-3.0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for gtk+-x11-3.0...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for gtk+-x11-3.0: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg gtk+-x11-3.0 provided flags: [-lgtk-3, -lgdk-3, -lpangocairo-1.0, -lpango-1.0, -lharfbuzz, -latk-1.0, -lcairo-gobject, -lcairo, -lgdk_pixbuf-2.0, -lgio-2.0, -lgobject-2.0, -lglib-2.0]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for freetype2: /usr/bin/pkg-config --libs freetype2
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for freetype2...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lfreetype
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for freetype2: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg freetype2 provided flags: [-lfreetype]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for pangoft2: /usr/bin/pkg-config --libs pangoft2
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for pangoft2...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lfontconfig -lfreetype
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for pangoft2: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg pangoft2 provided flags: [-lpangoft2-1.0, -lpango-1.0, -lgobject-2.0, -lglib-2.0, -lharfbuzz, -lfontconfig, -lfreetype]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for gthread-2.0: /usr/bin/pkg-config --libs gthread-2.0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for gthread-2.0...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lgthread-2.0 -pthread -lglib-2.0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for gthread-2.0: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg gthread-2.0 provided flags: [-lgthread-2.0, -pthread, -lglib-2.0]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for zlib: /usr/bin/pkg-config --libs zlib
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for zlib...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lz
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for zlib: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg zlib provided flags: [-lz]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for xtst: /usr/bin/pkg-config --libs xtst
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for xtst...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lXtst
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for xtst: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg xtst provided flags: [-lXtst]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for gmodule-no-export-2.0: /usr/bin/pkg-config --libs gmodule-no-export-2.0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for gmodule-no-export-2.0...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lgmodule-2.0 -pthread -lglib-2.0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for gmodule-no-export-2.0: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg gmodule-no-export-2.0 provided flags: [-lgmodule-2.0, -pthread, -lglib-2.0]
[Mon Sep 05 12:46:34 EEST 2022][FINE] All flags: [-Wl,--no-whole-archive, -lGL, -lX11, -lgtk-3, -lgdk-3, -lpangocairo-1.0, -lpango-1.0, -lharfbuzz, -latk-1.0, -lcairo-gobject, -lcairo, -lgdk_pixbuf-2.0, -lgio-2.0, -lgobject-2.0, -lglib-2.0, -lfreetype, -lpangoft2-1.0, -lpango-1.0, -lgobject-2.0, -lglib-2.0, -lharfbuzz, -lfontconfig, -lfreetype, -lgthread-2.0, -pthread, -lglib-2.0, -lstdc++, -lz, -lXtst, -lm, -lgmodule-2.0, -pthread, -lglib-2.0]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for link: gcc /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/demo4/launcher.o /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/tmp/SVM-1662371091887/com.example.demo4.driver.o /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/libjava.a /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/libnio.a /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/libzip.a /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/libnet.a /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/libprefs.a /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/libj2pkcs11.a /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/libextnet.a /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/libfdlibm.a /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/libfontmanager.a /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/libjavajpeg.a /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/liblcms.a /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/libawt_headless.a /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/libawt.a -l:libjvm.a -l:liblibchelper.a -lz -ldl -lstdc++ -lpthread -Wl,--wrap=pow -rdynamic -lprism_es2 -lglass -lglassgtk3 -ljavafx_font -ljavafx_font_freetype -ljavafx_font_pango -ljavafx_iio -lgstreamer-lite -lavcodec -lavformat -lavutil -lasound -Wl,--no-whole-archive -lGL -lX11 -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lfreetype -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lfontconfig -lfreetype -lgthread-2.0 -pthread -lglib-2.0 -lstdc++ -lz -lXtst -lm -lgmodule-2.0 -pthread -lglib-2.0 -lm -ldl -o /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/demo4 -L/home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/svm/clibraries/linux-amd64 -L/home/yousef66/.gluon/substrate/javafxStaticSdk/19-ea+8/linux-x86_64/sdk/lib -ljaas
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process link...
[Mon Sep 05 12:46:34 EEST 2022][INFO] [SUB] /usr/bin/ld: cannot find -ljaas
[Mon Sep 05 12:46:34 EEST 2022][INFO] [SUB] collect2: error: ld returned 1 exit status
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for link: 1
[Mon Sep 05 12:46:34 EEST 2022][SEVERE] Process link failed with result: 1
Check the log files under /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/log
And please check https://docs.gluonhq.com/ for more information.
[Mon Sep 05 12:46:34 EEST 2022][INFO] Logging process [link] to file: /home/yousef66/Desktop/demo4/target/gluonfx/log/process-link-1662371194695.log
[Mon Sep 05 12:46:34 EEST 2022][SEVERE] Linking failed.
Check the log files under /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/log
And please check https://docs.gluonhq.com/ for more information.

JavaFX when I do client:run Caused by: com.oracle.svm.core.jdk.UnsupportedFeatureError: Unsupported method of Unsafe

I am facing a problem at Run time. it's a JavaFX application.
facing this issue for 3 days now. I tried to figure it out myself. but I didn't found a solution. so that's why I'm posting the question.
The Problem is I run to try to get firestore object it's giving me the below exception.
it's works fine on javafx:run it's only giving on client:run after deploy.
here is the code.
try {
FirebaseOptions options = new FirebaseOptions.Builder()
.setCredentials(GoogleCredentials.fromStream(Singleton.getInstance().getAbsolutePath("service/credentials.json")))
.build();
FirebaseApp.initializeApp(options);
this.firestore = FirestoreClient.getFirestore();
} catch (IOException e) {
System.out.println("Failed to connect the firebase.");
e.printStackTrace();
}
and here is the error I'm facing.
Exception in Application start method
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at java.lang.Thread.run(Thread.java:834)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:519)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.windows.WindowsJavaThreads.osThreadStartRoutine(WindowsJavaThreads.java:138)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] Caused by: com.oracle.svm.core.jdk.UnsupportedFeatureError: Unsupported method of Unsafe
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:87)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at jdk.internal.misc.Unsafe.staticFieldOffset(Unsafe.java:231)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at sun.misc.Unsafe.staticFieldOffset(Unsafe.java:662)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0$5.run(PlatformDependent0.java:282)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at java.security.AccessController.doPrivileged(AccessController.java:84)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0.<clinit>(PlatformDependent0.java:267)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:375)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:295)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent.isAndroid(PlatformDependent.java:289)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent.<clinit>(PlatformDependent.java:92)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:375)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:295)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.netty.shaded.io.netty.util.AsciiString.<init>(AsciiString.java:223)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.netty.shaded.io.netty.util.AsciiString.<init>(AsciiString.java:210)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.netty.shaded.io.netty.util.AsciiString.cached(AsciiString.java:1401)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.netty.shaded.io.netty.util.AsciiString.<clinit>(AsciiString.java:48)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:375)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:295)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.netty.shaded.io.grpc.netty.Utils.<clinit>(Utils.java:72)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:375)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:295)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder.<clinit>(NettyChannelBuilder.java:74)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:375)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:295)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.netty.shaded.io.grpc.netty.NettyChannelProvider.builderForAddress(NettyChannelProvider.java:37)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.netty.shaded.io.grpc.netty.NettyChannelProvider.builderForAddress(NettyChannelProvider.java:23)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.ManagedChannelBuilder.forAddress(ManagedChannelBuilder.java:39)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createSingleChannel(InstantiatingGrpcChannelProvider.java:280)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.access$1600(InstantiatingGrpcChannelProvider.java:71)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider$1.createSingleChannel(InstantiatingGrpcChannelProvider.java:210)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.api.gax.grpc.ChannelPool.create(ChannelPool.java:72)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createChannel(InstantiatingGrpcChannelProvider.java:217)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.getTransportChannel(InstantiatingGrpcChannelProvider.java:200)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:156)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:123)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.cloud.firestore.spi.v1.GrpcFirestoreRpc.<init>(GrpcFirestoreRpc.java:122)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreRpcFactory.create(FirestoreOptions.java:90)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreRpcFactory.create(FirestoreOptions.java:82)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.cloud.ServiceOptions.getRpc(ServiceOptions.java:561)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.cloud.firestore.FirestoreOptions.getFirestoreRpc(FirestoreOptions.java:385)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.cloud.firestore.FirestoreImpl.<init>(FirestoreImpl.java:67)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreFactory.create(FirestoreOptions.java:73)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreFactory.create(FirestoreOptions.java:66)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.cloud.ServiceOptions.getService(ServiceOptions.java:541)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.firebase.cloud.FirestoreClient.<init>(FirestoreClient.java:45)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.firebase.cloud.FirestoreClient.<init>(FirestoreClient.java:29)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.firebase.cloud.FirestoreClient$FirestoreClientService.<init>(FirestoreClient.java:95)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.firebase.cloud.FirestoreClient.getInstance(FirestoreClient.java:85)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.firebase.cloud.FirestoreClient.getFirestore(FirestoreClient.java:78)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.firebase.cloud.FirestoreClient.getFirestore(FirestoreClient.java:64)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at org.quiz.service.DataManager.authorize(DataManager.java:24)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at org.quiz.App.start(App.java:24)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at java.security.AccessController.doPrivileged(AccessController.java:102)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_Runnable_2_0002erun_00028_00029V(JNIJavaCallWrappers.java:0)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.sun.glass.ui.win.WinApplication._runLoop(WinApplication.java)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] ... 3 more
when FirestoreClient.getFirestore(); a method called it is giving me runtime error saying t's unsafe.
how do I avoid it?

Can't get location filters to work using Twitter4J

My twitter4j streaming works when I am using track and user queries but when I use location queries, It returns a 404, i.e.
$ java -cp .:twitter4j-core-4.0.4.jar:twitter4j-media-support-4.0.4.jar:twitter4j-async-4.0.4.jar:twitter4j-examples-4.0.4.jar:twitter4j-stream-4.0.4.jar PrintFilterLocationStream "{1,2}"
[Wed Jul 06 00:05:41 SGT 2016]serialVersionUID: 6175546394599249696
[Wed Jul 06 00:05:41 SGT 2016]debug: true
[Wed Jul 06 00:05:41 SGT 2016]user: null
[Wed Jul 06 00:05:41 SGT 2016]password: null
[Wed Jul 06 00:05:41 SGT 2016]httpConf: MyHttpClientConfiguration{httpProxyHost='null', httpProxyUser='null', httpProxyPassword='null', httpProxyPort=-1, httpConnectionTimeout=20000, httpReadTimeout=120000, prettyDebug=false, gzipEnabled=true}
[Wed Jul 06 00:05:41 SGT 2016]httpStreamingReadTimeout: 40000
[Wed Jul 06 00:05:41 SGT 2016]httpRetryCount: 0
[Wed Jul 06 00:05:41 SGT 2016]httpRetryIntervalSeconds: 5
[Wed Jul 06 00:05:41 SGT 2016]oAuthConsumerKey: XXX
[Wed Jul 06 00:05:41 SGT 2016]oAuthConsumerSecret: **************************************************
[Wed Jul 06 00:05:41 SGT 2016]oAuthAccessToken: XXX-XXX
[Wed Jul 06 00:05:41 SGT 2016]oAuthAccessTokenSecret: *********************************************
[Wed Jul 06 00:05:41 SGT 2016]oAuth2TokenType: null
[Wed Jul 06 00:05:41 SGT 2016]oAuth2AccessToken: null
[Wed Jul 06 00:05:41 SGT 2016]oAuth2Scope: null
[Wed Jul 06 00:05:41 SGT 2016]oAuthRequestTokenURL: https://api.twitter.com/oauth/request_token
[Wed Jul 06 00:05:41 SGT 2016]oAuthAuthorizationURL: https://api.twitter.com/oauth/authorize
[Wed Jul 06 00:05:41 SGT 2016]oAuthAccessTokenURL: https://api.twitter.com/oauth/access_token
[Wed Jul 06 00:05:41 SGT 2016]oAuthAuthenticationURL: https://api.twitter.com/oauth/authenticate
[Wed Jul 06 00:05:41 SGT 2016]oAuth2TokenURL: https://api.twitter.com/oauth2/token
[Wed Jul 06 00:05:41 SGT 2016]oAuth2InvalidateTokenURL: https://api.twitter.com/oauth2/invalidate_token
[Wed Jul 06 00:05:41 SGT 2016]restBaseURL: https://api.twitter.com/1.1/
[Wed Jul 06 00:05:41 SGT 2016]streamBaseURL: https://stream.twitter.com/1.1/
[Wed Jul 06 00:05:41 SGT 2016]userStreamBaseURL: https://userstream.twitter.com/1.1/
[Wed Jul 06 00:05:41 SGT 2016]siteStreamBaseURL: https://sitestream.twitter.com/1.1/
[Wed Jul 06 00:05:41 SGT 2016]uploadBaseURL: https://upload.twitter.com/1.1/
[Wed Jul 06 00:05:41 SGT 2016]dispatcherImpl: twitter4j.DispatcherImpl
[Wed Jul 06 00:05:41 SGT 2016]asyncNumThreads: 1
[Wed Jul 06 00:05:41 SGT 2016]loggerFactory: null
[Wed Jul 06 00:05:41 SGT 2016]contributingTo: -1
[Wed Jul 06 00:05:41 SGT 2016]includeMyRetweetEnabled: true
[Wed Jul 06 00:05:41 SGT 2016]includeEntitiesEnabled: true
[Wed Jul 06 00:05:41 SGT 2016]trimUserEnabled: false
[Wed Jul 06 00:05:41 SGT 2016]jsonStoreEnabled: false
[Wed Jul 06 00:05:41 SGT 2016]mbeanEnabled: false
[Wed Jul 06 00:05:41 SGT 2016]userStreamRepliesAllEnabled: false
[Wed Jul 06 00:05:41 SGT 2016]userStreamWithFollowingsEnabled: true
[Wed Jul 06 00:05:41 SGT 2016]stallWarningsEnabled: true
[Wed Jul 06 00:05:41 SGT 2016]applicationOnlyAuthEnabled: false
[Wed Jul 06 00:05:41 SGT 2016]mediaProvider: TWITTER
[Wed Jul 06 00:05:41 SGT 2016]mediaProviderAPIKey: null
[Wed Jul 06 00:05:41 SGT 2016]mediaProviderParameters: null
[Wed Jul 06 00:05:41 SGT 2016]daemonEnabled: true
[Wed Jul 06 00:05:41 SGT 2016]instances: [ConfigurationBase{debug=true, user='null', password='null', httpConf=MyHttpClientConfiguration{httpProxyHost='null', httpProxyUser='null', httpProxyPassword='null', httpProxyPort=-1, httpConnectionTimeout=20000, httpReadTimeout=120000, prettyDebug=false, gzipEnabled=true}, httpStreamingReadTimeout=40000, httpRetryCount=0, httpRetryIntervalSeconds=5, oAuthConsumerKey='zptB1VLNbNguInk3HqKHvc55H', oAuthConsumerSecret='8lyjsT2PsIkG5Ada5axh5k7H8B9lOQM67jizv90tSlasrOGun6', oAuthAccessToken='2550568801-AgwQ31S2DgJ6lyVrZSlMPqBEweTnFk4fn17BLH1', oAuthAccessTokenSecret='3yKlKp6fWvuzAQkgthZbXCB5aMOt3vg1nrVlgQDh9atJV', oAuth2TokenType='null', oAuth2AccessToken='null', oAuth2Scope='null', oAuthRequestTokenURL='https://api.twitter.com/oauth/request_token', oAuthAuthorizationURL='https://api.twitter.com/oauth/authorize', oAuthAccessTokenURL='https://api.twitter.com/oauth/access_token', oAuthAuthenticationURL='https://api.twitter.com/oauth/authenticate', oAuth2TokenURL='https://api.twitter.com/oauth2/token', oAuth2InvalidateTokenURL='https://api.twitter.com/oauth2/invalidate_token', restBaseURL='https://api.twitter.com/1.1/', uploadBaseURL='https://upload.twitter.com/1.1/', streamBaseURL='https://stream.twitter.com/1.1/', userStreamBaseURL='https://userstream.twitter.com/1.1/', siteStreamBaseURL='https://sitestream.twitter.com/1.1/', dispatcherImpl='twitter4j.DispatcherImpl', asyncNumThreads=1, loggerFactory='null', contributingTo=-1, includeMyRetweetEnabled=true, includeEntitiesEnabled=true, trimUserEnabled=false, jsonStoreEnabled=false, mbeanEnabled=false, userStreamRepliesAllEnabled=false, userStreamWithFollowingsEnabled=true, stallWarningsEnabled=true, applicationOnlyAuthEnabled=false, mediaProvider='TWITTER', mediaProviderAPIKey='null', mediaProviderParameters=null, daemonEnabled=true}]
[Wed Jul 06 00:05:41 SGT 2016]Establishing connection.
[Wed Jul 06 00:05:41 SGT 2016]Twitter Stream consumer-1[Establishing connection]
[Wed Jul 06 00:05:42 SGT 2016]Request:
[Wed Jul 06 00:05:42 SGT 2016]POST https://stream.twitter.com/1.1/statuses/filter.json
[Wed Jul 06 00:05:42 SGT 2016]OAuth base string: POST&https%3A%2F%2Fstream.twitter.com%2F1.1%2Fstatuses%2Ffilter.json&count%3D0%26locations%3D1.0%252C2.0%26oauth_consumer_key%3DzptB1VLNbNguInk3HqKHvc55H%26oauth_nonce%3D3352799096%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1467734742%26oauth_token%3D2550568801-AgwQ31S2DgJ6lyVrZSlMPqBEweTnFk4fn17BLH1%26oauth_version%3D1.0%26stall_warnings%3Dtrue
[Wed Jul 06 00:05:42 SGT 2016]OAuth signature: qf36pAFObnNP+VwCR88h0fEjbbk=
[Wed Jul 06 00:05:42 SGT 2016]Authorization: *************************************************************************************************************************************************************************************************************************************************************************************
[Wed Jul 06 00:05:42 SGT 2016]X-Twitter-Client-Version: 4.0.4
[Wed Jul 06 00:05:42 SGT 2016]X-Twitter-Client-URL: http://twitter4j.org/en/twitter4j-4.0.4.xml
[Wed Jul 06 00:05:42 SGT 2016]X-Twitter-Client: Twitter4J
[Wed Jul 06 00:05:42 SGT 2016]User-Agent: twitter4j http://twitter4j.org/ /4.0.4
[Wed Jul 06 00:05:42 SGT 2016]Connection: close
[Wed Jul 06 00:05:42 SGT 2016]Accept-Encoding: gzip
[Wed Jul 06 00:05:42 SGT 2016]Post Params: count=0&locations=1.0%2C2.0&stall_warnings=true
[Wed Jul 06 00:05:43 SGT 2016]Response:
[Wed Jul 06 00:05:43 SGT 2016]date: Tue, 05 Jul 2016 16:05:42 GMT
[Wed Jul 06 00:05:43 SGT 2016]HTTP/1.1 406 Not Acceptable
[Wed Jul 06 00:05:43 SGT 2016]server: tsa
[Wed Jul 06 00:05:43 SGT 2016]content-length: 103
[Wed Jul 06 00:05:43 SGT 2016]x-connection-hash: f255dee017473bf8d62e136ea40e9247
[Wed Jul 06 00:05:43 SGT 2016]content-type: text/html
[Wed Jul 06 00:05:43 SGT 2016]connection: close
[Wed Jul 06 00:05:43 SGT 2016]Location track items must be given as pairs of comma separated lat/longs: [Ljava.lang.String;#640a54b
[Wed Jul 06 00:05:43 SGT 2016]406:Returned by the Search API when an invalid format is specified in the request.
Returned by the Streaming API when one or more of the parameters are not suitable for the resource. The track parameter, for example, would throw this error if:
The track keyword is too long or too short.
The bounding box specified is invalid.
No predicates defined for filtered resource, for example, neither track nor follow parameter defined.
Follow userid cannot be read.
Location track items must be given as pairs of comma separated lat/longs: [Ljava.lang.String;#640a54b
[Wed Jul 06 00:05:43 SGT 2016]Parameter not accepted with the role. 406:Returned by the Search API when an invalid format is specified in the request.
Returned by the Streaming API when one or more of the parameters are not suitable for the resource. The track parameter, for example, would throw this error if:
The track keyword is too long or too short.
The bounding box specified is invalid.
No predicates defined for filtered resource, for example, neither track nor follow parameter defined.
Follow userid cannot be read.
Location track items must be given as pairs of comma separated lat/longs: [Ljava.lang.String;#640a54b
406:Returned by the Search API when an invalid format is specified in the request.
Returned by the Streaming API when one or more of the parameters are not suitable for the resource. The track parameter, for example, would throw this error if:
The track keyword is too long or too short.
The bounding box specified is invalid.
No predicates defined for filtered resource, for example, neither track nor follow parameter defined.
Follow userid cannot be read.
Location track items must be given as pairs of comma separated lat/longs: [Ljava.lang.String;#640a54b
Relevant discussions can be found on the Internet at:
http://www.google.co.jp/search?q=1169356e or
http://www.google.co.jp/search?q=c04b39e1
TwitterException{exceptionCode=[1169356e-c04b39e1], statusCode=406, message=null, code=-1, retryAfter=-1, rateLimitStatus=null, version=4.0.4}
at twitter4j.HttpClientImpl.handleRequest(HttpClientImpl.java:164)
at twitter4j.HttpClientBase.request(HttpClientBase.java:57)
at twitter4j.HttpClientBase.post(HttpClientBase.java:86)
at twitter4j.TwitterStreamImpl.getFilterStream(TwitterStreamImpl.java:346)
at twitter4j.TwitterStreamImpl$8.getStream(TwitterStreamImpl.java:322)
at twitter4j.TwitterStreamImpl$TwitterStreamConsumer.run(TwitterStreamImpl.java:552)
I have compiled modified the base example code from twitter4j and I compiled it as such:
$ javac -classpath twitter4j-core-4.0.4.jar:twitter4j-media-support-4.0.4.jar:twitter4j-async-4.0.4.jar:twitter4j-examples-4.0.4.jar:twitter4j-stream-4.0.4.jar PrintFilterLocationStream.java
My code can be found on https://www.dropbox.com/s/gj75fghtqy5jajf/tweity.zip?dl=0
Is it because the v1.1 endpoint doesn't support location?
Without the location filter, it works fine:
$ java -cp .:twitter4j-core-4.0.4.jar:twitter4j-media-support-4.0.4.jar:twitter4j-async-4.0.4.jar:twitter4j-examples-4.0.4.jar:twitter4j-stream-4.0.4.jar PrintFilterLocationStream "Singapore"
[Wed Jul 06 00:15:36 SGT 2016]serialVersionUID: 6175546394599249696
[Wed Jul 06 00:15:36 SGT 2016]debug: true
[Wed Jul 06 00:15:36 SGT 2016]user: null
[Wed Jul 06 00:15:36 SGT 2016]password: null
[Wed Jul 06 00:15:36 SGT 2016]httpConf: MyHttpClientConfiguration{httpProxyHost='null', httpProxyUser='null', httpProxyPassword='null', httpProxyPort=-1, httpConnectionTimeout=20000, httpReadTimeout=120000, prettyDebug=false, gzipEnabled=true}
[Wed Jul 06 00:15:36 SGT 2016]httpStreamingReadTimeout: 40000
[Wed Jul 06 00:15:36 SGT 2016]httpRetryCount: 0
[Wed Jul 06 00:15:36 SGT 2016]httpRetryIntervalSeconds: 5
[Wed Jul 06 00:15:36 SGT 2016]oAuthConsumerKey: XXX
[Wed Jul 06 00:15:36 SGT 2016]oAuthConsumerSecret: **************************************************
[Wed Jul 06 00:15:36 SGT 2016]oAuthAccessToken: XXX
[Wed Jul 06 00:15:36 SGT 2016]oAuthAccessTokenSecret: *********************************************
[Wed Jul 06 00:15:36 SGT 2016]oAuth2TokenType: null
[Wed Jul 06 00:15:36 SGT 2016]oAuth2AccessToken: null
[Wed Jul 06 00:15:36 SGT 2016]oAuth2Scope: null
[Wed Jul 06 00:15:36 SGT 2016]oAuthRequestTokenURL: https://api.twitter.com/oauth/request_token
[Wed Jul 06 00:15:36 SGT 2016]oAuthAuthorizationURL: https://api.twitter.com/oauth/authorize
[Wed Jul 06 00:15:36 SGT 2016]oAuthAccessTokenURL: https://api.twitter.com/oauth/access_token
[Wed Jul 06 00:15:36 SGT 2016]oAuthAuthenticationURL: https://api.twitter.com/oauth/authenticate
[Wed Jul 06 00:15:36 SGT 2016]oAuth2TokenURL: https://api.twitter.com/oauth2/token
[Wed Jul 06 00:15:36 SGT 2016]oAuth2InvalidateTokenURL: https://api.twitter.com/oauth2/invalidate_token
[Wed Jul 06 00:15:36 SGT 2016]restBaseURL: https://api.twitter.com/1.1/
[Wed Jul 06 00:15:36 SGT 2016]streamBaseURL: https://stream.twitter.com/1.1/
[Wed Jul 06 00:15:36 SGT 2016]userStreamBaseURL: https://userstream.twitter.com/1.1/
[Wed Jul 06 00:15:36 SGT 2016]siteStreamBaseURL: https://sitestream.twitter.com/1.1/
[Wed Jul 06 00:15:36 SGT 2016]uploadBaseURL: https://upload.twitter.com/1.1/
[Wed Jul 06 00:15:36 SGT 2016]dispatcherImpl: twitter4j.DispatcherImpl
[Wed Jul 06 00:15:36 SGT 2016]asyncNumThreads: 1
[Wed Jul 06 00:15:36 SGT 2016]loggerFactory: null
[Wed Jul 06 00:15:36 SGT 2016]contributingTo: -1
[Wed Jul 06 00:15:36 SGT 2016]includeMyRetweetEnabled: true
[Wed Jul 06 00:15:36 SGT 2016]includeEntitiesEnabled: true
[Wed Jul 06 00:15:36 SGT 2016]trimUserEnabled: false
[Wed Jul 06 00:15:36 SGT 2016]jsonStoreEnabled: false
[Wed Jul 06 00:15:36 SGT 2016]mbeanEnabled: false
[Wed Jul 06 00:15:36 SGT 2016]userStreamRepliesAllEnabled: false
[Wed Jul 06 00:15:36 SGT 2016]userStreamWithFollowingsEnabled: true
[Wed Jul 06 00:15:36 SGT 2016]stallWarningsEnabled: true
[Wed Jul 06 00:15:36 SGT 2016]applicationOnlyAuthEnabled: false
[Wed Jul 06 00:15:36 SGT 2016]mediaProvider: TWITTER
[Wed Jul 06 00:15:36 SGT 2016]mediaProviderAPIKey: null
[Wed Jul 06 00:15:36 SGT 2016]mediaProviderParameters: null
[Wed Jul 06 00:15:36 SGT 2016]daemonEnabled: true
[Wed Jul 06 00:15:36 SGT 2016]instances: [ConfigurationBase{debug=true, user='null', password='null', httpConf=MyHttpClientConfiguration{httpProxyHost='null', httpProxyUser='null', httpProxyPassword='null', httpProxyPort=-1, httpConnectionTimeout=20000, httpReadTimeout=120000, prettyDebug=false, gzipEnabled=true}, httpStreamingReadTimeout=40000, httpRetryCount=0, httpRetryIntervalSeconds=5, oAuthConsumerKey='zptB1VLNbNguInk3HqKHvc55H', oAuthConsumerSecret='8lyjsT2PsIkG5Ada5axh5k7H8B9lOQM67jizv90tSlasrOGun6', oAuthAccessToken='2550568801-AgwQ31S2DgJ6lyVrZSlMPqBEweTnFk4fn17BLH1', oAuthAccessTokenSecret='3yKlKp6fWvuzAQkgthZbXCB5aMOt3vg1nrVlgQDh9atJV', oAuth2TokenType='null', oAuth2AccessToken='null', oAuth2Scope='null', oAuthRequestTokenURL='https://api.twitter.com/oauth/request_token', oAuthAuthorizationURL='https://api.twitter.com/oauth/authorize', oAuthAccessTokenURL='https://api.twitter.com/oauth/access_token', oAuthAuthenticationURL='https://api.twitter.com/oauth/authenticate', oAuth2TokenURL='https://api.twitter.com/oauth2/token', oAuth2InvalidateTokenURL='https://api.twitter.com/oauth2/invalidate_token', restBaseURL='https://api.twitter.com/1.1/', uploadBaseURL='https://upload.twitter.com/1.1/', streamBaseURL='https://stream.twitter.com/1.1/', userStreamBaseURL='https://userstream.twitter.com/1.1/', siteStreamBaseURL='https://sitestream.twitter.com/1.1/', dispatcherImpl='twitter4j.DispatcherImpl', asyncNumThreads=1, loggerFactory='null', contributingTo=-1, includeMyRetweetEnabled=true, includeEntitiesEnabled=true, trimUserEnabled=false, jsonStoreEnabled=false, mbeanEnabled=false, userStreamRepliesAllEnabled=false, userStreamWithFollowingsEnabled=true, stallWarningsEnabled=true, applicationOnlyAuthEnabled=false, mediaProvider='TWITTER', mediaProviderAPIKey='null', mediaProviderParameters=null, daemonEnabled=true}]
[Wed Jul 06 00:15:36 SGT 2016]Establishing connection.
[Wed Jul 06 00:15:36 SGT 2016]Twitter Stream consumer-1[Establishing connection]
[Wed Jul 06 00:15:37 SGT 2016]Request:
[Wed Jul 06 00:15:37 SGT 2016]POST https://stream.twitter.com/1.1/statuses/filter.json
[Wed Jul 06 00:15:37 SGT 2016]OAuth base string: POST&https%3A%2F%2Fstream.twitter.com%2F1.1%2Fstatuses%2Ffilter.json&count%3D0%26oauth_consumer_key%3DzptB1VLNbNguInk3HqKHvc55H%26oauth_nonce%3D749948799%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1467735337%26oauth_token%3D2550568801-AgwQ31S2DgJ6lyVrZSlMPqBEweTnFk4fn17BLH1%26oauth_version%3D1.0%26stall_warnings%3Dtrue%26track%3DSingapore
[Wed Jul 06 00:15:37 SGT 2016]OAuth signature: g9tQwPICKe2EsuZ2EPJ2Mv4AblE=
[Wed Jul 06 00:15:37 SGT 2016]Authorization: **********************************************************************************************************************************************************************************************************************************************************************************
[Wed Jul 06 00:15:37 SGT 2016]X-Twitter-Client-Version: 4.0.4
[Wed Jul 06 00:15:37 SGT 2016]X-Twitter-Client-URL: http://twitter4j.org/en/twitter4j-4.0.4.xml
[Wed Jul 06 00:15:37 SGT 2016]X-Twitter-Client: Twitter4J
[Wed Jul 06 00:15:37 SGT 2016]User-Agent: twitter4j http://twitter4j.org/ /4.0.4
[Wed Jul 06 00:15:37 SGT 2016]Connection: close
[Wed Jul 06 00:15:37 SGT 2016]Accept-Encoding: gzip
[Wed Jul 06 00:15:37 SGT 2016]Post Params: count=0&track=Singapore&stall_warnings=true
[Wed Jul 06 00:15:41 SGT 2016]Response:
[Wed Jul 06 00:15:41 SGT 2016]date: Tue, 05 Jul 2016 16:15:38 GMT
[Wed Jul 06 00:15:41 SGT 2016]HTTP/1.1 200 OK
[Wed Jul 06 00:15:41 SGT 2016]server: tsa
[Wed Jul 06 00:15:41 SGT 2016]transfer-encoding: chunked
[Wed Jul 06 00:15:41 SGT 2016]x-connection-hash: e3e1c8a44e63290ee879f576ba038d89
[Wed Jul 06 00:15:41 SGT 2016]content-type: application/json
[Wed Jul 06 00:15:41 SGT 2016]connection: close
[Wed Jul 06 00:15:41 SGT 2016]content-Encoding: gzip
[Wed Jul 06 00:15:41 SGT 2016]Connection established.
[Wed Jul 06 00:15:41 SGT 2016]Receiving status stream.
[Wed Jul 06 00:15:41 SGT 2016]Twitter Stream consumer-1[Receiving stream]
[Wed Jul 06 00:15:42 SGT 2016]Received:{"extended_entities":{"media":[{"display_url":"pic.twitter.com/JIj8bGhdQG","source_user_id":1011604327,"type":"video","media_url":"http://pbs.twimg.com/ext_tw_video_thumb/747254503640948736/pu/img/Rgn5TCJHfPTmvias.jpg","source_status_id":747254708255940609,"url":"","indices":[109,132],"sizes":{"small":{"w":340,"h":604,"resize":"fit"},"large":{"w":360,"h":640,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"medium":{"w":360,"h":640,"resize":"fit"}},"id_str":"747254503640948736","expanded_url":"http://twitter.com/missgerrard/status/747254708255940609/video/1","source_status_id_str":"747254708255940609","media_url_https":"https://pbs.twimg.com/ext_tw_video_thumb/747254503640948736/pu/img/Rgn5TCJHfPTmvias.jpg","id":747254503640948736,"source_user_id_str":"1011604327","video_info":{"aspect_ratio":[9,16],"duration_millis":18467,"variants":[{"content_type":"video/mp4","bitrate":320000,"url":"https://video.twimg.com/ext_tw_video/747254503640948736/pu/vid/180x320/QZlqdGzyH822t3ap.mp4"},{"content_type":"application/dash+xml","url":"https://video.twimg.com/ext_tw_video/747254503640948736/pu/pl/M--8lK60Ire7nnAU.mpd"},{"content_type":"application/x-mpegURL","url":"https://video.twimg.com/ext_tw_video/747254503640948736/pu/pl/M--8lK60Ire7nnAU.m3u8"},{"content_type":"video/mp4","bitrate":832000,"url":"https://video.twimg.com/ext_tw_video/747254503640948736/pu/vid/360x640/-v1mnPdAGvM0EYbH.mp4"}]}}]},"in_reply_to_status_id_str":null,"in_reply_to_status_id":null,"created_at":"Tue Jul 05 16:15:41 +0000 2016","in_reply_to_user_id_str":null,"source":"<a href=\"http://twitter.com/download/iphone\" rel=\"nofollow\">Twitter for iPhone<\/a>","retweeted_status":{"extended_entities":{"media":[{"display_url":"pic.twitter.com/JIj8bGhdQG","indices":[92,115],"sizes":{"small":{"w":340,"h":604,"resize":"fit"},"large":{"w":360,"h":640,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"medium":{"w":360,"h":640,"resize":"fit"}},"id_str":"747254503640948736","expanded_url":"http://twitter.com/missgerrard/status/747254708255940609/video/1","media_url_https":"https://pbs.twimg.com/ext_tw_video_thumb/747254503640948736/pu/img/Rgn5TCJHfPTmvias.jpg","id":747254503640948736,"type":"video","media_url":"http://pbs.twimg.com/ext_tw_video_thumb/747254503640948736/pu/img/Rgn5TCJHfPTmvias.jpg","url":"/JIj8bGhdQG","video_info":{"aspect_ratio":[9,16],"duration_millis":18467,"variants":[{"content_type":"video/mp4","bitrate":320000,"url":"https://video.twimg.com/ext_tw_video/747254503640948736/pu/vid/180x320/QZlqdGzyH822t3ap.mp4"},{"content_type":"application/dash+xml","url":"https://video.twimg.com/ext_tw_video/747254503640948736/pu/pl/M--8lK60Ire7nnAU.mpd"},{"content_type":"application/x-mpegURL","url":"https://video.twimg.com/ext_tw_video/747254503640948736/pu/pl/M--8lK60Ire7nnAU.m3u8"},{"content_type":"video/mp4","bitrate":832000,"url":"https://video.twimg.com/ext_tw_video/747254503640948736/pu/vid/360x640/-v1mnPdAGvM0EYbH.mp4"}]}}]},"in_reply_to_status_id_str":null,"in_reply_to_status_id":null,"created_at":"Mon Jun 27 02:26:20 +0000 2016","in_reply_to_user_id_str":null,"source":"<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android<\/a>","retweet_count":19,"retweeted":false,"geo":null,"filter_level":"low","in_reply_to_screen_name":null,"is_quote_status":false,"id_str":"747254708255940609","in_reply_to_user_id":null,"favorite_count":25,"id":747254708255940609,"text":"Yeay cant wait to see u in singapore Alif Satar 23rd July #diasemanishoney #DiaSemanisHoney https://////JIj8bGhdQG","place":null,"lang":"en","favorited":false,"possibly_sensitive":false,"coordinates":null,"truncated":false,"entities":{"urls":[],"hashtags":[{"indices":[58,74],"text":"diasemanishoney"}],"media":
#ita891210 - RT #Hyukkiss: 130706 SS5 Singapore #WaitingforEunHae https://////9hViCuSA9U
From twitter4j geo streaming latitude/longitude for Hongkong, it seems like it's because I'm using the locations wrongly, if I use the locations from this link https://dev.twitter.com/docs/streaming-apis/parameters#locations, the streaming works fine, e.g.
java -cp .:twitter4j-core-4.0.4.jar:twitter4j-media-support-4.0.4.jar:twitter4j-async-4.0.4.jar:twitter4j-examples-4.0.4.jar:twitter4j-stream-4.0.4.jar PrintFilterLocationStream "{{-126.562500,30.448674},{-61.171875,44.087585}}"
[out]:
[Wed Jul 06 05:27:05 SGT 2016]serialVersionUID: 6175546394599249696
[Wed Jul 06 05:27:05 SGT 2016]debug: true
[Wed Jul 06 05:27:05 SGT 2016]user: null
[Wed Jul 06 05:27:05 SGT 2016]password: null
[Wed Jul 06 05:27:05 SGT 2016]httpConf: MyHttpClientConfiguration{httpProxyHost='null', httpProxyUser='null', httpProxyPassword='null', httpProxyPort=-1, httpConnectionT
imeout=20000, httpReadTimeout=120000, prettyDebug=false, gzipEnabled=true}
[Wed Jul 06 05:27:05 SGT 2016]httpStreamingReadTimeout: 40000
[Wed Jul 06 05:27:05 SGT 2016]httpRetryCount: 0
[Wed Jul 06 05:27:05 SGT 2016]httpRetryIntervalSeconds: 5
[Wed Jul 06 05:27:05 SGT 2016]oAuthConsumerKey: zptB1VLNbNguInk3HqKHvc55H
[Wed Jul 06 05:27:05 SGT 2016]oAuthConsumerSecret: **************************************************
[Wed Jul 06 05:27:05 SGT 2016]oAuthAccessToken: 2550568801-AgwQ31S2DgJ6lyVrZSlMPqBEweTnFk4fn17BLH1
[Wed Jul 06 05:27:05 SGT 2016]oAuthAccessTokenSecret: *********************************************
[Wed Jul 06 05:27:05 SGT 2016]oAuth2TokenType: null
[Wed Jul 06 05:27:05 SGT 2016]oAuth2AccessToken: null
[Wed Jul 06 05:27:05 SGT 2016]oAuth2Scope: null
[Wed Jul 06 05:27:05 SGT 2016]oAuthRequestTokenURL: https://api.twitter.com/oauth/request_token
[Wed Jul 06 05:27:05 SGT 2016]oAuthAuthorizationURL: https://api.twitter.com/oauth/authorize
[Wed Jul 06 05:27:05 SGT 2016]oAuthAccessTokenURL: https://api.twitter.com/oauth/access_token
[Wed Jul 06 05:27:05 SGT 2016]oAuthAuthenticationURL: https://api.twitter.com/oauth/authenticate
[Wed Jul 06 05:27:05 SGT 2016]oAuth2TokenURL: https://api.twitter.com/oauth2/token
[Wed Jul 06 05:27:05 SGT 2016]oAuth2InvalidateTokenURL: https://api.twitter.com/oauth2/invalidate_token
[Wed Jul 06 05:27:05 SGT 2016]restBaseURL: https://api.twitter.com/1.1/
[Wed Jul 06 05:27:05 SGT 2016]streamBaseURL: https://stream.twitter.com/1.1/
[Wed Jul 06 05:27:05 SGT 2016]userStreamBaseURL: https://userstream.twitter.com/1.1/
[Wed Jul 06 05:27:05 SGT 2016]siteStreamBaseURL: https://sitestream.twitter.com/1.1/
[Wed Jul 06 05:27:05 SGT 2016]uploadBaseURL: https://upload.twitter.com/1.1/
[Wed Jul 06 05:27:05 SGT 2016]dispatcherImpl: twitter4j.DispatcherImpl
[Wed Jul 06 05:27:05 SGT 2016]asyncNumThreads: 1
[Wed Jul 06 05:27:05 SGT 2016]loggerFactory: null
[Wed Jul 06 05:27:05 SGT 2016]contributingTo: -1
[Wed Jul 06 05:27:05 SGT 2016]includeMyRetweetEnabled: true
[Wed Jul 06 05:27:05 SGT 2016]includeEntitiesEnabled: true
[Wed Jul 06 05:27:05 SGT 2016]trimUserEnabled: false
[Wed Jul 06 05:27:05 SGT 2016]jsonStoreEnabled: false
[Wed Jul 06 05:27:05 SGT 2016]mbeanEnabled: false
[Wed Jul 06 05:27:05 SGT 2016]userStreamRepliesAllEnabled: false
[Wed Jul 06 05:27:05 SGT 2016]userStreamWithFollowingsEnabled: true
[Wed Jul 06 05:27:05 SGT 2016]stallWarningsEnabled: true
[Wed Jul 06 05:27:05 SGT 2016]applicationOnlyAuthEnabled: false
[Wed Jul 06 05:27:05 SGT 2016]mediaProvider: TWITTER
[Wed Jul 06 05:27:05 SGT 2016]mediaProviderAPIKey: null
[Wed Jul 06 05:27:05 SGT 2016]mediaProviderParameters: null
[Wed Jul 06 05:27:05 SGT 2016]daemonEnabled: true
[Wed Jul 06 05:27:05 SGT 2016]instances: [ConfigurationBase{debug=true, user='null', password='null', httpConf=MyHttpClientConfiguration{httpProxyHost='null', httpProxyU
ser='null', httpProxyPassword='null', httpProxyPort=-1, httpConnectionTimeout=20000, httpReadTimeout=120000, prettyDebug=false, gzipEnabled=true}, httpStreamingReadTimeo
ut=40000, httpRetryCount=0, httpRetryIntervalSeconds=5, oAuthConsumerKey='zptB1VLNbNguInk3HqKHvc55H', oAuthConsumerSecret='8lyjsT2PsIkG5Ada5axh5k7H8B9lOQM67jizv90tSlasrO
Gun6', oAuthAccessToken='2550568801-AgwQ31S2DgJ6lyVrZSlMPqBEweTnFk4fn17BLH1', oAuthAccessTokenSecret='3yKlKp6fWvuzAQkgthZbXCB5aMOt3vg1nrVlgQDh9atJV', oAuth2TokenType='null', oAuth2AccessToken='null', oAuth2Scope='null', oAuthRequestTokenURL='https://api.twitter.com/oauth/request_token', oAuthAuthorizationURL='https://api.twitter.com/oauth/authorize', oAuthAccessTokenURL='https://api.twitter.com/oauth/access_token', oAuthAuthenticationURL='https://api.twitter.com/oauth/authenticate', oAuth2TokenURL='https://api.twitter.com/oauth2/token', oAuth2InvalidateTokenURL='https://api.twitter.com/oauth2/invalidate_token', restBaseURL='https://api.twitter.com/1.1/', uploadBaseURL='https://upload.twitter.com/1.1/', streamBaseURL='https://stream.twitter.com/1.1/', userStreamBaseURL='https://userstream.twitter.com/1.1/', siteStreamBaseURL='https://sitestream.twitter.com/1.1/', dispatcherImpl='twitter4j.DispatcherImpl', asyncNumThreads=1, loggerFactory='null', contributingTo=-1, includeMyRetweetEnabled=true, includeEntitiesEnabled=true, trimUserEnabled=false, jsonStoreEnabled=false, mbeanEnabled=false, userStreamRepliesAllEnabled=false, userStreamWithFollowingsEnabled=true, stallWarningsEnabled=true, applicationOnlyAuthEnabled=false, mediaProvider='TWITTER', mediaProviderAPIKey='null', mediaProviderParameters=null, daemonEnabled=true}]
[Wed Jul 06 05:27:06 SGT 2016]Establishing connection.
[Wed Jul 06 05:27:06 SGT 2016]Twitter Stream consumer-1[Establishing connection]
[Wed Jul 06 05:27:06 SGT 2016]Request:
[Wed Jul 06 05:27:06 SGT 2016]POST https://stream.twitter.com/1.1/statuses/filter.json
[Wed Jul 06 05:27:06 SGT 2016]OAuth base string: POST&https%3A%2F%2Fstream.twitter.com%2F1.1%2Fstatuses%2Ffilter.json&count%3D0%26locations%3D-126.5625%252C30.448674%252C-61.171875%252C44.087585%26oauth_consumer_key%3DzptB1VLNbNguInk3HqKHvc55H%26oauth_nonce%3D2467567040%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1467754026%26oauth_token%3D2550568801-AgwQ31S2DgJ6lyVrZSlMPqBEweTnFk4fn17BLH1%26oauth_version%3D1.0%26stall_warnings%3Dtrue
[Wed Jul 06 05:27:06 SGT 2016]OAuth signature: ccZ0rsHRmt8VMvUzlzZ43QVdSvw=
[Wed Jul 06 05:27:06 SGT 2016]Authorization: ***********************************************************************************************************************************************************************************************************************************************************************************
[Wed Jul 06 05:27:06 SGT 2016]X-Twitter-Client-Version: 4.0.4
[Wed Jul 06 05:27:06 SGT 2016]X-Twitter-Client-URL: http://twitter4j.org/en/twitter4j-4.0.4.xml
[Wed Jul 06 05:27:06 SGT 2016]X-Twitter-Client: Twitter4J
[Wed Jul 06 05:27:06 SGT 2016]User-Agent: twitter4j http://twitter4j.org/ /4.0.4
[Wed Jul 06 05:27:06 SGT 2016]Connection: close
[Wed Jul 06 05:27:06 SGT 2016]Accept-Encoding: gzip
[Wed Jul 06 05:27:06 SGT 2016]Post Params: count=0&locations=-126.5625%2C30.448674%2C-61.171875%2C44.087585&stall_warnings=true
[Wed Jul 06 05:27:07 SGT 2016]Response:
[Wed Jul 06 05:27:07 SGT 2016]date: Tue, 05 Jul 2016 21:27:07 GMT
[Wed Jul 06 05:27:07 SGT 2016]HTTP/1.1 200 OK
[Wed Jul 06 05:27:07 SGT 2016]server: tsa
[Wed Jul 06 05:27:07 SGT 2016]transfer-encoding: chunked
[Wed Jul 06 05:27:07 SGT 2016]x-connection-hash: 129d77a68486c304b7ff69e8c08b1102
[Wed Jul 06 05:27:07 SGT 2016]content-type: application/json
[Wed Jul 06 05:27:07 SGT 2016]connection: close
[Wed Jul 06 05:27:07 SGT 2016]content-Encoding: gzip
[Wed Jul 06 05:27:07 SGT 2016]Connection established.
[Wed Jul 06 05:27:07 SGT 2016]Receiving status stream.
[Wed Jul 06 05:27:07 SGT 2016]Twitter Stream consumer-1[Receiving stream]
[Wed Jul 06 05:27:07 SGT 2016]Received:{"in_reply_to_status_id_str":null,"in_reply_to_status_id":null,"created_at":"Tue Jul 05 21:27:07 +0000 2016","in_reply_to_user_id_str":null,"source":"<a href=\"http://twitter.com/download/iphone\" rel=\"nofollow\">Twitter for iPhone<\/a>","retweet_count":0,"retweeted":false,"geo":null,"filter_level":"low","in_reply_to_screen_name":null,"is_quote_status":false,"id_str":"750440897813155841","in_reply_to_user_id":null,"favorite_count":0,"id":750440897813155841,"text":"so annoyed","place":{"country_code":"US","country":"United States","full_name":"San Diego, CA","bounding_box":{"coordinates":[[[-117.282538,32.53962],[-117.282538,33.080404],[-116.92744,33.080404],[-116.92744,32.53962]]],"type":"Polygon"},"place_type":"city","name":"San Diego","attributes":{},"id":"a592bd6ceb1319f7","url":"https://api.twitter.com/1.1/geo/id/a592bd6ceb1319f7.json"},"lang":"en","favorited":false,"coordinates":null,"truncated":false,"timestamp_ms":"1467754027213","entities":{"urls":[],"hashtags":[],"user_mentions":[],"symbols":[]},"contributors":null,"user":{"utc_offset":-25200,"friends_count":406,"profile_image_url_https":"https://pbs.twimg.com/profile_images/750239874121293824/ncD2YISf_normal.jpg","listed_count":5,"profile_background_image_url":"http://abs.twimg.com/images/themes/theme1/bg.png","default_profile_image":false,"favourites_count":19080,"description":"im an angel","created_at":"Sat Sep 22 01:37:35 +0000 2012","is_translator":false,"profile_background_image_url_https":"https://abs.twimg.com/images/themes/theme1/bg.png","protected":false,"screen_name":"kayexcamille","id_str":"838869294","profile_link_color":"ABB8C2","id":838869294,"geo_enabled":true,"profile_background_color":"000000","lang":"en","profile_sidebar_border_color":"000000","profile_text_color":"000000","verified":false,"profile_image_url":"http://pbs.twimg.com/profile_images/750239874121293824/ncD2YISf_normal.jpg","time_zone":"Arizona","url":null,"contributors_enabled":false,"profile_background_tile":false,"profile_banner_url":"https://pbs.twimg.com/profile_banners/838869294/1467133604","statuses_count":22577,"follow_request_sent":null,"followers_count":787,"profile_use_background_image":false,"default_profile":false,"following":null,"name":"k","location":"San Diego, CA","profile_sidebar_fill_color":"000000","notifications":null}}
#kayexcamille - so annoyed

JAVA Date Calculation Error .?

Here is my code fragment. I need to subtract days from a certain date but I'm not getting the results I expect:
public class TestingDates {
public static void main(String[] args) {
Date toDate=new Date();
Date fromDate=new Date();
for (int i = 0; i < 30; i++) {
fromDate.setTime(toDate.getTime() - i * 24 * 60 * 60 * 1000);
System.out.println(fromDate);
}
}
}
And i'm confuse with this result
here is the output
Fri Sep 13 12:24:50 IST 2013
Thu Sep 12 12:24:50 IST 2013
Wed Sep 11 12:24:50 IST 2013
Tue Sep 10 12:24:50 IST 2013
Mon Sep 09 12:24:50 IST 2013
Sun Sep 08 12:24:50 IST 2013
Sat Sep 07 12:24:50 IST 2013
Fri Sep 06 12:24:50 IST 2013
Thu Sep 05 12:24:50 IST 2013
Wed Sep 04 12:24:50 IST 2013
Tue Sep 03 12:24:50 IST 2013
Mon Sep 02 12:24:50 IST 2013
Sun Sep 01 12:24:50 IST 2013
Sat Aug 31 12:24:50 IST 2013
Fri Aug 30 12:24:50 IST 2013
Thu Aug 29 12:24:50 IST 2013
Wed Aug 28 12:24:50 IST 2013
Tue Aug 27 12:24:50 IST 2013
Mon Aug 26 12:24:50 IST 2013
Sun Aug 25 12:24:50 IST 2013
Sat Aug 24 12:24:50 IST 2013
Fri Aug 23 12:24:50 IST 2013
Thu Aug 22 12:24:50 IST 2013
Wed Aug 21 12:24:50 IST 2013
Tue Aug 20 12:24:50 IST 2013
Tue Oct 08 05:27:38 IST 2013
Mon Oct 07 05:27:38 IST 2013
Sun Oct 06 05:27:38 IST 2013
Sat Oct 05 05:27:38 IST 2013
Fri Oct 04 05:27:38 IST 2013
please help me to sort out this issue
You seem to be wanting to calculate backwards 30 days...You should try using Calendar instead
Calendar cal = Calendar.getInstance();
cal.setTime(toDate);
for (int i = 0; i < 30; i++) {
cal.add(Calendar.DATE, -1);
System.out.println(cal.getTime());
}
You face the integer overflow. The maximal value for your int variable i is 2^31-1.
Use long type for the i variable to avoid the overflow.
for (long i = 0; i < 30; i++) {
fromDate.setTime(toDate.getTime() - i * 24 * 60 * 60 * 1000);
System.out.println(fromDate);
}
You get an overflow in your calculation
public static void main(String[] args) {
Date toDate=new Date();
Date fromDate=new Date();
for (int i = 0; i < 30; i++) {
int x = i * 24 * 60 * 60 * 1000;
System.out.println(x);
fromDate.setTime(toDate.getTime() - x);
System.out.println(fromDate);
}
}
results in
0
Fri Sep 13 09:32:00 CEST 2013
86400000
Thu Sep 12 09:32:00 CEST 2013
172800000
Wed Sep 11 09:32:00 CEST 2013
259200000
Tue Sep 10 09:32:00 CEST 2013
345600000
Mon Sep 09 09:32:00 CEST 2013
432000000
Sun Sep 08 09:32:00 CEST 2013
518400000
Sat Sep 07 09:32:00 CEST 2013
604800000
Fri Sep 06 09:32:00 CEST 2013
691200000
Thu Sep 05 09:32:00 CEST 2013
777600000
Wed Sep 04 09:32:00 CEST 2013
864000000
Tue Sep 03 09:32:00 CEST 2013
950400000
Mon Sep 02 09:32:00 CEST 2013
1036800000
Sun Sep 01 09:32:00 CEST 2013
1123200000
Sat Aug 31 09:32:00 CEST 2013
1209600000
Fri Aug 30 09:32:00 CEST 2013
1296000000
Thu Aug 29 09:32:00 CEST 2013
1382400000
Wed Aug 28 09:32:00 CEST 2013
1468800000
Tue Aug 27 09:32:00 CEST 2013
1555200000
Mon Aug 26 09:32:00 CEST 2013
1641600000
Sun Aug 25 09:32:00 CEST 2013
1728000000
Sat Aug 24 09:32:00 CEST 2013
1814400000
Fri Aug 23 09:32:00 CEST 2013
1900800000
Thu Aug 22 09:32:00 CEST 2013
1987200000
Wed Aug 21 09:32:00 CEST 2013
2073600000
Tue Aug 20 09:32:00 CEST 2013
-2134967296
Tue Oct 08 02:34:48 CEST 2013
-2048567296
Mon Oct 07 02:34:48 CEST 2013
-1962167296
Sun Oct 06 02:34:48 CEST 2013
-1875767296
Sat Oct 05 02:34:48 CEST 2013
-1789367296
Fri Oct 04 02:34:48 CEST 2013
see the x value before your date jumps.
Try to print the actual int you get after this line:
i * 24 * 60 * 60 * 1000
Here is the output:
86400000
172800000
259200000
345600000
432000000
518400000
604800000
691200000
777600000
864000000
950400000
1036800000
1123200000
1209600000
1296000000
1382400000
1468800000
1555200000
1641600000
1728000000
1814400000
1900800000
1987200000
2073600000
-2134967296
-2048567296
-1962167296
-1875767296
-1789367296
As you can see you create a number higher than the one an int can store and thus get overflow. The solution is using a long, that is a 64 bit number.

Categories

Resources