Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5055681

Incorrect Classloader used in com.sun.tools.jdi.VirtualMachineManagerImpl

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 5.0
    • Fix Version/s: 5.0
    • Component/s: core-svc
    • Subcomponent:
    • Resolved In Build:
      b58
    • CPU:
      x86
    • OS:
      windows_xp

      Description



      Name: gm110360 Date: 06/01/2004


      FULL PRODUCT VERSION :
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
      Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP home edition

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      No network

      A DESCRIPTION OF THE PROBLEM :
      in the java file com.sun.tools.jdi.VirtualMachineManagerImpl.java
      The list of Transport is searched using.

      Iterator iterator = Service.providers(com/sun/jdi/connect/Connector, ClassLoader.getSystemClassLoader());

      The above cannot find a Transport if tools.jar is in a ClassLoader different than the SystemClassloader.

      We have an application (www.bluej.org) that used to work by having the "Main program" started from a new UrlClassloader that did include tools.jar.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a file called myboot.java that contains code like this.
      runtimeClassPath includes tools.jar
      =================
           bootLoader = getClass().getClassLoader();
           runtimeLoader = new URLClassLoader(runtimeClassPath, bootLoader);
          Class mainClass = Class.forName("bluej.Main", true, runtimeLoader);
           Object main = mainClass.newInstance();
      ===================
      create a main file called bluej/Main.java
      In there do something like

         com.sun.jdi.Bootstrap.virtualMachineManager();




      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      It should return a virtualMachineManager


      ACTUAL -
      The call will fail with
      ===================

      Exception in thread "Thread-3" java.lang.Error: no Connectors loaded
              at com.sun.tools.jdi.VirtualMachineManagerImpl.VirtualMachineMana
      gerImpl.java:117)
              at com.sun.tools.jdi.VirtualMachineManagerImpl.MachineManager(Vir
      tualMachineManagerImpl.java:49)
              at com.sun.jdi.Bootstrap.virtualMachineManager(Bootstrap.java:36)
              at bluej.debugger.jdi.VMReference.<init>(VMReference.java:286)
              at bluej.debugger.jdi.JdiDebugger$MachineLoaderThread.debugger.java:839)

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "Thread-3" java.lang.Error: no Connectors loaded
              at com.sun.tools.jdi.VirtualMachineManagerImpl.VirtualMachineMana
      gerImpl.java:117)
              at com.sun.tools.jdi.VirtualMachineManagerImpl.MachineManager(Vir
      tualMachineManagerImpl.java:49)
              at com.sun.jdi.Bootstrap.virtualMachineManager(Bootstrap.java:36)
              at bluej.debugger.jdi.VMReference.<init>(VMReference.java:286)
              at bluej.debugger.jdi.JdiDebugger$MachineLoaderThread.debugger.java:839)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      I am writing it now.
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      include tools.jar into the classpath when the application is started.
      HAving to specify the classpath means that we need to have extra "platform dependent" startup files. Something that we managed to avoid.
      We would like to be a pure java application.
      (Incident Review ID: 275830)
      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            alanb Alan Bateman
            Reporter:
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: