ScenicView 8.6.0 not finding JavaFX application - java

Currently using JDK 1.8 update 92 (32-bit). Why might ScenicView not be able to find my JavaFX application when launched from the jar, or as a -javaagent: parameter?
If I launch my JavaFX application, and then launch ScenicView from the jar file, it just sits there trying to find something to connect to. I have the -debug option set on the command line and all I get is this :-
Platform running
Launching ScenicView v8.0.0
Startup done
Creating server
Server done
Number of running Java applications found: 0
0 JavaFX applications found
I've tried starting ScenicView both as an "external tool" from IntelliJ (with the correct JVM specified), and just from the command line. Same result.
The -javaagent method does not seem to work either. If I add the jar as a -javaagent parameter to my application, as per the documentation, I just get this error on startup:
Exception in thread "scenic-view-boot" java.lang.IllegalStateException: Toolkit not initialized
at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:273)
at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:268)
at javafx.application.Platform.runLater(Platform.java:83)
at org.scenicview.ScenicView.lambda$premain$34(ScenicView.java:122)
at java.lang.Thread.run(Thread.java:745)
The only method of launching that works is to add the ScenicView jar to my application classpath and embed a launch into my application source like this
ScenicView.show(mainScene);
Which isn't as convenient as being able to just fire it up as a standalone tool when I need it.
This used to work perfectly. I can dig out some older JDK versions and see if it worked with an earlier jvm (update 77 exhibits exactly the same problem), but in the meantime, is there some way of getting more detailed logging out so I can try and find the problem?

It seems that it is bug in ScenicView startup in agent mode. I opened issue and propose PR to fix it.

Related

Why is Java crashing (exit code 134)?

I'm trying to get started with LWJGL 3, but it doesn't even run the sample program. It just crashes the JVM (error code 134, SIGABRT, JVM tries to access memory at address 0).
I've reinstalled Gradle, made sure it uses the right Java version and re-downloaded the LWJGL script, but to no avail.
EDIT: I updated Java to the latest version, but it still doesn't work...
I used the default Java app Gradle config and the sample program (linked above).
The expected behaviour is the app running, opening a window, etc., but instead Java crashes.
Execution failed for task ':run'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/java'' finished with non-zero exit value 134
The sample program uses GWT (Java GUI - graphic interface). It requires xorg server running on Linux (if you are on Linux). See the answer JVM error: Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
I have had this same issue (exit value 134) before, but maybe in a slightly different context: in Android Studio running on a Ubuntu machine. When this happened, I also saw an error log file produced under the ./app folder, named “hs_err_pid[a number].log”. This log file provided more info about the error. However, I still couldn’t figure out a solution by reading the log file.
Since this error does not always happen to me, I’ve tried 2 brute-force methods:
Method #1. Remove the ./build folder
Method #2. In Android Studio, → File → Invalidate Cashes / Restart…
It appears that the error can be avoided by using one of, or a combination of, these 2 methods.
Not sure if its relevant but I faced the same issue while trying to run some introductory code on my Mac. For me the issue seemed to be around library version configurations. I was earlier using these:
project.ext.lwjglVersion = "3.2.3"
project.ext.jomlVersion = "1.10.4"
And later changed it to this (As per the LWJGL library customisation page)
project.ext.lwjglVersion = "3.3.1"
project.ext.jomlVersion = "1.10.4"
Further, I also added the VM option: -XstartOnFirstThread
But that was for a different error only as far as I understand.

Container did not start during docker stack deploy, could not find or load main class, unable to diagnose further

I am helping on a project which consists of a Docker stack with a bunch of services all working together. All of them start except for one.
Using docker service ps my-service --no-trunc gives me: task: non-zero exit(1)
Using docker service logs my-service gives me: Error: could not find or load main class
This particular container has a Java application running in support of a NodeJS server. After npm install, npm run init, npm run build, and mvn clean install, I was able to successfully build the Docker image. No errors.
However, now it's not actually starting. I can't figure out how to diagnose it any further. The error message doesn't tell me a whole lot. The Java code is old, but it should work, I never touched it.
Mainly, I don't know where to progress from here. Google searches turn up only stuff where they have access to a lot more debugging information, and I just don't have enough to go on. Java is not my strength. What am I missing?
UPDATE 3/21/19: Thanks to #VinDev, I was able to get some more detailed information (it should've been obvious to me to try this, but it's good to learn).
Used docker run --name TestMyContainer -it my-image bash to start up the container, then ran the normal starting command for the container in the stack, which is catalina.sh run. That gave me the following output:
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /docker-java-home/jre
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Error: Could not find or load main class
UPDATE #2 3/21/19: I was able to solve the issue. I should've included more information: I'm on a Windows machine, but making Linux containers. I found the answer here: Tomcat startup - Error: Could not find or load main class
Windows had reverted the setenv.sh file to CRLF EOL. I changed it back in Visual Studio Code, ran the container again, and everything works!
Run docker service ls to see if the service shows up ...
also run docker service inspect my-service
This should give you a container id you can use to get the logs
docker logs CONTAINER_ID
You can also run the container by itself
docker run IMAGE_NAME
to see the result of just running it as a container
/usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Seems it can't find bootstrap.jar or tomcat-juli.jar
Maybe not being copied by Dockerfile?
I added this to the original post, but adding it here as well to properly mark the question as answered:
I was able to solve the issue. I should've included more information: I'm on a Windows machine, but making Linux containers. I found the answer here: Tomcat startup - Error: Could not find or load main class
Windows had reverted the setenv.sh file to CRLF EOL. I changed it back in Visual Studio Code, ran the container again, and everything works!

Deploy JavaFX on Ubuntu server without display

I'm developing a JavaFX application using jdk1.7.0_51 on Mac OS X (10.9.1) in Netbeans. I can run it without a problem and after a clean build I can also launch the jar from the dist/ folder.
Now I want to deploy this on a 64 bit Ubuntu 13.04 server. I've had a lot of issues doing this but have finally set up the server to have the correct JRE, fonts and libraries. Running the jar resulted in errors going way deeper than my code (going to UnsatisfiedLinks to native libraries where MACOS was mentioned) so I figured it would be best to package my app on Ubuntu itself. I ended up installing NetBeans to make a new (native) JavaFX project and uploaded the src/ and lib/ folders from my machine using sftp. Running the code through the reconstructed project in NetBeans works fine, though I get a warning in the console during run:
libGL error: failed to load driver: swrast
libGL error: Try again with LIBGL_DEBUG=verbose for more details.
Prism-ES2 Error : GL_VERSION (major.minor) = 1.4
Regardless, the application DOES run. After a clean build, I can similarly run the jar from the dist/ folder. The same warning appears in the terminal but then the application launches.
However, if I ssh to the server without the -X flag and try to run the application, I get the following:
Failed in XOpenDisplay
(java:29341): Gtk-WARNING **: cannot open display:
However, my application does not have a UI. It simply uses JavaFX for the WebEngine (this is required and can not be changed). I was wondering if anyone knows if (and if so, how) it's possible to launch my JavaFX jar without a display (to just run as a daemon on the server).
Kind regards,
Warkst
EDIT:
I've tried some things described here: Java Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable
You need to specify the -Djava.awt.headless=true parameter at startup time.
(Assuming I'm doing it right with the command java -Djava.awt.headless=true -jar MyApp.jar), this yielded no results (the same errors occur).
export DISPLAY=:0
Still no result, though the error obviously changed slightly to now read:
(java:30765): Gtk-WARNING **: cannot open display: :0
Then finally I also tried the following:
unset DISPLAY
This resulted in the original error (where obviously DISPLAY was not set).
I don't think JavaFX 2.x supports running in a headless mode. I don't know of any workaround.
For further info see the JavaFX issue tracker feature request: RT-34241 Use of WebEngine in a headless system, currently scheduled for implementation for Java 9.
I had almost the same problem
Failed in XOpenDisplay
(java:2593): Gtk-WARNING **: cannot open display:
while running unit tests for my JavaFX application in headless Ubuntu docker container on Travis CI.
The solution is installing X Virtual Framebuffer (xvfb) in the container to imitate a display presents via the container configuration change in .travis.yml
before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 3 # give xvfb some time to start
This allows JavaFX successfully initialize it's core and create JavaFX components without actually showing them on screen.
See details of this solution in article Using xvfb to Run Tests That Require a GUI
Running dbus-update-activation-environment --systemd DISPLAY XAUTHORITY in that shell before launching the UI app fixed this issue for me.

Internal error in eclipse when running java program

Eclipse froze on me earlier today, so I typed "top" into the command prompt and killed it. Now when I try to run a java application, I get this error:
eclipse\plugins\org.eclipse.jdt.debug_3.7.0.v20110509
That's all that shows up under details.
None of my previously working programs run, and I have no clue what this is. I have Eclipse 1.5.0 running 1.6 and 1.7 Java, depending on what program. Thanks for any help.
It is possible that you killed part of the process but not all of it. It is possible that a java process is running with a reference to this job. I would try restarting your computer to see if it will stop whatever process is referencing that jar.
Aside from a restart, then another option would be to use (in linux) pstree, filtered for your user to see if any other jobs are referencing that jar and/or java.
EDIT:
Another path is to look at log files. On linux they are in /var/log. Here's a link in that direction: http://docs.oracle.com/javase/7/docs/webnotes/tsg/TSG-Desktop/html/felog.html

Java is not working in my PC

I had installed Java in my PC and it was working perfectly. Suddenly something went wrong and now I m not able to open swing applications and its showing the error 'Java not found'. But I can run the Eclipse IDE which also needed Java to run. So I decide to reinstall the Java, but when I tried to uninstall the Java it shows the Error 1723 - There is a problem with this Windows Installer Package. So I have installed a new JDK in another location and set the PATH. Still I am not able to run the Swing application.
Can anybody help me on this?
How are you running your swing application?
If it's from the command line like java mySwingApp and you're getting java not found then your PATH isn't set properly. Make sure that the java/bin directory is on your PATH not just the top level directory. You can test your PATH by just typing java in a console window - it should print the java help page.
If you're not running from a terminal like above, then you may need to set a JAVA_HOME environment variable which points to your java installation folder. Here's a tutorial on setting JAVA_HOME
Setting JAVA_HOME
Hope this helps,
Will
This is close to jakob's answer, about trying to get your Java install setup correctly again, just with a little more detail.
I had a similar problem on my Windows 7 box where I was trying to uninstall Java and do a clean install of a newer version. Something got messed up and I would get the 1723 error message during the uninstall and attempted reinstall. Here's information about how I was able to fix the problem, and maybe this will help you:
Look at the log files for the uninstall/reinstall. On Windows 7 they can be found at c:\users\username\AppData\Local\Temp\
The java_install.logdidn't show any extra information, but I had several MSI##### log files that contained error messages about the failed uninstall. The message was: Error 1723.There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor. Action UninstallJRE, entry: MSIUninstallJRE, library: C:\Program Files\Java\jre6\bin\regutils.dll
There was indeed no regutils.dll file, and not even the bindirectory was there. So I copied over a regutils.dll file from another computer, ran the uninstaller, and it worked. Then the new clean install of Java also worked.
So take a look at your logfiles and hopefully that will give you more detailed information about the 1723 error.
This usally happens when you delete Java files manually.
If you try to uninstall Java and it fails, it generates a log file.
Should be in C:\Users[Username]\AppData\Local\Temp
Almost at the end the missing file(s) can be found.
Try to copy that file(s) from a working installation to your computer.
Then you should be able to uninstall your Java and install a new version.

Categories

Resources