Giter VIP home page Giter VIP logo

Comments (24)

bjonnh avatar bjonnh commented on June 30, 2024

In the dev branch, I updated the fx-demo/build.gradle.kts

with

application {
    mainClassName = "space.kscience.plotly.fx.PlotlyFXAppKt"
}

as you changed the names, and changed the javafx version to 15, but it behaves exactly the same.

from plotly.kt.

altavir avatar altavir commented on June 30, 2024

I just tried it from the latest dev build (and thank you, I had to fix entry points): e3f8978. It is working as expected. Could you try the dev build (clone and gradlew :fx-demo:run). Maybe JS bundle deploy failed in intermediate versions. I tshould work fin in the new release.

I am also thinking about moving to CEF implementation and Compose-Desktop. But I do not have time for it right now.

from plotly.kt.

bjonnh avatar bjonnh commented on June 30, 2024

I tried the dev build it does exactly the same thing. I think all the back end works properly, it is really something in webview that is not working. What Java/JavaFX version and platform are you using?

I'm surprised webview works with all the websites I tested but fails with this. And other browsers have absolutely no issue displaying it.

I may try compose-desktop but that would mean porting all of my application from JavaFX to that (not that it is big)…

from plotly.kt.

bjonnh avatar bjonnh commented on June 30, 2024

Interestingly it works with Java11…
The 11 and 15 are from the same source (ArchLinux packages).

from plotly.kt.

altavir avatar altavir commented on June 30, 2024

I've reproduced the problem on liberica-15. I'll look into it.

from plotly.kt.

altavir avatar altavir commented on June 30, 2024

Interesting. It seems to be a Ktor bug.

17:24:26.967 [DefaultDispatcher-worker-2 @request-handler#28] ERROR ktor.application - Unhandled: GET - /
java.lang.NullPointerException: jarEntry must not be null
	at io.ktor.http.content.JarFileContent.<init>(JarFileContent.kt:41)
	at io.ktor.http.content.StaticContentResolutionKt.resourceClasspathResource(StaticContentResolution.kt:62)
	at io.ktor.http.content.StaticContentResolutionKt.resolveResource(StaticContentResolution.kt:38)
	at io.ktor.http.content.StaticContentResolutionKt.resolveResource$default(StaticContentResolution.kt:24)
	at io.ktor.http.content.StaticContentKt$resources$1.invokeSuspend(StaticContent.kt:230)
	at io.ktor.http.content.StaticContentKt$resources$1.invoke(StaticContent.kt)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:246)
	at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:116)
	at io.ktor.util.pipeline.SuspendFunctionGun.execute(SuspendFunctionGun.kt:136)
	at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:79)
	at io.ktor.routing.Routing.executeResult(Routing.kt:155)
	at io.ktor.routing.Routing.interceptor(Routing.kt:39)
	at io.ktor.routing.Routing$Feature$install$1.invokeSuspend(Routing.kt:107)
	at io.ktor.routing.Routing$Feature$install$1.invoke(Routing.kt)
	at io.ktor.util.pipeline.DebugPipelineContext.proceedLoop(DebugPipelineContext.kt:82)
	at io.ktor.util.pipeline.DebugPipelineContext.proceed(DebugPipelineContext.kt:60)
	at io.ktor.util.pipeline.DebugPipelineContext.execute(DebugPipelineContext.kt:66)
	at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:79)
	at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invokeSuspend(DefaultEnginePipeline.kt:124)
	at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invoke(DefaultEnginePipeline.kt)
	at io.ktor.util.pipeline.DebugPipelineContext.proceedLoop(DebugPipelineContext.kt:82)
	at io.ktor.util.pipeline.DebugPipelineContext.proceed(DebugPipelineContext.kt:60)
	at io.ktor.util.pipeline.DebugPipelineContext.execute(DebugPipelineContext.kt:66)
	at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:79)
	at io.ktor.server.cio.CIOApplicationEngine$handleRequest$2.invokeSuspend(CIOApplicationEngine.kt:189)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

from plotly.kt.

bjonnh avatar bjonnh commented on June 30, 2024

I do not see that error, maybe there is no logging by default?

from plotly.kt.

altavir avatar altavir commented on June 30, 2024

Yes, I switched to different logging in DataForge and now logback is not provided by default. One needs to add implementation("ch.qos.logback:logback-classic:1.2.3") to dependencies for logs to work. I fixed the problem with ktor, but I still can't see the picture on JDK 15.

from plotly.kt.

altavir avatar altavir commented on June 30, 2024

@bjonnh I've localized the problem. It is the crappy FX-browser again. The problem is that plotly JS is rather large and it takes some time to load it. And FX browser does not process the loading event properly for some reason. I will try to find a workaround for that.

from plotly.kt.

bjonnh avatar bjonnh commented on June 30, 2024

Ok let me have a look at how it is handled, I may be able to help with that.

from plotly.kt.

altavir avatar altavir commented on June 30, 2024

I've just pushed the commit with all logging attached. Toggling back-forward button on the plotly windows makes it display the plot properly, but in general load worker is just stuck on RUNNING

from plotly.kt.

bjonnh avatar bjonnh commented on June 30, 2024

(If you did read what I wrote before deleting, that's because I ran directly from IntelliJ not the gradle task)

from plotly.kt.

bjonnh avatar bjonnh commented on June 30, 2024

I see where the problem is, you really need to have a function that waits on Plotly to be loaded because order of loading/running scripts is never guaranteed.

from plotly.kt.

altavir avatar altavir commented on June 30, 2024

I see. It is fixed in the more advanced VisionForge implementation. Probably I will just back-port it to Plotly.

from plotly.kt.

bjonnh avatar bjonnh commented on June 30, 2024

But that's pretty clearly unexpected from JavaFX Webview. It should probably behave like other browsers. You can try sending a bug-report to the JavaFX team, but I was never successful at doing that.

from plotly.kt.

bjonnh avatar bjonnh commented on June 30, 2024

There is something really weird, if I take a page served by the ktor server, it fails. If I take the html put it on a webserver and load it there, it works see:
https://www.bjonnh.net/share/test_static.html

from plotly.kt.

altavir avatar altavir commented on June 30, 2024

Yes, I had some weird bugs with FX-browser. Sadly it lives in its own world sometimes. I will back-port the solution from VisionForge. It uses Kotlin JS bundling thus solving the loading order problem. As soon as VisionForge is more stable, I will just deprecate server support in plotly.kt. VisionForge is much more powerful anyway (and it already works well with plotly.kt).

from plotly.kt.

bjonnh avatar bjonnh commented on June 30, 2024

Once I tell it to not load PlotlyConnect, it works fine.

from plotly.kt.

bjonnh avatar bjonnh commented on June 30, 2024

Do you have a demo on how to have simple plots in VisionForge with JavaFX?

from plotly.kt.

bjonnh avatar bjonnh commented on June 30, 2024

This makes little sense to me, plotlyConnect.js is just defining functions…

from plotly.kt.

bjonnh avatar bjonnh commented on June 30, 2024

From what I see when logging with Ktor, it doesn't even try to load the JS…

from plotly.kt.

altavir avatar altavir commented on June 30, 2024

Indeed. For some reason, it randomly loads the first scripts and forgets to load the other one or does not load anything at all. When I searched for a fix, people proposed to store the webEngine in a static variable because it gets GCed. But I tried that and it does not help. I will do both Plotly backport and the VisionForge demo in a few days.

from plotly.kt.

altavir avatar altavir commented on June 30, 2024

@bjonnh I've implemented the back-port, but it did not help. The problem is not the loading order, but just a bugged loader after all. Surprisingly, downgrading JavaFX version to 11 helped. So now it works on dev.

from plotly.kt.

altavir avatar altavir commented on June 30, 2024

Considered it fixed for now. FX version 11 seems to be working fine.

from plotly.kt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.