edvin / fxlauncher

Auto updating launcher for JavaFX Applications
Apache License 2.0
714 stars 110 forks source link

Class not found exception #74

Closed Koire closed 7 years ago

Koire commented 7 years ago

I'm sorry, I think I'm stupid or something, I can't for the life of me figure out how to add this to a gradle javafx project. I'm using aws gradle sync to upload, which is working, but none of the builds actually run, I always get java.lang.ClassNotFoundException: app.main.LavenderClient My javaFX client "LavenderClient" runs correctly however.

edvin commented 7 years ago

You haven't given much info to work with, but maybe you could start by posting the resulting fxlauncher.jar?

Koire commented 7 years ago

Sure, I'm really sorry about that, I was busy working on making some POJOs from a decently large API.

I'm using this for the build.gradle: fxlauncher { applicationVendor 'KWC' applicationUrl '<removed> applicationMainClass '<removed>' acceptDowngrade false deployTarget '<removed>' } apply plugin: 'jp.classmethod.aws.s3' task syncToS3(type: jp.classmethod.aws.gradle.s3.SyncTask) { bucketName '<removed>' source file('build/fxlauncher') }

when I package my app using the javafx packager, it works perfectly, but with the fxlauncher I always get a not found exception

edvin commented 7 years ago

Thank you :) You have two problems:

  1. The applicationUrl parameter. It is supposed to point to the http address where app.xml and the other app artifacts are deployed. You have pointed it to the jar instead.

  2. deployTarget should point to an scp endpoint: user@host:path. This endpoint should correspond to the applicationUrl when fetched over http. You also need to have scp installed, and you must make sure to have authenticated against user@host so deploy can work unattended. If you can't make this happen, you can upload your artifacts so they are visible at applicationUrl manually.

Does that help?

Koire commented 7 years ago

I don't know how you can scp to the s3 bucket... quick google searches says that doesn't work

edvin commented 7 years ago

Since you use aws gradle sync to upload, the value of deployTarget doesn't matter. Just correct applicationUrl :)

Koire commented 7 years ago

Thank you so much, that worked, but I had to make the folder public, is there a way to add a key or something to keep it private? Also, on Linux Mint, the .deb file doesn't work but the executable (.jar) works Strike that... it works if I run it with 'sudo' but doesn't work otherwise

edvin commented 7 years ago

You can use Basic Auth by supplying username/password in the url on the form http://user:pass@host/path, or you can just add an UUID or something unguessable as part of the path to the app and make sure the previous directory is not browsable.

Ultimately though you must make sure that the application resources are protected with a strong authentication scheme. For most applications, public access to the libraries themselves should not be problematic.

Koire commented 7 years ago

Thanks, looking into that now. I fixed the debian install by chown-ing it to the user, however, when I run it via command line I get this error: java.io.IOException: Server returned HTTP response code: 403 for URL: https:///builds/app.xml/app.xml Why is it looking for app.xml/app.xml?

Koire commented 7 years ago

Still no luck, I made a trivial change to the code -- changed the title of the primary stage -- changed the version, ran "generateNativeInstaller", checked that the app.xml updated with the new version, uploaded it to s3, opened the app, and it was the same as previously.

edvin commented 7 years ago

Sorry for the late reply. If it's looking for app.xml/app.xml, you have added app.xml to your applicationUrl. The applicationUrl should only contain the base "folder" for the app. The launcher will add app.xml to the URL when needed to retrieve it.

Koire commented 7 years ago

Thanks, i figured that out, I'm having trouble now where if I don't clean before building it will add the new build to app.xml but won't update.

On Tue, May 9, 2017, 16:02 Edvin Syse notifications@github.com wrote:

Sorry for the late reply. If it's looking for app.xml/app.xml, you have added app.xml to your applicationUrl. The applicationUrl should only contain the base "folder" for the app. The launcher will add app.xml to the URL when needed to retrieve it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/edvin/fxlauncher/issues/74#issuecomment-300078985, or mute the thread https://github.com/notifications/unsubscribe-auth/AC5uI07UPhQzCuS8VTMA7nKmk-oWBBlGks5r4A-WgaJpZM4NMxB- .

Koire commented 7 years ago

Going to close this here because the deploy works as expected now, I will look into a way to authenticate and use Chris's idea to launch a native app to launcher.