Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-486

Default JDK 5 location on Windows causes startup to abort with java.net.MalformedURLException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Trunk
    • Trunk
    • framework
    • None
    • Windows XP SP 2 JDK 5.0 Update 7

    Description

      Sun's default install location for JDK 5 is under the acursed Program Files folder i.e. it includes a space in the path. Startup places tools.jar from the SDK on the class path. This puts an unescaped space in the classpath, which breaks class loading.

      org.ofbiz.base.start.StartupException: Cannot start() org.ofbiz.service.rmi.RmiServiceContainer (Unable to bind RMIDispatcher to RMI (RemoteException occurred in server thread; nested exception is:
      java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
      java.net.MalformedURLException: no protocol: Files/Java/jdk1.5.0_07/lib/tools.jar))
      at org.ofbiz.base.container.ContainerLoader.start(ContainerLoader.java:79)
      at org.ofbiz.base.start.Start.startStartLoaders(Start.java:260)
      at org.ofbiz.base.start.Start.startServer(Start.java:311)
      at org.ofbiz.base.start.Start.start(Start.java:315)
      at org.ofbiz.base.start.Start.main(Start.java:401)

      Suggested patch below escapes any spaces in the startup class path.

      Index: Classpath.java
      ===================================================================
      — Classpath.java (revision 477351)
      +++ Classpath.java (working copy)
      @@ -81,16 +81,28 @@
      }
      return added;
      }
      +
      + private void appendPath(StringBuffer cp, String path)
      + {
      + if(path.indexOf(' ') >= 0)
      +

      { + cp.append('\"'); + cp.append(path); + cp.append('"'); + }

      + else
      + cp.append(path);
      + }

      public String toString() {
      StringBuffer cp = new StringBuffer(1024);
      int cnt = _elements.size();
      if (cnt >= 1)

      { - cp.append(((File) (_elements.get(0))).getPath()); + appendPath(cp, ((File) (_elements.get(0))).getPath()); }

      for (int i = 1; i < cnt; i++)

      { cp.append(File.pathSeparatorChar); - cp.append(((File) (_elements.get(i))).getPath()); + appendPath(cp, ((File) (_elements.get(i))).getPath()); }

      return cp.toString();
      }

      Attachments

        1. Classpath.patch
          1 kB
          Jacques Le Roux

        Activity

          People

            jonesde David E. Jones
            sgparry Stephen Parry
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: