• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • deploy-plugin
    • None
    • Platform: All, OS: All

      I clicked on

      https://hudson.dev.java.net/hudson.jnlp

      and accepted the security certificate. I was greeted with a window containing:

      [Winstone 2008/09/04 13:45:29] - Beginning extraction from war file
      [Winstone 2008/09/04 13:45:29] - Container startup failed

      winstone.WinstoneException: The warfile supplied is unavailable or invalid
      (/home/jglick)
      at winstone.HostConfiguration.getWebRoot(HostConfiguration.java:214)
      at winstone.HostConfiguration.<init>(HostConfiguration.java:73)
      at winstone.HostGroup.initHost(HostGroup.java:85)
      at winstone.HostGroup.<init>(HostGroup.java:45)
      at winstone.Launcher.<init>(Launcher.java:196)
      at winstone.Launcher.main(Launcher.java:391)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at Main.main(Main.java:69)
      at JNLPMain.main(JNLPMain.java:27)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.sun.javaws.Launcher.executeApplication(Launcher.java:1293)
      at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1239)
      at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1086)
      at com.sun.javaws.Launcher.run(Launcher.java:105)
      at java.lang.Thread.run(Thread.java:619)

          [JENKINS-2326] JNLP "test drive" deployment of Hudson failed

          Code changed in hudson
          User: : jglick
          Path:
          trunk/hudson/main/war/pom.xml
          http://fisheye4.cenqua.com/changelog/hudson/?cs=15722
          Log:
          JENKINS-2326 Using new executable-war.

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : jglick Path: trunk/hudson/main/war/pom.xml http://fisheye4.cenqua.com/changelog/hudson/?cs=15722 Log: JENKINS-2326 Using new executable-war.

          Jesse Glick added a comment -
              • Issue 2844 has been marked as a duplicate of this issue. ***

          Jesse Glick added a comment - Issue 2844 has been marked as a duplicate of this issue. ***

          Jesse Glick added a comment -

          In issue #2844 kohsuke mentions that another workaround could be to use
          reflection to access JarFile.name.

          Jesse Glick added a comment - In issue #2844 kohsuke mentions that another workaround could be to use reflection to access JarFile.name.

          is this
          https://bugs.eclipse.org/bugs/show_bug.cgi?id=244311
          the same kind of problem?

          lukewpatterson added a comment - is this https://bugs.eclipse.org/bugs/show_bug.cgi?id=244311 the same kind of problem?

          huybrechts added a comment -

          This one actually: https://bugs.eclipse.org/bugs/show_bug.cgi?id=240500

          This is the equinox fix:

          private String extractInnerURL(URL url) {
          try {
          URLConnection connection = null;
          try {
          connection = url.openConnection();
          if (connection instanceof JarURLConnection)

          { JarFile jarFile = ((JarURLConnection) connection).getJarFile(); String name = jarFile.getName(); // Some VMs may not return a jar name as a security precaution if (name == null || name.length() == 0) name = getJarNameByReflection(jarFile); if (name != null && name.length() > 0) return "file:" + name; //$NON- NLS-1$ }

          } finally

          { if (connection != null) connection.getInputStream().close(); }

          } catch (IOException e)

          { //Ignore and return the external form }

          return url.toExternalForm();
          }

          /*

          • Get a value of the ZipFile.name field using reflection.
          • For this to succeed, we need the "suppressAccessChecks" permission.
            */
            private String getJarNameByReflection(JarFile jarFile) {
            if (jarFile == null)
            return null;

          Field nameField = null;
          try

          { nameField = ZipFile.class.getDeclaredField("name"); //$NON-NLS-1$ }

          catch (NoSuchFieldException e1) {
          try

          { nameField = ZipFile.class.getDeclaredField("fileName"); //$NON-NLS-1$ }

          catch (NoSuchFieldException e)

          { //ignore }

          }

          if (nameField == null ||
          Modifier.isStatic(nameField.getModifiers()) || nameField.getType() !=
          String.class)
          return null;

          try

          { nameField.setAccessible(true); return (String) nameField.get(jarFile); }

          catch (SecurityException e)

          { // Don't have permissions, ignore }

          catch (IllegalArgumentException e)

          { // Shouldn't happen } catch (IllegalAccessException e) { // Shouldn't happen }

          return null;
          }

          huybrechts added a comment - This one actually: https://bugs.eclipse.org/bugs/show_bug.cgi?id=240500 This is the equinox fix: private String extractInnerURL(URL url) { try { URLConnection connection = null; try { connection = url.openConnection(); if (connection instanceof JarURLConnection) { JarFile jarFile = ((JarURLConnection) connection).getJarFile(); String name = jarFile.getName(); // Some VMs may not return a jar name as a security precaution if (name == null || name.length() == 0) name = getJarNameByReflection(jarFile); if (name != null && name.length() > 0) return "file:" + name; //$NON- NLS-1$ } } finally { if (connection != null) connection.getInputStream().close(); } } catch (IOException e) { //Ignore and return the external form } return url.toExternalForm(); } /* Get a value of the ZipFile.name field using reflection. For this to succeed, we need the "suppressAccessChecks" permission. */ private String getJarNameByReflection(JarFile jarFile) { if (jarFile == null) return null; Field nameField = null; try { nameField = ZipFile.class.getDeclaredField("name"); //$NON-NLS-1$ } catch (NoSuchFieldException e1) { try { nameField = ZipFile.class.getDeclaredField("fileName"); //$NON-NLS-1$ } catch (NoSuchFieldException e) { //ignore } } if (nameField == null || Modifier.isStatic(nameField.getModifiers()) || nameField.getType() != String.class) return null; try { nameField.setAccessible(true); return (String) nameField.get(jarFile); } catch (SecurityException e) { // Don't have permissions, ignore } catch (IllegalArgumentException e) { // Shouldn't happen } catch (IllegalAccessException e) { // Shouldn't happen } return null; }

          Jesse Glick added a comment -

          That would work too. Probably more efficient yet more fragile than the current
          fix. No strong opinion.

          Jesse Glick added a comment - That would work too. Probably more efficient yet more fragile than the current fix. No strong opinion.

          i tried again and it works now, thanks!

          lukewpatterson added a comment - i tried again and it works now, thanks!

          Jesse Glick added a comment -

          It does work. The double download is irritating though. I will try to add a
          check for ZipFile.name, falling back to the current impl.

          Jesse Glick added a comment - It does work. The double download is irritating though. I will try to add a check for ZipFile.name, falling back to the current impl.

          Code changed in hudson
          User: : jglick
          Path:
          trunk/hudson/extras/executable-war/src/main/java/Main.java
          http://fisheye4.cenqua.com/changelog/hudson/?cs=15793
          Log:
          JENKINS-2326 Faster but less portable technique tried first.

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : jglick Path: trunk/hudson/extras/executable-war/src/main/java/Main.java http://fisheye4.cenqua.com/changelog/hudson/?cs=15793 Log: JENKINS-2326 Faster but less portable technique tried first.

          Code changed in hudson
          User: : jglick
          Path:
          trunk/hudson/main/war/pom.xml
          http://fisheye4.cenqua.com/changelog/hudson/?cs=15797
          Log:
          JENKINS-2326 Using executable-war-1.7.

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : jglick Path: trunk/hudson/main/war/pom.xml http://fisheye4.cenqua.com/changelog/hudson/?cs=15797 Log: JENKINS-2326 Using executable-war-1.7.

            Unassigned Unassigned
            jglick Jesse Glick
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: