yccheok / jstock

JStock is a free stock market software for 28 countries.
https://jstock.org
660 stars 347 forks source link

Open from / Save to cloud not working #125

Open llucax opened 6 years ago

llucax commented 6 years ago

I'm using Debian testing and I just downloaded jstock. I'm trying to open my data from the cloud (saved from my phone using the jstock app) and it does nothing and make the File menu not respond anymore until I restart the program (other menues work normally). I also trying saving same symptoms.

This is the program log after trying to open from the cloud:

~/Downloads/jstock$ ./jstock.sh 
Warning: /bin/java does not exist
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.thoughtworks.xstream.converters.collections.TreeMapConverter (file:/home/luca/Downloads/jstock/lib/xstream-1.4.2.jar) to field java.util.TreeMap.comparator
WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.converters.collections.TreeMapConverter
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2018-09-21 17:33:13.234:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
2018-09-21 17:33:13.235:INFO::jetty-6.1.26
2018-09-21 17:33:13.259:INFO::Started SocketConnector@localhost:36945
Graphics Device initialization failed for :  es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
        at com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:280)
        at com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:221)
        at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:248)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:209)
        at javafx.embed.swing.JFXPanel.lambda$initFx$44(JFXPanel.java:232)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:94)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
        ... 1 more
Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: No toolkit found
        at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:260)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:209)
        at javafx.embed.swing.JFXPanel.lambda$initFx$44(JFXPanel.java:232)
        at java.base/java.lang.Thread.run(Thread.java:834)

Here is when trying to save to the cloud:

Warning: /bin/java does not exist
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.thoughtworks.xstream.converters.collections.TreeMapConverter (file:/home/luca/Downloads/jstock/lib/xstream-1.4.2.jar) to field java.util.TreeMap.comparator
WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.converters.collections.TreeMapConverter
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2018-09-21 17:34:26.691:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
2018-09-21 17:34:26.693:INFO::jetty-6.1.26
2018-09-21 17:34:26.720:INFO::Started SocketConnector@localhost:38293
Graphics Device initialization failed for :  es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
        at com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:280)
        at com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:221)
        at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:248)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:209)
        at javafx.embed.swing.JFXPanel.lambda$initFx$44(JFXPanel.java:232)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:94)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
        ... 1 more
Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: No toolkit found
        at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:260)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:209)
        at javafx.embed.swing.JFXPanel.lambda$initFx$44(JFXPanel.java:232)
        at java.base/java.lang.Thread.run(Thread.java:834)
llucax commented 6 years ago

BTW, is there any way to manually download the files in the cloud the App uploaded and import them in the desktop program in the meantime? I can't see any files related to jstock in my google drive, even when I synced several times my phone's jstock data with it.

llucax commented 6 years ago

Mmm, also the "Open" and "Save as" items in the File menu are greyed out, so I can't import/export anything in the desktop app...

dtcwee commented 5 years ago

Reproduced issue in Ubuntu 18.10 LTS. Also getting getting warning: "System tray is not supported. You may not receive stock alert notifications."

dtcwee commented 5 years ago

Got it working on both Ubuntu 18.10 and Raspbian:

  1. Installed openjfx. sudo apt install openjfx This also installed openjdk8.
  2. On Ubuntu, changed default JVM to OpenJDK 8 (Ubuntu default is 11. Raspbian Stretch is currently 8). sudo update-alternatives --config java StackOverflow Reference
llucax commented 5 years ago

Not having any effect for me in Debian buster. I already had openjdk8 installed (and 9, 10 and 11, 11 being the default). I installed openjfx successfully but it is still failing, even if I use openjdk8 instead of 11.

llucax commented 5 years ago

Oh, but the exception changed: loading from the cloud:

