Uploaded image for project: 'Tuscany'
  1. Tuscany
  2. TUSCANY-1051

Grovvy classloader is not being initialized correctly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • Java-SCA-M2
    • None
    • None
    • IDE: eclipse3.2.1+SVN plugin
      OS: win2k
      JDK:jdk1.5.0_09

    Description

      Per antelder said in mail listing, the detailed info this issue is below:
      In the GroovyComponentBuilder the ClassLoader from the DeploymentContext is
      the wrong one to be using, its null as we have seen. It really wants the
      application ClassLoader which is available in the DeploymentContext passed
      into the load method of the ImplementationLoader class in the Groovy
      package. I think what needs to happen is GroovyImplementation should have a
      ClassLoader field added with getter/setters, the
      ImplementationLoader.loadmethod should set the Classloader on the
      GroovyImplementation from the
      DeploymentContext, then the GroovyComponentBuilder should create the
      GroovyClassLoader using the ClassLoader from the GroovyImplementation (the
      implementation variable) instead of the DeploymentContext.

      I am trying to provide a draft patch here, the related java source code is here:
      1.ImplementationLoader.java : add two fields with getter/setters.
      applicationLoader, this will be used for construct GroovyClassloader
      scriptResourceName, this is script resource name, will be used for generate side file name (componentType)
      2. ImplementationLoader.loader()
      add following statement:
      implementation.setApplicationLoader(deploymentContext.getClassLoader());
      implementation.setScriptResourceName(script);
      3. GroovyComponentBuilder.build
      groovyClassLoader = new GroovyClassLoader(implementation.getApplicationLoader());
      4. GroovyComponentType.java
      Adding two constructor method , it is similar with what did in javaScriptComponentType
      5. GroovyComponentTypeLoader.java
      adding sild file(ComponentType) support, just like what we have in JavaScript.
      TODO: i did not implement "loadFromIntrospection" now, I am not sure whether it will use the same logic as javaScript. So mark it as TODO section in this patch now.
      6. GroovyComponentTypeLoaderTestCase
      enhancement due to corresponding modification above.

      Attachments

        1. groovy.patch.jar
          17 kB
          Zhenghui Lee
        2. helloworldGroovy.zip
          8 kB
          Zhenghui Lee

        Activity

          People

            aelder ant elder
            lizh Zhenghui Lee
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: