8 Replies Latest reply: Sep 21, 2011 11:06 AM by 793415 RSS

    java.lang.NullPointerException

    507066
      When executing JNLP I got this error:

      java.lang.NullPointerException
           at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
           at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
           at com.sun.javaws.Launcher.launch(Unknown Source)
           at com.sun.javaws.Main.launchApp(Unknown Source)
           at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
           at com.sun.javaws.Main$1.run(Unknown Source)
           at java.lang.Thread.run(Thread.java:619)

      and this is console output:

      Java Web Start 1.6.0_21
      Using JRE version 1.6.0_20-b02 Java HotSpot(TM) Client VM
      User home directory = C:\Users\MyUser
      ----------------------------------------------------
      c: clear console window
      ...
      0-5: set trace level to <n>
      ----------------------------------------------------
      #### Java Web Start Error:
      #### null

      How can I debug and find out what is wrong? I am very disappointed with Java WebStart, because it crashes with NPE instead of checking references against null value and throwing meaningful exceptions.
        • 1. Re: java.lang.NullPointerException
          793415
          user504063 wrote:
          When executing JNLP I got this error:
          When developing a JWS app., make sure you check your JNLP file using JaNeLA.
          • 2. Re: java.lang.NullPointerException
            507066
            I forgot to say that I have cleared Java cache of installed apps, searched the web with Google for solution, make sure all JARs listed in JNLP are phisically present and accessible... and nothing helps :(
            • 3. Re: java.lang.NullPointerException
              507066
              Andrew Thompson wrote:
              When developing a JWS app., make sure you check your JNLP file using JaNeLA.
              Thank you. I have validated my JNLP using JaNeLA tool, fixed lots of reported problems as red lines, but still the same NPE exception in JWS when executing JNLP. :(
              • 4. Re: java.lang.NullPointerException
                793415
                user504063 wrote:
                Andrew Thompson wrote:
                When developing a JWS app., make sure you check your JNLP file using JaNeLA.
                Thank you. I have validated my JNLP using JaNeLA tool, fixed lots of reported problems as red lines, but still the same NPE exception in JWS when executing JNLP. :(
                Did you uninstall the app. before retesting?
                • 5. Re: java.lang.NullPointerException
                  507066
                  Andrew Thompson wrote:
                  Did you uninstall the app. before retesting?
                  I have found what is causing NPE. Belive it or not, inside my JNLP, I had "&TOKEN=something" in my href attribute of jnlp tag. I was using TOKEN param for my custom security app logins. Obviously, this is reserved word/param of 1.6.xx JWS, because it used to work fine with older versions of JWS/JRE. If I use lowercase: "&token=something", then it works fine.
                  • 6. Re: java.lang.NullPointerException
                    gimbal2
                    user504063 wrote:
                    I have found what is causing NPE. Belive it or not, inside my JNLP, I had "&TOKEN=something" in my href attribute of jnlp tag. I was using TOKEN param for my custom security app logins. Obviously, this is reserved word/param of 1.6.xx JWS, because it used to work fine with older versions of JWS/JRE. If I use lowercase: "&token=something", then it works fine.
                    ... that would be quite a coincidence. Not impossible, but still... Now that you got it working, can you reproduce the error by turning the parameter into TOKEN again?

                    I don't want to be a douche, but too often I have seen myself fall in the trap of thinking that a specific action fixes a problem while it was something else entirely; the sequence of events simply made it seem so.
                    • 7. Re: java.lang.NullPointerException
                      507066
                      gimbal2 wrote:
                      Now that you got it working, can you reproduce the error by turning the parameter into TOKEN again?
                      Yes! :)

                      In a perfect world, JaNeLA tool would warn on this, and JWS would warn on this and wouldn't crash with NPE.
                      • 8. Re: java.lang.NullPointerException
                        793415
                        user504063 wrote:
                        gimbal2 wrote:
                        Now that you got it working, can you reproduce the error by turning the parameter into TOKEN again?
                        Yes! :)
                        I suggest you raise a bug report, and see what Oracle has to say about it.
                        In a perfect world, JaNeLA tool would warn on this,..
                        In the real world, JaNeLA did at least high-light and prompt you to fix +"..lots of reported problems"+. O_o

                        JaNeLA is open source, so feel free to improve it.
                        .. and JWS would warn on this and wouldn't crash with NPE.
                        JWS is not a debugging tool, but a launch technology for Java rich client apps.

                        I would vote for an RFE to make the JWS clients reject invalid JNLP files and throw up an error dialog. But I doubt it would be implemented by Oracle & extremely doubt it could be implemented as part of any spec. that anyone else making JREs would pay attention to.