Warning: /bin/java does not exist
2019-01-14 12:22:23.544:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
2019-01-14 12:22:23.545:INFO::jetty-6.1.26
2019-01-14 12:22:23.571:INFO::Started SocketConnector@localhost:42661
java.lang.ClassNotFoundException: com.sun.glass.ui.gtk.GtkPlatformFactory
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at com.sun.glass.ui.PlatformFactory.getPlatformFactory(PlatformFactory.java:42)
        at com.sun.glass.ui.Application.run(Application.java:146)
        at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:257)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:211)
        at javafx.embed.swing.JFXPanel.lambda$initFx$44(JFXPanel.java:232)
        at java.lang.Thread.run(Thread.java:748)
Failed to load Glass factory class
Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException
        at com.sun.glass.ui.Application.run(Application.java:146)
        at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:257)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:211)
        at javafx.embed.swing.JFXPanel.lambda$initFx$44(JFXPanel.java:232)
        at java.lang.Thread.run(Thread.java:748)
dtcwee commented 5 years ago

Does running it with the -Dprism.verbose=true flag provide more information? e.g.: java -jar -Dprism.verbose=true jstock.jar

llucax commented 5 years ago
$ java -jar -Dprism.verbose=true jstock.jar
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.thoughtworks.xstream.converters.collections.TreeMapConverter (file:/home/luca/Downloads/jstock/lib/xstream-1.4.2.jar) to field java.util.TreeMap.comparator
WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.converters.collections.TreeMapConverter
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2019-01-19 12:49:36.723:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
2019-01-19 12:49:36.724:INFO::jetty-6.1.26
2019-01-19 12:49:36.745:INFO::Started SocketConnector@localhost:44207
Prism pipeline init order: es2 sw
Using java-based Pisces rasterizer
Using dirty region optimizations
Not using texture mask for primitives
Not forcing power of 2 sizes for textures
Using hardware CLAMP_TO_ZERO mode
Opting in for HiDPI pixel scaling
Prism pipeline name = com.sun.prism.es2.ES2Pipeline
GraphicsPipeline.createPipeline failed for com.sun.prism.es2.ES2Pipeline
java.lang.ClassNotFoundException: com.sun.prism.es2.ES2Pipeline
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:315)
        at com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:187)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
        at java.base/java.lang.Thread.run(Thread.java:834)
*** Fallback to Prism SW pipeline
Prism pipeline name = com.sun.prism.sw.SWPipeline
(X) Got class = class com.sun.prism.sw.SWPipeline
Initialized prism pipeline: com.sun.prism.sw.SWPipeline
java.lang.ClassNotFoundException: com.sun.glass.ui.gtk.GtkPlatformFactory
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:315)
        at com.sun.glass.ui.PlatformFactory.getPlatformFactory(PlatformFactory.java:42)
        at com.sun.glass.ui.Application.run(Application.java:146)
        at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:257)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:211)
        at javafx.embed.swing.JFXPanel.lambda$initFx$44(JFXPanel.java:232)
        at java.base/java.lang.Thread.run(Thread.java:834)
Failed to load Glass factory class
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at com.sun.glass.ui.Application.run(Application.java:146)
        at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:257)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:211)
        at javafx.embed.swing.JFXPanel.lambda$initFx$44(JFXPanel.java:232)
        at java.base/java.lang.Thread.run(Thread.java:834)
dtcwee commented 5 years ago

What is the output of update-alternatives --display java?

llucax commented 5 years ago

$ update-alternatives --display java java - auto mode link best version is /usr/lib/jvm/java-11-openjdk-amd64/bin/java link currently points to /usr/lib/jvm/java-11-openjdk-amd64/bin/java link java is /usr/bin/java slave java.1.gz is /usr/share/man/man1/java.1.gz /usr/lib/jvm/java-10-openjdk-amd64/bin/java - priority 1101 slave java.1.gz: /usr/lib/jvm/java-10-openjdk-amd64/man/man1/java.1.gz /usr/lib/jvm/java-11-openjdk-amd64/bin/java - priority 1111 slave java.1.gz: /usr/lib/jvm/java-11-openjdk-amd64/man/man1/java.1.gz /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java - priority 1081 slave java.1.gz: /usr/lib/jvm/java-8-openjdk-amd64/jre/man/man1/java.1.gz /usr/lib/jvm/java-9-openjdk-amd64/bin/java - priority 1091 slave java.1.gz: /usr/lib/jvm/java-9-openjdk-amd64/man/man1/java.1.gz

