I built a simple app using WebView/WebEngine using Gluon Mobile but the WebView fails with a unsatisfiedlink error. It works fine with gluonfx:run and so I then ran gluonfx:runagent to get all the reflection stuff etc. I then run gluonfx:build but the app fails on gluonfx:nativerun. I have a simple fxml starting with <View fx:id="web"...> (with controller being WebPresenter) and containing a containing a <VBox...> containing a <WebView fx:id="wv"...>. The code is:
public class WebPresenter {
#FXML View web;
#FXML WebView wv;
public void initialize() {
WebEngine we = wv.getEngine();
we.loadContent("<html><body><h1>WebEngine!</h1></body></html>");
}
}
I run the build with NetBeans on Ubuntu 20.04 64bit, JavaFX v17.0.2, Charm v6.1.0, Java 17, graalvm-svm-java17-linux-gluon-22.0.0.3-Final. The reflect-json seems to have all the Web stuff necessary: com.sun.javafx.fxml.builder.web.WebViewBuilder, javafx.scene.web.WebView and WebPresenter.
The error occurs at load from the fxml <WebView...> and culminates in:
Caused by: java.lang.UnsatisfiedLinkError: com.sun.webkit.WebPage.twkInitWebCore(ZZZ)V [symbol: Java_com_sun_webkit_WebPage_twkInitWebCore or Java_com_sun_webkit_WebPage_twkInitWebCore__ZZZ]
:
at javafx.scene.web.WebView.<init>(WebView.java:275)
at com.sun.javafx.fxml.builder.web.WebViewBuilder.build(WebViewBuilder.java:66)
I had WebView/WebEngine working under slightly earlier versions (GraalVM11 and javafx-web 17.0.0.1). Am I missing something here?
Related
I'm trying to migrate my old Visual Studio extension to the new 2022 Studio. Found some fancy solution named 'Community Visual Studio Toolkit', but got some issues. When I use the ProvideAutoLoad attribute for loading my extension when a user opens some solution, I can't get access to the WindowEvents which I need to sign my event handlers. This is the error on debugging: https://snipboard.io/yUXIed.jpg
So this is the code I use, and here I have the error:
[ProvideAutoLoad(UIContextGuids80.NoSolution, PackageAutoLoadFlags.BackgroundLoad)]
public sealed class MyPackage : ToolkitPackage
{
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress)
{
await this.RegisterCommandsAsync();
VS.Events.WindowEvents.ActiveFrameChanged += WindowEvents_ActiveFrameChanged;
}
}
And the thing is my old implementation works with this code:
[ProvideAutoLoad(UIContextGuids80.NoSolution, PackageAutoLoadFlags.BackgroundLoad)]
public sealed class MyPackage : ToolkitPackage
{
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress)
{
await this.RegisterCommandsAsync();
// Getting `DTE2 dte` trough standard way...
dte.Events.WindowEvents.WindowActivated += WindowEvents_WindowActivated;
}
}
But I don't want to use old kinds of code in the new extension version, so, how to fix this issue in first example of implementation?
Well, I'm not sure about the "perfection" of this solution, but with this line of code added before access to the events - it works.
await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
Seems like you have to be in main thread to access these events.
I created a Windows Service starting from my .NET Core project following this
After this, I installed correctly it on my working machine and started it.
This is my service class:
using System;
using System.Diagnostics;
using System.ServiceProcess;
using System.Threading.Tasks;
namespace xxx
{
public class WindowsService
{
static void Main(string[] args)
{
System.IO.Directory.SetCurrentDirectory(System.AppDomain.CurrentDomain.BaseDirectory);
using (var service = new Service())
{
ServiceBase.Run(service);
}
}
}
internal class Service : ServiceBase
{
public Service()
{
ServiceName = "...";
}
protected override void OnStart(string[] args)
{
try
{
base.OnStart(args);
Task.Run(() => xxxx);
}
catch (Exception ex)
{
EventLog.WriteEntry("Application", ex.ToString(), EventLogEntryType.Error);
}
}
protected override void OnStop()
{
base.OnStop();
}
protected override void OnPause()
{
base.OnPause();
}
}
}
So, I copied the file and installed it also on a server. Here, when I try to start it, I get:
After this, I start a lot of googling... for example, I tried the following steps :
Go to Start > Run > and type regedit
Navigate to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
With the control folder selected, right click in the pane on the right and - select new DWORD Value
Name the new DWORD: ServicesPipeTimeout
Right-click ServicesPipeTimeout, and then click Modify
Click Decimal, type '180000', and then click OK
Restart the computer
The weird point here is that the voice ServicesPipeTimeout didn't exist and I created it. Comparing the server with my working machine, there are also other value not present in the server. They are:
ServicesPipeTimeout
OsBootstatPath
Here the screenshot of regedit from the server:
Are these relevant?
I also tried to reinstall the service, recompile my files... how can I fix this problem? The error appears immediatly, it doesn't wait any timeout!
I had this problem when I switched my project to another location.
When I moved the project, I had copied the files in bin/debug folder too. The issue was resolved after I cleared the debug folder and created a new build.
See if this works!
It's a bit old question but someone may find this useful.
So I had the following code in Program.cs:
builder.SetBasePath(Environment.CurrentDirectory).AddJsonFile("appsettings.json")
Changed it to:
builder.SetBasePath(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)).AddJsonFile("appsettings.json")
This seemed to fix the problem for me.
The problem with this error is that it is super generic.
Hopefully MS will give us some log in the future.
if you check the windows event viewer under applications it tells you what exactly is the exception that causes this error.
in my case the problem was i published the service in net6 and tried to run it on a pc with net7 installed. apparently it requires the exact major version that was used to publish the app.
I´d like to get Java 11 and JavaFX 11 running on a Raspberry Pi 3.
I followed the instructions given by Gluon here: http://docs.gluonhq.com/embedded/
(only differences: I´m running a full Stretch image, not Lite and meanwhile BellSoft released Liberica JDK version 11.0.1 also for ARM, so I used that.)
My application is super simple: a label and a button, when the button is pressed then an mp3 shall be played:
public class HelloFX extends Application
{
#Override
public void start(Stage stage) {
String version = System.getProperty("java.version");
String fxVersion = System.getProperty("javafx.runtime.version");
Label l = new Label ("Java version: " + version + "\nJavaFX version: " + fxVersion);
Button b = new Button("play");
Scene scene = new Scene(new VBox(l, b), 350, 200);
b.setOnAction(
new EventHandler<ActionEvent>() {
#Override
public void handle(ActionEvent event) {
PlayMp3();
}
});
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch();
}
Media media;
void PlayMp3()
{
String resource = "/resources/sound.mp3";
media = new Media(getClass().getResource(resource).toURI().toURL().toString());
MediaPlayer mp = new MediaPlayer(media);
mp.play();
}
On Windows / Eclipse this runs and plays the mp3. On the Raspberry Pi I can execute the application with this command:
sudo /opt/jdk-11.0.1/bin/java --module-path=/opt/armv6hf-sdk/lib/ --add-modules javafx.graphics,javafx.media -cp /home/pi/Java/HelloFX/ -Dprism.verbose=true -Dembedded=monocle -Dglass.platform=Monocle javafx11.HelloFX
The graphics is visible on the display but when I press the button then I get the following exception:
Exception in thread "JavaFX Application Thread" java.lang.UnsatisfiedLinkError: no jfxmedia in java.library.path: [/usr/java/packages/lib, /lib, /usr/lib]
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2660)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:829)
at java.base/java.lang.System.loadLibrary(System.java:1867)
at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:150)
at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:62)
at javafx.media/com.sun.media.jfxmediaimpl.NativeMediaManager.lambda$new$0(NativeMediaManager.java:136)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.media/com.sun.media.jfxmediaimpl.NativeMediaManager.<init>(NativeMediaManager.java:107)
at javafx.media/com.sun.media.jfxmediaimpl.NativeMediaManager$NativeMediaManagerInitializer.<clinit>(NativeMediaManager.java:78)
at javafx.media/com.sun.media.jfxmediaimpl.NativeMediaManager.getDefaultInstance(NativeMediaManager.java:90)
at javafx.media/com.sun.media.jfxmedia.MediaManager.canPlayProtocol(MediaManager.java:78)
at javafx.media/com.sun.media.jfxmedia.locator.Locator.<init>(Locator.java:239)
at javafx.media/javafx.scene.media.Media.<init>(Media.java:393)
at javafx11.HelloFX.PlayMp3(HelloFX.java:62)
I found some posts saying that this error message means that Java is looking for a library called "libjfxmedia.so" but I can´t find that file anywhere.
Did I make any mistake or miss anything?
Do I need to change something in the java command to execute the application? (I´m unsure about the --add-modules parameter, it runs the same without this option...)
Is it possible that JavaFX 11 still does not support Media on the Raspberry Pi (I read that v8 also provided by Gluon didn´t)? Whom to ask if it will be supported in the near future?
What José Pereda wrote is correct, javafx.media was not included and it also didn´t get included in 11 release.
But things changed meanwhile, BellSoft recently released their Liberica package (Java including JavaFX) in version 14.0.1 where playing mp3s now works:
https://bell-sw.com/pages/downloads/?version=java-14&release=14.0.1+8&os=Linux&bitness=32-bit&architecture=ARM&package=jdk-full
There are still some minor bugs (e. g. mp3 file names must not contain spaces, the length of any mp3 is always infinite) but the basics are working, it even allows to play videos, just see their blog:
https://bell-sw.com/announcements/2019/09/12/JDK-JavaFX-Video-Preview/
Please make sure to really use the 14.0.1 and not the first 14 release because several fixes esp. for the Raspberry Pi have been implemented there.
Thanks to the BellSoft team for their great work here!!
In reference to this bug from Sonar:
http://jira.codehaus.org/browse/SONAR-1865
and this one (which cross references the one above):
http://jira.codehaus.org/browse/SONAR-1637
I am still seeing this issue.
I am using Sonar server version 2.12.
I am using Hudson, version 2.2.0.
I have installed the Sonar plugin in Hudson, version 1.7.2.
and, most importantly, I have the Flex plugin installed in the Sonar server. Flex plugin version is 0.4.
When I run mvn sonar:sonar -Pflex on a flex project, i get this error in the stack trace:
Caused by: java.lang.IllegalArgumentException: Java inner classes are not supported : EntityEnums$ReportParameterName
at org.sonar.plugins.flex.FlexFile.<init>(FlexFile.java:79)
at org.sonar.plugins.flex.FlexFile.fromIOFile(FlexFile.java:165)
at org.sonar.plugins.flex.FlexSourceImporter.createResource(FlexSourceImporter.java:37)
at org.sonar.api.batch.AbstractSourceImporter.parseDirs(AbstractSourceImporter.java:75)
at org.sonar.api.batch.AbstractSourceImporter.analyse(AbstractSourceImporter.java:69)
at org.sonar.api.batch.AbstractSourceImporter.analyse(AbstractSourceImporter.java:60)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:64)
Here is what my class looks like, that it is complaining about:
This is an Actionscript class, file name: EntityEnums$ReportParameterName.as. It was auto-generated from java to Actionscript using GraniteDS.
package com.digabit.core.db.entity.util {
[Bindable]
public class EntityEnums$ReportParameterName {
public static const tnid:String = "tnid";
public static const uname:String = "uname";
public static const lc:String = "lc";
public static const tnkey:String = "tnkey";
public static const oid:String = "oid";
public function EntityEnums$ReportParameterName()
{
super();
}
}
}
So, according the bug reports, this has been fixed in an earlier version of Sonar that I have; but I'm still seeing it in version 2.12. And why would the error show "java inner classes..." when this is a flex/actionscript class? Is anyone still seeing this bug behavior?
Issue has been created on Sonar Flex Plugin side ( http://jira.codehaus.org/browse/SONARPLUGINS-1623 ) and most probably would be fixed in next release.
This is a puzzler.
Relevant Environment: Flex app, running parsley, which gets built by ant.
Problem class:
package com.foo.bar {
public class ProblemClass {
// constructor
public ProblemClass(enforcer:Enforcer) {}
public static function build():ProblemClass {
// Do some setup
return new ProblemClass(new Enforcer())
}
}
// internal private class
class Enforcer() {}
Elsewhere, in a seperate class (which gets defined in a Parsley context):
package com.foo.bar {
public class ProblemClassBuilder {
[Factory]
public function getProblem():ProblemClass {
return ProblemClass.build();
}
}
}
Here's the kicker:
When I compile this from an ant task with debug="true", it works fine. When I compile it with debug="false", parsley throws an error while building the context:
Error applying [object
FactoryMethodDecorator]: Error #1065:
Variable Enforcer is not defined.
No other code changes, except turning debug on / off in the mxmlc ant task.
Has anyone seen similar problems with internal classes & ant debug compile modes?
I've been able to fix the issue, (by removing the internal class), but don't understand why it didn't work in the first place.
Sounds like a bug in the compiler... I'd file it at bugs.adobe.com
you are only allowed one class definition per actionscript file, otherwise you have to use the internal keyword so it should be private internal class Enforcer()