edvin / fxlauncher

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

Windows Installation Fails with NPE #65

Closed gcstang closed 7 years ago

gcstang commented 7 years ago

After building on Windows 10 and trying to perform the installation I see the following error just during or after the update concludes. Does this work with Windows?

java.lang.NullPointerException at fxlauncher.Launcher.launchAppFromManifest(Launcher.java:164) at fxlauncher.Launcher.lambda$start$0(Launcher.java:153) at java.lang.Thread.run(Thread.java:745)

TravFitz commented 7 years ago

Yes it does, I am using it on Windows 10, that error is telling you that it cannot find the app.xml file that you are using to update/download your app from, or that the defined launch="project.mainclass" cannot be found in said app.xml. like this <Application uri="http://somedomain/applocation/" launch="project.mainClass">

edvin commented 7 years ago

Still, it shouldn't result in an NPE. @ronsmits will look into it in a couple of days :)

ronsmits commented 7 years ago

The scp library I am using behaves differently on linux/mac then on windows. I am investigating but honestly I am thinking of putting another library in

edvin commented 7 years ago

@ronsmits Are you sure this has anything to do with the Maven plugin? There is no scp library involved in the default/current maven procedure for FXLauncher.

gcstang commented 7 years ago

Added app.xml (added .txt so it would upload) app.xml.txt

Attempted with 1.0.16 and still getting the following errors: a NPE fxlauncher.Launcher.launchAppFromManifest Launcher: 161

Another window behind it has this: ExceptionInInitializerError fxlauncher.Launcher.lambda$createApplication Launcher 49

But this works on a Mac using the Native Build, just not on Windows 10.

My Configuration ` fxlauncher { cacheDir 'USERLIB/OcpUtilTest' applicationVendor 'Misc' applicationUrl 'http://myservername/utiltest/' applicationMainClass 'com.javafx.ui.application.Main' acceptDowngrade false deployTarget 'myuser@myservername:/var/www/html/utiltest' lingeringUpdateScreen true }

`

edvin commented 7 years ago

Can you upload the installer or point me to your source code repo for this project?

gcstang commented 7 years ago

By the installer do you mean the exe?

edvin commented 7 years ago

Yes, or if not available, the built version of the launcher which points to an actually available url if possible.

gcstang commented 7 years ago

I can attach the fxlauncher but it points to a private URL, is that what you want?

edvin commented 7 years ago

Yes. Can you also send me the files so I can host them locally?

gcstang commented 7 years ago

I can't share them unfortunately, is there a way I can get you more information by running it command line or something that will get you more information?

edvin commented 7 years ago

I might be able to debug it without your actual project, but perhaps you could create a minimal sample instead? That would be much easier to debug also!

gcstang commented 7 years ago

Here are the two archives, wouldn't let me upload here due to the size restriction.

https://www.dropbox.com/sh/5pho54zc65aimzp/AACcyhsMxlg-TX9bnoWao4Loa?dl=0

Please tell me if you have any issues or need something else.

gcstang commented 7 years ago

Any update? Do you need something else?

edvin commented 7 years ago

Hi Gil,

Sorry for the late reply. I'm swamped at the moment, but I haven't forgotten about this. Will try my best to look at it this coming weekend.

edvin commented 7 years ago

Hi Gil,

I downloaded your project and setup a local apache server, created a host entry for the host name in the manifest and put the server project in /testapp. Then I started the exe file and it installed correctly. I was greeted with this screen:

image

After that, the app seems to go into the background. As far as I can tell, everything went according to plan.

I wonder what could be different on my machine compared to the machine where it doesn't work. I would think that you simply can't access the remote server, so that's why it can't find the main class after attempting to download the app.

The launcher needs internet access for the first run, since the actual app libraries aren't distributed with the application, just the launcher jar. Could this be the issue?

Can you verify that you can reach http://bur00ajx.us.oracle.com/testapp/ and app.xml as well as the jars it mentions from the machine where it fails? Can you also verify that you don't need proxy configuration to access those resources?

Again, I'm very sorry for the late reply, I will try to answer more quickly until we have resolved this issue.

gcstang commented 7 years ago

Thank you for your response, I confirmed I have access via a browser but I'll try a few more things to see if I can get more information from the machine (It's a VirtualBox version of Windows 10 I'm using in order to get this working).

The application on a Mac appears in the menu bar at top of the screen but the test app appears not to do that, odd.

Thank you for your help, I'll get back to you if I run into anything else that can help.

gcstang commented 7 years ago

Ok, so I might have found my issue. It seems running the EXE instead of using the java -jar fxlauncher.jar hides all the other errors and it seems there is a pathing issue in my application that I need to figure out.

Thank you for your help, I'll close this ticket for now if you like.

edvin commented 7 years ago

Great! Thanks for reporting back. I've seen similar issues before, but I'm curious about what exactly the issue was? Can you shed some light? Maybe I can improve the error reporting for these cases to avoid confusion in the future.

gcstang commented 7 years ago

It turned out to be a pathing issue to the h2 database I was creating on startup but the errors aren't showing from the UI, I might need to look into that some more but it's working on Windows now. Apologies for wasting your time.

edvin commented 7 years ago

You didn't waste my time at all, I think you have highlighted an important shortcoming. If this happens at startup we should be able to detect it and warn the user :)

gcstang commented 7 years ago

Thank you, that would be very helpful.

On Aug 16, 2017 3:03 PM, "Edvin Syse" notifications@github.com wrote:

You didn't waste my time at all, I think you have highlighted an important shortcoming. If this happens at startup we should be able to detect it and warn the user :)

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/edvin/fxlauncher/issues/65#issuecomment-322882892, or mute the thread https://github.com/notifications/unsubscribe-auth/ADBkKcDqBnQr6nMlYQsMLO-C5IGoYRtHks5sY0sAgaJpZM4M5Ma4 .

edvin commented 7 years ago

I had a look at it now, and errors in start() should already be covered. I added error reporting to errors in init() now. In what function did the error occur in your app?

gcstang commented 7 years ago

My main application has a class called Main and in it I have a static block that calls a method setupSession() which initializes a database if it doesn't exist, the errors came from that. For some reason the fxlauncher gave a Class Not Found Exception if I remember correctly.

If I run it with the jar fxlauncher instead of the exe the errors show in the console. It could be I just need to send my e.printStackTraces to a log file instead of thinking fxlauncher would get those and display them when running as an exe.

edvin commented 7 years ago

OK, so it was the actual object creation that failed. That should be handled in the Launcher class:

try {
    app = appClass.newInstance();
} catch (Throwable t) {
    reportError("Error creating app class", t);
}

Weird that it's not showing up. I've seen issues where exceptions dealing with class instantiation isn't caught, maybe this is one of these situations. Not sure what else I can do to improve the error checking here actually. I'll leave this here in case anybody else has an idea.

gcstang commented 7 years ago

Yeah that's the error I was getting in the fxlauncher window. "Error creating app class", unfortunately it didn't show the printStackTrace unless I ran it from fxlauncher.jar in the command line, for testing I'll just run it that way from now on. Thank you for looking into it.

edvin commented 7 years ago

OK. Until we can figure out how to show this error I think it's a good recommendation to run it from the command line if you encounter issues :)