dtcwee commented 5 years ago

Things to try separately or together:

  1. Run update-alternatives --config java and set java-8 as default java.
  2. Uninstall openjfx (apt remove openjfx) and reinstall it with apt install openjfx --install-suggests.
llucax commented 5 years ago

Still errors:

2019-01-23 20:01:03.390:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
2019-01-23 20:01:03.390:INFO::jetty-6.1.26
2019-01-23 20:01:03.400:INFO::Started SocketConnector@localhost:42117
java.lang.ClassNotFoundException: com.sun.glass.ui.gtk.GtkPlatformFactory
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at com.sun.glass.ui.PlatformFactory.getPlatformFactory(PlatformFactory.java:42)
        at com.sun.glass.ui.Application.run(Application.java:146)
        at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:257)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:211)
        at javafx.embed.swing.JFXPanel.lambda$initFx$44(JFXPanel.java:232)
        at java.lang.Thread.run(Thread.java:748)
Failed to load Glass factory class
Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException
        at com.sun.glass.ui.Application.run(Application.java:146)
        at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:257)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:211)
        at javafx.embed.swing.JFXPanel.lambda$initFx$44(JFXPanel.java:232)
        at java.lang.Thread.run(Thread.java:748)
dtcwee commented 5 years ago

Are you still getting the same error running the .jar manually with the -Dprism.verbose=true flag? (That's pretty much all I got, sorry.)

llucax commented 5 years ago

I get something more. Java8 is still the default but I'm using the full path just in case.

Thanks for trying!

$ /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Dprism.verbose=true -jar 
jstock.jar 
2019-01-25 21:14:29.743:INFO::Logging to STDERR via 
org.mortbay.log.StdErrLog
2019-01-25 21:14:29.744:INFO::jetty-6.1.26
2019-01-25 21:14:29.772:INFO::Started SocketConnector@localhost:35473
Prism pipeline init order: es2 sw 
Using java-based Pisces rasterizer
Using dirty region optimizations
Not using texture mask for primitives
Not forcing power of 2 sizes for textures
Using hardware CLAMP_TO_ZERO mode
Opting in for HiDPI pixel scaling
Prism pipeline name = com.sun.prism.es2.ES2Pipeline
GraphicsPipeline.createPipeline failed for com.sun.prism.es2.ES2Pipeline
java.lang.ClassNotFoundException: com.sun.prism.es2.ES2Pipeline
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at 
com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:187)
        at 
com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:
91)
        at 
com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:
124)
        at java.lang.Thread.run(Thread.java:748)
*** Fallback to Prism SW pipeline
Prism pipeline name = com.sun.prism.sw.SWPipeline
(X) Got class = class com.sun.prism.sw.SWPipeline
Initialized prism pipeline: com.sun.prism.sw.SWPipeline
java.lang.ClassNotFoundException: com.sun.glass.ui.gtk.GtkPlatformFactory
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at 
com.sun.glass.ui.PlatformFactory.getPlatformFactory(PlatformFactory.java:
42)
        at com.sun.glass.ui.Application.run(Application.java:146)
        at 
com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:257)
        at 
com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:211)
        at javafx.embed.swing.JFXPanel.lambda$initFx$44(JFXPanel.java:232)
        at java.lang.Thread.run(Thread.java:748)
Failed to load Glass factory class
Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException
        at com.sun.glass.ui.Application.run(Application.java:146)
        at 
com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:257)
        at 
com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:211)
        at javafx.embed.swing.JFXPanel.lambda$initFx$44(JFXPanel.java:232)
        at java.lang.Thread.run(Thread.java:748)
dtcwee commented 5 years ago

Really sorry we can't get it working because it's quite a nice program when it works and syncs with Android.

evilwordsoup commented 5 years ago

If it helps, I was able to get past this error by setting java-config-2 --set-user-vm [version] after java-config-2 --list-available-vms to ensure my system was indeed using the desired Java version.

I had the same pipeline error and freeze when attempting to open from cloud, and while updating my Java for my OS (Sabayon, Gentoo-based) I noticed You have disabled the javafx flag reported during the installation. Upon following this rabbit hole I found a similar discussion for my OS with the recommendation to use either java-config-2 or eselect to try a different installed version. My default was IcedTea JDK 3.10.0 and switching to Oracle JDK 1.8.0.162 (oracle-jdk-bin-1.8) fixed this for me. I was able to successfully open from cloud, authenticate, and pull my cloud data with no further issues.

The system tray error is still there on launch, but just clicking out of it works. I'm launching Jstock 1.0.7.37 with a simple java -jar jstock.jar or ./jstock.sh.

llucax commented 5 years ago

After following the suggestions from @dtcwee I'm still unable to fix this issue in Debian (testing). I uninstalled all other java versions and reinstalled openjdk-8-jre and openjfx and dependencies and still no luck :man_shrugging:

dtcwee commented 5 years ago

Update: fresh install of Ubuntu, tried to load fresh from cloud: got @llucax 's error above:

java.lang.ClassNotFoundException: com.sun.glass.ui.gtk.GtkPlatformFactory

Copied across my old ~/.jstock folder where somehow I managed to get cloud load working: loads data OK. What this means: Oracle Java might be a dependency. I don't really want to test it because it is such a hassle to install. Possible workaround: Set up open from cloud on Windows and copy the user files into the local ~/.jstock folder.

fallenguru commented 5 years ago

Make sure that the openjfx package is the same version as the jre. By default it'll install the newest version (11), if you want 8, you'll have to force that version in synaptic or something.

dtcwee commented 5 years ago

openjfx 11 and openjre 11 do not work. (openjfx 11.0.2 and openjdk 11). I haven't tried openjfx 8 and openjre 8, but if you'd like to give it a try this is probably the easiest way: sudo apt remove openjfx apt-cache showpkg openjfx Note the version. e.g. 8u161-b12-1ubuntu2 sudo apt install openjfx=version This will also install openjre 8 as a dependency if it is not already installed. Run sudo update-alternatives --config java and set the default. If setting up cloud storage in jstock now works, let us know, and you may want to use apt-mark hold openjfx to stop openjfx from upgrading.

llucax commented 5 years ago

I'm trying this but in Debian bullseye and unstable there is only openjfx version 11:

$ apt-cache policy openjfx
openjfx:
  Installed: 11.0.2+1-1
  Candidate: 11.0.2+1-1
  Version table:
 *** 11.0.2+1-1 990
        990 http://deb.debian.org/debian bullseye/main amd64 Packages
         -1 https://deb.debian.org/debian unstable/main amd64 Packages
        100 /var/lib/dpkg/status
fallenguru commented 5 years ago

Figures. Ubuntu 18.04 LTS is old enough to still have both in the repos ... FWIW, I couldn't get JStock to work properly at all, with any version of OpenJDK. For now, I just downloaded the Oracle JRE, extracted it somewhere suitable in my home directory and changed JAVA_HOME in jstock.sh to point to it. Ugly as sin, but it works.

dtcwee commented 5 years ago

I replicated the workaround by @fallenguru and confirm that it works:

I just downloaded the Oracle JRE, extracted it somewhere suitable in my home directory and changed JAVA_HOME in jstock.sh to point to it.

Tested: Logging into cloud - OK. Tested: Open from cloud - OK. System: Ubuntu 18.04 LTS (ARM64). Oracle jre1.8.0_221 Placing Oracle jre in my home directory allows me to keep using OpenJDK 11 for everything else. Thank you @fallenguru