JavaFX deployment: Failed to launch JVM - javafx

Greetings
I have deployed a simple JavaFX application using msi installer that was created by jpackage. When double-clicking on the application icon installed in Windows 10 "program files" directory, it displays an error "Failed to launch JVM". Prior to deployment, I tested the application jar file from the command prompt without any problem. When checking the application installation directory (under "C:\Program files") it has all the runtime dlls and so on, so I am not sure what causes this error? Here is the japckage command I used to build the runtime image:
jpackage --type msi --name FileChooser -p "%JAVAFX_HOME%\lib;%M2_REPO%;org\openjfx\mavenfxfilechooser\mavenfxfilechooser.jar" --module "org.openjfx.mavenfxfilechooser/org.openjfx.mavenfxfilechooser.FileChooserApp"
Update
Following the recommendation given in the comment section, I installed the JMODS on my machine and issued a jpackage command line to point to the JMODS files instead of JAVAFX_HOME as follow:
jpackage --type msi --name FileChooser -p "%JMODS_HOME%;%M2_REPO%;C:\Users\hrh74\Downloads\Lib\file\org\openjfx\mavenfxfilechooser" --module "org.openjfx.mavenfxfilechooser/org.openjfx.mavenfxfilechooser.FileChooserApp"
I installed the application using the MSI runtime image and this certainly solved the" Failed to launch JVM" problem. The application started, however, I have a WebView component that should display content from https://us.yahoo.com when the user clicks on a "Yahoo" button and this doesn't seem to be working when the application run as a self-contained app but it works when I run the jar file from the command line. Do I need to add anything to the jpackage?
Please let me know if the source code and FXML file are needed.
Thanks

Your original problem has to do with missing native code. But you appear to have already solved that problem by using the JMOD files for JavaFX provided by Gluon. So I'll try to help solve your other issue regarding https://us.yahoo.com not loading in the WebView once you create a self-contained application.
When trying to load that website myself I was running into the same issue as you. Though sometimes I'd get a "we're working on the problem" page response, other times the entire application would become unresponsive, and yet other times nothing would happen (the load would just seem to fail "gracefully"). This happened with other websites as well, not just Yahoo. After some testing I was finally able to get the following error:
java.lang.Throwable: SSL handshake failed
at javafx.web/javafx.scene.web.WebEngine$LoadWorker.describeError(Unknown Source)
at javafx.web/javafx.scene.web.WebEngine$LoadWorker.dispatchLoadEvent(Unknown Source)
at javafx.web/javafx.scene.web.WebEngine$PageLoadListener.dispatchLoadEvent(Unknown Source)
at javafx.web/com.sun.webkit.WebPage.fireLoadEvent(Unknown Source)
at javafx.web/com.sun.webkit.WebPage.fwkFireLoadEvent(Unknown Source)
at javafx.web/com.sun.webkit.network.URLLoaderBase.twkDidFail(Native Method)
at javafx.web/com.sun.webkit.network.HTTP2Loader.notifyDidFail(Unknown Source)
at javafx.web/com.sun.webkit.network.HTTP2Loader.lambda$didFail$18(Unknown Source)
at javafx.web/com.sun.webkit.network.HTTP2Loader.lambda$callBackIfNotCanceled$10(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
That indicated to me the application created by jpackage was missing some crypto libraries. From here I just guessed, but inclulding:
--add-modules jdk.crypto.cryptoki,jdk.crypto.ec
When running jpackage seemed to solve the problem. I don't know if both modules are needed, or if only one is needed (or if adding either one implicitly adds the other).
Side note: When scrolling through https://us.yahoo.com I would frequently get the following warnings:
Mar 05, 2021 12:10:40 PM com.sun.javafx.webkit.prism.WCMediaPlayerImpl onError
WARNING: onError, errCode=0, msg=Could not create player!
And:
Mar 05, 2021 12:10:41 PM com.sun.javafx.webkit.prism.WCMediaPlayerImpl$CreateThread run
WARNING: CreateThread ERROR: java.lang.UnsupportedOperationException: Unsupported protocol "data"
I would get that warning regardless of how the application was packaged. I don't know how to solve the problem, or if there even is a solution without modifying the JavaFX code itself.

Have you seen running JavaFX application after jpackage? Try to download Gluon jmods and use it instead of %JAVAFX_HOME%

Related

Issues running CAMEL JAR file built in windows using Eclipse when run in Linux command line using JAVA or MVN command

I have built a Camel project in Eclipse with Maven dependencies.
It ran successfully and also Built the Jar file and ran it from the command prompt
which is running as required. But when I moved the JAR file onto to our Linux machine
which is like a Job Manager server and when I try to run the JAR file as below
I am getting the below error message.
When I try to run with the below command
$ java –jar mycamelproject
I am getting the below error, but I do have the below mentioned dependency in the Dependency-Jars folder.
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/c
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
at java.lang.Class.getMethod0(Class.java:2774)
at java.lang.Class.getMethod(Class.java:1663)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: org.springframework.context.support
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 6 more
Then I tried running with the below command.
$ mvn -X exec:java -Dexec.mainClass=mycamelpackage.mycamelmainclass
I am getting a series of the below errors such as below
[DEBUG] Could not find metadata org.codehaus.mojo/maven-metadata.xml in local (/home/ec2-user/.m2/repository)
[DEBUG] Skipped remote update check for org.codehaus.mojo/maven-metadata.xml, already updated during this session.
[WARNING] Failure to transfer org.codehaus.mojo/maven-metadata.xml from
http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (http://repo.maven.apache.org/maven2): proxy.host.net
[ERROR] No plugin found for prefix 'exec' in the current project
and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo]
available from the repositories
How should java –jar mycamelproject work if no classpath is set? And mycamelproject should be a JAR file anyway (and if it is, you should add the *.jar extension).
Beside that, I guess your local Maven repository may be corrupt. That's usually the reason why you see the resolution will not be reattempted error message. The easiest way to fix this is to remove the corrupt directories and start Maven again.

I Cannot run jar file in kubuntu terminal

I thinks it is some problems in my java installation but i don't know what is the problem and how can i fix it
I can run jar file with openjdk in visual mode but in terminal i cannot run jar files
for example you can see this below
root#mohammad-Inspiron-1564:/media/storage/Linux/Freedom# java -jar freedom.jar
No protocol specified
No protocol specified
Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:65)
at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:110)
at java.security.AccessController.doPrivileged(Native Method)
at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:74)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:102)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:81)
at java.awt.Window.initGC(Window.java:466)
at java.awt.Window.init(Window.java:486)
at java.awt.Window.<init>(Window.java:535)
at java.awt.Frame.<init>(Frame.java:420)
at javax.swing.JFrame.<init>(JFrame.java:218)
at de.resolution.emsgui.LanguageSelector.showButtonGrid(LanguageSelector.java:27)
at de.resolution.emsgui.LanguageSelector.<init>(LanguageSelector.java:19)
at emsgui.main(emsgui.java:46)
perhaps i should re-install mu kubuntu :((
thnx
Mohammad
The error message tells you that it cannot connect to the X11 window server. The program in the JAR file uses Swing and needs some way to display the GUI it creates. If you have X11 installed, you can start it from the command-line by typing startx. Otherwise you need to install it or some other system that will allow you to run a Swing-based program.

Having trouble running a custom jar on Amazon AWS

I'm having trouble running a custom jar on Elastic Map-Reduce
I'm using jdk1.6.0_26, Hadoop 0.20.205, and compiling with Eclipse on my computer and everything works perfectly fine
for example if I ran the following on my computer it would be successful
hadoop jar MaxTemperature.jar input/temperature.txt output
I specified the jar as the following on AWS
s3n://chrishadoop/MaxTemperature.jar
and I specified the arguments as
s3n://chrishadoop/input/temperature.txt s3n://chrishadoop/output
I did not specify the main class because I pointed to it in the manifest
Here is the jar I'm using, I will make it public for a little while
https://s3.amazonaws.com/chrishadoop/MaxTemperature.jar
Here is the error I'm getting
2012-07-08 19:31:39,824 INFO com.amazonaws.elasticmapreduce.statepusher.StatePusher (main): Pusher awoke, starting to push data into simpledb...
2012-07-08 19:31:40,552 FATAL com.amazonaws.elasticmapreduce.statepusher.StatePusher (main): Fatal Exception raised while extracting data from hadoop and pushing to simpledb
java.lang.NoClassDefFoundError: org/codehaus/jackson/map/JsonMappingException
at com.amazonaws.elasticmapreduce.statepusher.StatePusher.run(StatePusher.java:65)
at com.amazonaws.elasticmapreduce.statepusher.StatePusher.main(StatePusher.java:205)
Caused by: java.lang.ClassNotFoundException: org.codehaus.jackson.map.JsonMappingException
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 2 more
There is a version of Jackson which is installed as part of the AMI, and I'm guessing you're bundling a different version of Jackson? The error seems to be happening in the support code which makes "enable debugging" work.

Netbeans Project Deployment Error

My Netbeans is just freaking out. 20 minutes ago it worked fine, but now it is not. I did recall all changes but it is not working.
Initializing...
deploy?DEFAULT=C:\Users\TheIntersect\Documents\NetBeansProjects\webWord\build\web&name=webWord&force=true failed on GlassFish Server 3.1
Error occurred during deployment: Exception while preparing the app : Error in generating security policy for webWord -- Error in generating security policy for webWord -- Unable to open Policy file: C:\Users\TheIntersect\.netbeans\7.0\config\GF3\domain1/generated/policy\webWord/webWord\granted.policy. Please see server.log for more details.
C:\Users\TheIntersect\Documents\NetBeansProjects\webWord\nbproject\build-impl.xml:736:
The module has not been deployed.
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:187)
at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:106)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:284)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:539)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:154)
Don't think this is still actual, but still may help someone else.
try to manualy copy granted.policy file into glassfish appropriate directory
(PATH_TO_GF\glassfish-3.1\glassfish\domains\<domain_name>\generated\policy\app_name\app_name>\).
If you don't have that file anywhere, just create it with following content
grant {
permission javax.security.jacc.WebResourcePermission "/";
permission javax.security.jacc.WebUserDataPermission "/";
};
I just reainstall the Netbeans IDE and it solverd. But while you are deleting netbeans you should delete all files related about netbeans except project files.

StackOverflowError while Refactoring

I'm trying to refactor a package name (pretty near the root of the project hierarchy), and I'm getting the following error (flash builder 4):
A fatal error occurred while performing the refactoring
An unexpected exception occurred while creating a change object. See the error log for more details.
The log file looks like this....
!ENTRY org.eclipse.ltk.ui.refactoring 4 10000 2010-09-30 10:57:25.134
!MESSAGE Internal Error
!STACK 0
java.lang.reflect.InvocationTargetException
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:421)
at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.run(RefactoringWizardDialog2.java:330)
at org.eclipse.ltk.ui.refactoring.RefactoringWizard.createChange(RefactoringWizard.java:583)
at org.eclipse.ltk.ui.refactoring.RefactoringWizard.computeUserInputSuccessorPage(RefactoringWizard.java:422)
at org.eclipse.ltk.ui.refactoring.UserInputWizardPage.computeSuccessorPage(UserInputWizardPage.java:74)
at org.eclipse.ltk.ui.refactoring.UserInputWizardPage.getNextPage(UserInputWizardPage.java:114)
at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.nextOrPreviewPressed(RefactoringWizardDialog2.java:495)
at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.access$2(RefactoringWizardDialog2.java:492)
at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2$1.widgetSelected(RefactoringWizardDialog2.java:691)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:228)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3880)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3473)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation$1.run(RefactoringWizardOpenOperation.java:143)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:155)
at com.adobe.flexbuilder.as.editor.ui.navigator.FlexPackageExplorerRenameAction.renamePackage(FlexPackageExplorerRenameAction.java:171)
at com.adobe.flexbuilder.as.editor.ui.navigator.FlexPackageExplorerRenameAction.run(FlexPackageExplorerRenameAction.java:143)
at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:168)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3880)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3473)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at com.adobe.flexbuilder.standalone.FlexBuilderApplication.start(FlexBuilderApplication.java:109)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
Caused by: java.lang.StackOverflowError
at com.adobe.flexbuilder.codemodel.mxml.MXMLData$2.getMXMLVersion(MXMLData.java:501)
<-- snipped 1022 additional identical lines..-->
at com.adobe.flexbuilder.codemodel.mxml.MXMLData$2.getMXMLVersion(MXMLData.java:501)
Root exception:
java.lang.StackOverflowError
at com.adobe.flexbuilder.codemodel.mxml.MXMLData$2.getMXMLVersion(MXMLData.java:501)
<-- snipped 1022 additional identical lines..-->
at com.adobe.flexbuilder.codemodel.mxml.MXMLData$2.getMXMLVersion(MXMLData.java:501)
Any ideas what is wrong...and what I can do to fix it ? I queried google for it, and didn't turn up anything useful with the parameters I tried.
You can try to Restart Eclipse. Oddly that fixes a number of issues in Eclipse that happen all of a sudden with no normal explanation.
Increase the thread size of the JVM you run your IDE in?
I believe in Eclipse you could do it by adding -Xss with some value to eclipse.ini within your Eclipse installation. The setting is a JVM setting so should be added in the -vmargs section, it might be next to -Xmx which is there by default.
This may not be the best answer, but..I recommend you to try a different IDE like IntelliJ.
I've used Flash Builder before. It had always gave me problem. Usually it's because plug-in incompatible. Running tomcat in it sometimes gives me this "undead" java process that just won't die.
I'm using IntelliJ 9 now. It's autocomplete is less complete than Flash Builder, but it has a much better refactoring feature and..much MUCH better integration with other tools (like Maven).

Resources