This discussion is archived
1 2 3 Previous Next 31 Replies Latest reply: Jul 10, 2013 2:26 AM by StefanSt Go to original post RSS
  • 15. Re: Java 7 Update 25 Client App Downloaded From Web Start Can't Connect Out
    StephanosPiperoglou Newbie
    Currently Being Moderated

    The submission email said it was bug ID 9004450 but it hasn't made it to the public bug database yet.

  • 16. Re: Java 7 Update 25 Client App Downloaded From Web Start Can't Connect Out
    foch Newbie
    Currently Being Moderated

    Yes, I tried to open this bug with no success. I have no idea how much time it takes for Oracle to acknowledge a bug report though...

  • 17. Re: Java 7 Update 25 Client App Downloaded From Web Start Can't Connect Out
    foch Newbie
    Currently Being Moderated

    I get a lot of these in my console, however it doesn't prevent the application from running!

    It's probably just a warning... I'll be interested if you find more.

  • 18. Re: Java 7 Update 25 Client App Downloaded From Web Start Can't Connect Out
    StephanosPiperoglou Newbie
    Currently Being Moderated

    Fantastic. It seems Oracle has released a silent update; new builds of the 7u25 JRE now come with Java Web Start 10.25.2.17 instead of 10.25.2.16, so our workaround is no longer activated and our users are all broken again.

  • 19. Re: Java 7 Update 25 Client App Downloaded From Web Start Can't Connect Out
    foch Newbie
    Currently Being Moderated

    Yes indeed, fantastic. Following my own question on SO about Java Web Start version naming:

    How to match javawebstart.version property with Java version? - Stack Overflow

     

    I use this (not tested) code now:

    String version = System.getProperty("javawebstart.version");

    if (version == null || "".equals(version)) {

        return;

    }

     

    // Java 7u25 = 10.25.2.16 and 10.25.2.17

    if (version.startsWith("javaws-10.25")) {

        log.info("Running workaround for version 7u25");

    etc...

  • 20. Re: Java 7 Update 25 Client App Downloaded From Web Start Can't Connect Out
    StephanosPiperoglou Newbie
    Currently Being Moderated

    Latest version of the workaround, does not check version but compares EDT classloader with main thread classloader (assuming you call this very early in your app)

     

        private static void quickAndDirtyFixForProblemWithWebStartInJava7u25() {

            String jwsVersion = System.getProperty("javawebstart.version");

            if (jwsVersion == null || jwsVersion.isEmpty()) {

                log.info("Not running under Web Start - skipping classloader bug workaround");

            } else {

                log.info("Running under Web Start - checking classloader bug workaround");

                final ClassLoader mainClassLoader = Thread.currentThread().getContextClassLoader();

                log.info("Main thread context class loader: " + mainClassLoader);

                try {

                    SwingUtilities.invokeAndWait(new Runnable() {

                        @Override

                        public void run() {

                            try {

                                final ClassLoader swingClassLoader = Thread.currentThread().getContextClassLoader();

                                log.info("EDT context class loader: " + swingClassLoader);

                                if (mainClassLoader.equals(swingClassLoader)) {

                                    log.info("EDT has same context class loader as main thread, skipping workaround");

                                } else {

                                    log.info("EDT has different context class loader, updating");

     

     

                                    // Change context in this thread

                                    Thread.currentThread().setContextClassLoader(mainClassLoader);

     

     

                                    // Change context in all future event threads

                                    final Field field = EventQueue.class.getDeclaredField("classLoader");

                                    field.setAccessible(true);

     

     

                                    final EventQueue eventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue();

                                    field.set(eventQueue, mainClassLoader);

                                }

                            } catch (Exception e) {

                                log.severe("Unable to apply classloader workaround " + e.getMessage());

                                e.printStackTrace();

                            }

                        }

                    });

                } catch (Exception e) {

                    log.log(Level.SEVERE, e.getMessage());

     

     

                }

            }

        }

  • 21. Re: Java 7 Update 25 Client App Downloaded From Web Start Can't Connect Out
    StephanosPiperoglou Newbie
    Currently Being Moderated

    This only seems to work some of them time. Back to the drawing board.

  • 22. Re: Java 7 Update 25 Client App Downloaded From Web Start Can't Connect Out
    foch Newbie
    Currently Being Moderated

    I confirm, it tried it without success. I'm back to my hardcoded version :/

  • 23. Re: Java 7 Update 25 Client App Downloaded From Web Start Can't Connect Out
    StephanosPiperoglou Newbie
    Currently Being Moderated

    I jigged around the order the changes were done; perhaps that's at fault. This is driving me mad because I can't replicate it on my own machine or anything inside the organisation... I have to do a full build & deploy and push it out to an external test server and run it from an external machine. I am slowly losing the will to live.

  • 24. Re: Java 7 Update 25 Client App Downloaded From Web Start Can't Connect Out
    ryvantage Newbie
    Currently Being Moderated

    Dejan,

     

    I've been trying for hours to add Permissions and Codebase to my manifest, but I have not been able to.

     

    I've found a few articles, but everything is a deadend.


    Here is the article that says Permissions and Codebase need to be added: http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/no_redeploy.html

     

    Here is the Java tutorial explaining how to do so: http://docs.oracle.com/javase/tutorial/deployment/jar/modman.html

     

    What I did:

    I created a text file with this as it's contents:

    Permissions: all-permissions
    Codebase: www.mysite.com/MyAPP/dist

     

    But, after trying this line in cmd (with JDK 7u25):

     

    jar umf MyJARFile.jar addToManifest.txt

     

    I got this error.

    java.io.IOException: invalid header field
            at java.util.jar.Attributes.read(Attributes.java:406)
            at java.util.jar.Manifest.read(Manifest.java:199)
            at java.util.jar.Manifest.<init>(Manifest.java:69)
            at sun.tools.jar.Main.update(Main.java:596)
            at sun.tools.jar.Main.run(Main.java:223)
            at sun.tools.jar.Main.main(Main.java:1177)

     

    If/when you figure it out, please post here.

  • 25. Re: Java 7 Update 25 Client App Downloaded From Web Start Can't Connect Out
    69eccffa-9323-498c-bed4-7e5535916018 Newbie
    Currently Being Moderated

    I also discovered the Java 6 + Java 1.7.0_25 recreate.  One of our users cannot launch even after all versions of Java have been uninstalled except for 1.7.0_25 (and obviously we tried reinstalling 1.7.0_25 several times).  I even deleted the user's Deployment directory to get a fresh JWS cache and reset deployment.properties (this did not help).

     

    A resolution for this user was to change their default browser's proxy configuration to "No Proxy" instead of "Automatic Proxy Configuration URL".  In this case the browser was Firefox.  The associated exception in the Java Web Start deployment trace log was:

     

    java.net.UnknownHostException: autoproxy.corporation.com
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
         at com.sun.deploy.net.proxy.AbstractAutoProxyHandler.getJSFileFromURL(Unknown Source)
         at com.sun.deploy.net.proxy.AbstractAutoProxyHandler.init(Unknown Source)
         at com.sun.deploy.net.proxy.DynamicProxyManager.reset(Unknown Source)
         at com.sun.deploy.net.proxy.DeployProxySelector.reset(Unknown Source)
         at com.sun.javaws.Main.initializeExecutionEnvironment(Unknown Source)
         at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
         at com.sun.javaws.Main.access$000(Unknown Source)
         at com.sun.javaws.Main$1.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    

     

    JWS did try to continue on after this exception, but the application encountered the UIDefaults exception that is associated with the "wrong classloader" being discussed elsewhere in this thread (sampled below).  Changing the proxy setting removed the proxy exception from the JWS log and allowed the user to launch the application.  Also it might be notable that the "Show Java Console" workaround was working for this user.  This user's problems corresponded directly to their 1.7.0_25 update and I have no reason to believe they changed their browser settings recently.

     

    UIDefaults.getUI() failed: no ComponentUI class for: javax.swing.JPanel[,0,0,0x0,invalid,layout=java.awt.FlowLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=9,maximumSize=,minimumSize=,preferredSize=]
    java.lang.Error
         at javax.swing.UIDefaults.getUIError(Unknown Source)
         at javax.swing.MultiUIDefaults.getUIError(Unknown Source)
         at javax.swing.UIDefaults.getUI(Unknown Source)
         at javax.swing.UIManager.getUI(Unknown Source)
         at javax.swing.JPanel.updateUI(Unknown Source)
         at javax.swing.JPanel.(Unknown Source)
         at javax.swing.JPanel.(Unknown Source)
         at javax.swing.JPanel.(Unknown Source)
         at javax.swing.JRootPane.createGlassPane(Unknown Source)
    

     

    I hope it goes without saying that you should enable tracing and logging via the Java Control Panel's Advanced tab and check the .trace files in the Java deployment log directory for any suspicious looking exceptions, since the exception derailing your launch may not be exactly the same as mine.

  • 26. Re: Java 7 Update 25 Client App Downloaded From Web Start Can't Connect Out
    946128 Newbie
    Currently Being Moderated

    The parameters are in the wrong order.

    It should be: jar umf addToManifest.txt MyJARFile.jar

  • 27. Re: Java 7 Update 25 Client App Downloaded From Web Start Can't Connect Out
    DejanH Newbie
    Currently Being Moderated

    After adding to the manifest file, do you have to resign jar file?

     

    Thanks.

     

    Regards,

    Dejan

  • 28. Re: Java 7 Update 25 Client App Downloaded From Web Start Can't Connect Out
    bf1517a1-841e-45e4-b255-e1bab350b91b Newbie
    Currently Being Moderated

    I believe the issue is that the fix cannot be applied immediately because at that point the EDT has not been recreated yet. I'm not sure why setting the default for the EventQueue class loader does not work.

     

    What I did in our application was to reset the EDT just before it is displayed. We create our worker threads off the EDT so as long as it is fixed before any other threads are spawned they are initialized with the correct ClassLoader. I'm not sure of the state of the various daemon threads.

     

    Below is the test application I created to reproduce/test. It has parameters to add a wait time before displaying the UI and the ability to test resetting the EDT ClassLoader both before and after the wait. In every test of applying the fix early it failed.

     

    package com.java.test;

     

     

    import java.awt.BorderLayout;

    import java.io.InputStream;

     

     

    import javax.swing.JFrame;

    import javax.swing.JTextArea;

    import javax.swing.SwingUtilities;

    import javax.swing.WindowConstants;

     

     

    public class Application {

     

      public static void main(String[] args) {

      try {

      long waitTime = 0;

      boolean applyFixEarly = false;

      boolean applyFixLater = false;

      for (int i=0; i < args.length; i++) {

      String[] nameValue = args[i].split("=");

      String name = nameValue[0];

      String value = nameValue[1];

      if ("waitTime".equalsIgnoreCase(name)) {

      waitTime = Long.parseLong(value);

      } else if ("applyFixLater".equals(name)) {

      applyFixLater = Boolean.parseBoolean(value);

      } else if ("applyFixEarly".equals(name)) {

      applyFixEarly = Boolean.parseBoolean(value);

      }

      }

     

      final ClassLoader mainClassLoader = Thread.currentThread().getContextClassLoader();

     

      if (applyFixEarly) {

      SwingUtilities.invokeAndWait(new Runnable() {

      @Override

      public void run() {

      applyFix(mainClassLoader);

      }

      });

      }

     

      if (waitTime > 0) {

      try {

      Thread.sleep(waitTime);

      } catch (InterruptedException e) {

      e.printStackTrace();

      }

      }

     

      final boolean applyFixLaterFinal = applyFixLater;

     

      SwingUtilities.invokeAndWait(new Runnable() {

      @Override

      public void run() {

      try {

      if (applyFixLaterFinal) {

      applyFix(mainClassLoader);

      }

      new ApplicationFrame().setVisible(true);

      } catch (Exception e) {

      e.printStackTrace();

      }

      }

      });

      } catch (Exception e) {

      e.printStackTrace();

      }

      }

     

      public static void applyFix(ClassLoader mainClassLoader) {

      Thread.currentThread().setContextClassLoader(mainClassLoader);

      }

     

      public static class ApplicationFrame extends JFrame {

      public ApplicationFrame() {

      super("Application");

     

      setLayout(new BorderLayout());

     

      StringBuilder sb = new StringBuilder("Initializing");

     

      JTextArea textArea = new JTextArea(sb.toString());

     

      add(textArea);

     

      setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

     

      setBounds(100, 100, 400, 200);

     

     

      ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

     

      sb.append("\n");

      sb.append("Class Loader: ");

      if (classLoader == null) {

      sb.append("null");

      } else {

      sb.append(classLoader.toString());

     

     

      InputStream properties = classLoader.getResourceAsStream("values.properties");

     

      sb.append("\n");

     

      if (properties != null) {

      sb.append("Found values.properties\nFixed!");

      } else {

      sb.append("Could not find values.properties\nBroken!");

      }

      }

     

      textArea.setText(sb.toString());

      }

      }

    }

  • 29. Re: Java 7 Update 25 Client App Downloaded From Web Start Can't Connect Out
    946128 Newbie
    Currently Being Moderated

    You need to resign. If not you get IOException: Invalid signature file digest for Manifest main attributes