NanoContainer
  1. NanoContainer
  2. NANO-147

Deployer Invalidly traverses too deep looking for nanoconainer.*

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: deployer
    • Labels:
      None
    • Environment:
      Windows JDK 1.5. Using Latest SVN code.
    • Testcase included:
      yes
    • Number of attachments :
      2

      Description

      A couple of issues with deployer:

      It would:

      1 - Search indefinitely deep and only return the first in the array. So something in the lines of:

      META-INF

      -nanocontainer.groovy
      -.svn
      --nanocontainer.svn.props-base

      Would return nanocontainer.svn.props-base instead of the correct file. Fix only searches one layer deep. (Tested against VFS's SVN source base)

      2 - Null Pointer Exception if the wrong type of file extension is found. (Given the above case, I bet you can't figure out why I found this bug ) Fixed.

      3 - Added test cases for badly formed jar files and badly named scripts. (malformed-deployment.jar and badbuildscriptdeploy.jar respectively)

      4 - Added a constructor to NanoContainerDeployer to not have to hard code the configuration script name. (before hardcoded to 'nanocontainer') – the old default is provided.

      The entire zip file should be able to drop into nanocontainer-sandbox\trunk\deployer\src and test case jars and patch files should match up. I'll be happy to modify the exceptio handling as per my post to the list and/or modify anything else in the design mods.

        Activity

        Hide
        Michael Rimov added a comment -

        P.S. Multiproject works now with deployer included:

        Index: project.properties
        ===================================================================
        — project.properties (revision 2060)
        +++ project.properties (working copy)
        @@ -32,7 +32,7 @@
        maven.multiproject.aggregateDir=components/
        maven.multiproject.includes=*/project.xml
        #the following fail and therefore are excluded
        -maven.multiproject.excludes=idea/project.xml,deployer/project.xml
        +maven.multiproject.excludes=idea/project.xml
        maven.simian.linecount = 4
        maven.license.licenseFile=$

        {maven.multiproject.basedir}

        /LICENSE.txt

        Show
        Michael Rimov added a comment - P.S. Multiproject works now with deployer included: Index: project.properties =================================================================== — project.properties (revision 2060) +++ project.properties (working copy) @@ -32,7 +32,7 @@ maven.multiproject.aggregateDir=components/ maven.multiproject.includes=*/project.xml #the following fail and therefore are excluded -maven.multiproject.excludes=idea/project.xml,deployer/project.xml +maven.multiproject.excludes=idea/project.xml maven.simian.linecount = 4 maven.license.licenseFile=$ {maven.multiproject.basedir} /LICENSE.txt
        Mauro Talevi made changes -
        Field Original Value New Value
        Key NANO-136 NANOTOOLS-1
        Component/s deployer [ 10686 ]
        Component/s deployer [ 11623 ]
        Project NanoContainer [ 10121 ] NanoTools [ 11002 ]
        Mauro Talevi made changes -
        Component/s deployer [ 11623 ]
        Project NanoContainer Tools [ 11002 ] NanoContainer Sandbox [ 11010 ]
        Key NANOTOOLS-1 NANOSANDBOX-7
        Mauro Talevi made changes -
        Component/s deployer [ 11641 ]
        Description A couple of issues with deployer:

        It would:

        1 - Search indefinitely deep and only return the first in the array. So something in the lines of:
            
        META-INF
           |-nanocontainer.groovy
           |-.svn
               |--nanocontainer.svn.props-base

        Would return nanocontainer.svn.props-base instead of the correct file. Fix only searches one layer deep. (Tested against VFS's SVN source base)

        2 - Null Pointer Exception if the wrong type of file extension is found. (Given the above case, I bet you can't figure out why I found this bug ;) ) Fixed.

        3 - Added test cases for badly formed jar files and badly named scripts. (malformed-deployment.jar and badbuildscriptdeploy.jar respectively)

        4 - Added a constructor to NanoContainerDeployer to not have to hard code the configuration script name. (before hardcoded to 'nanocontainer') -- the old default is provided.

        The entire zip file should be able to drop into nanocontainer-sandbox\trunk\deployer\src and test case jars and patch files should match up. I'll be happy to modify the exceptio handling as per my post to the list and/or modify anything else in the design mods.
        A couple of issues with deployer:

        It would:

        1 - Search indefinitely deep and only return the first in the array. So something in the lines of:
            
        META-INF
           |-nanocontainer.groovy
           |-.svn
               |--nanocontainer.svn.props-base

        Would return nanocontainer.svn.props-base instead of the correct file. Fix only searches one layer deep. (Tested against VFS's SVN source base)

        2 - Null Pointer Exception if the wrong type of file extension is found. (Given the above case, I bet you can't figure out why I found this bug ;) ) Fixed.

        3 - Added test cases for badly formed jar files and badly named scripts. (malformed-deployment.jar and badbuildscriptdeploy.jar respectively)

        4 - Added a constructor to NanoContainerDeployer to not have to hard code the configuration script name. (before hardcoded to 'nanocontainer') -- the old default is provided.

        The entire zip file should be able to drop into nanocontainer-sandbox\trunk\deployer\src and test case jars and patch files should match up. I'll be happy to modify the exceptio handling as per my post to the list and/or modify anything else in the design mods.
        Hide
        Paul Hammant added a comment -

        I am trying to apply this, but it barfs against latest Svn :-

        test:test:
        [junit] Running org.nanocontainer.tools.deployer.DeployingFolderListenerTestCase
        [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 1.629 sec
        [junit] Running org.nanocontainer.tools.deployer.DifferenceAnalysingFolderContentHandlerTestCase
        [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 1.093 sec
        [junit] Running org.nanocontainer.tools.deployer.FolderContentPollerTestCase
        [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 1.332 sec
        [junit] Running org.nanocontainer.tools.deployer.NanoContainerDeployerTestCase
        [junit] Tests run: 6, Failures: 0, Errors: 2, Time elapsed: 4.099 sec
        [junit] [ERROR] TEST org.nanocontainer.tools.deployer.NanoContainerDeployerTestCase FAILED

        ------------- Standard Output ---------------
        Groovy Started15934397
        ------------- ---------------- ---------------
        Testcase: testFolderWithDeploymentScriptAndClassesCanBeDeployed(org.nanocontainer.tools.deployer.NanoContainerDeployerTestCase): Caused an ERROR
        No such property: foo for class: nanocontainer
        groovy.lang.MissingPropertyException: No such property: foo for class: nanocontainer
        at groovy.lang.MetaClass.getProperty(MetaClass.java:697)
        at groovy.lang.GroovyObjectSupport.getProperty(GroovyObjectSupport.java:65)
        at groovy.lang.Script.getProperty(Script.java:85)
        at org.codehaus.groovy.runtime.Invoker.getProperty(Invoker.java:578)
        at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:169)
        at groovy.lang.Closure.getProperty(Closure.java:169)
        at org.codehaus.groovy.runtime.InvokerHelper.getGroovyObjectProperty(InvokerHelper.java:201)
        at nanocontainer$_run_closure1.doCall(nanocontainer.groovy:4)
        at groovy.lang.Closure.call(Closure.java:285)
        at groovy.lang.Closure.call(Closure.java:217)
        at groovy.util.BuilderSupport.doInvokeMethod(BuilderSupport.java:155)
        at org.nanocontainer.script.groovy.NanoContainerBuilder.doInvokeMethod(NanoContainerBuilder.java:71)
        at groovy.util.BuilderSupport.invokeMethod(BuilderSupport.java:85)
        at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:130)
        at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:106)
        at nanocontainer.run(nanocontainer.groovy:2)
        at org.nanocontainer.script.groovy.GroovyContainerBuilder.createContainerFromScript(GroovyContainerBuilder.java:61)
        at org.nanocontainer.script.ScriptedContainerBuilder.createContainer(ScriptedContainerBuilder.java:60)
        at org.nanocontainer.integrationkit.LifecycleContainerBuilder.buildContainer(LifecycleContainerBuilder.java:26)
        at org.nanocontainer.tools.deployer.NanoContainerDeployer.deploy(NanoContainerDeployer.java:144)
        at org.nanocontainer.tools.deployer.NanoContainerDeployerTestCase.testFolderWithDeploymentScriptAndClassesCanBeDeployed(NanoContainerDeployerTestCase.java:30)

        foo (the package name) is the issue in composition.groovy. The class is not mounted in a classloader thus groovy does not recognise it.

        • Paul
        Show
        Paul Hammant added a comment - I am trying to apply this, but it barfs against latest Svn :- test:test: [junit] Running org.nanocontainer.tools.deployer.DeployingFolderListenerTestCase [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 1.629 sec [junit] Running org.nanocontainer.tools.deployer.DifferenceAnalysingFolderContentHandlerTestCase [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 1.093 sec [junit] Running org.nanocontainer.tools.deployer.FolderContentPollerTestCase [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 1.332 sec [junit] Running org.nanocontainer.tools.deployer.NanoContainerDeployerTestCase [junit] Tests run: 6, Failures: 0, Errors: 2, Time elapsed: 4.099 sec [junit] [ERROR] TEST org.nanocontainer.tools.deployer.NanoContainerDeployerTestCase FAILED ------------- Standard Output --------------- Groovy Started15934397 ------------- ---------------- --------------- Testcase: testFolderWithDeploymentScriptAndClassesCanBeDeployed(org.nanocontainer.tools.deployer.NanoContainerDeployerTestCase): Caused an ERROR No such property: foo for class: nanocontainer groovy.lang.MissingPropertyException: No such property: foo for class: nanocontainer at groovy.lang.MetaClass.getProperty(MetaClass.java:697) at groovy.lang.GroovyObjectSupport.getProperty(GroovyObjectSupport.java:65) at groovy.lang.Script.getProperty(Script.java:85) at org.codehaus.groovy.runtime.Invoker.getProperty(Invoker.java:578) at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:169) at groovy.lang.Closure.getProperty(Closure.java:169) at org.codehaus.groovy.runtime.InvokerHelper.getGroovyObjectProperty(InvokerHelper.java:201) at nanocontainer$_run_closure1.doCall(nanocontainer.groovy:4) at groovy.lang.Closure.call(Closure.java:285) at groovy.lang.Closure.call(Closure.java:217) at groovy.util.BuilderSupport.doInvokeMethod(BuilderSupport.java:155) at org.nanocontainer.script.groovy.NanoContainerBuilder.doInvokeMethod(NanoContainerBuilder.java:71) at groovy.util.BuilderSupport.invokeMethod(BuilderSupport.java:85) at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:130) at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:106) at nanocontainer.run(nanocontainer.groovy:2) at org.nanocontainer.script.groovy.GroovyContainerBuilder.createContainerFromScript(GroovyContainerBuilder.java:61) at org.nanocontainer.script.ScriptedContainerBuilder.createContainer(ScriptedContainerBuilder.java:60) at org.nanocontainer.integrationkit.LifecycleContainerBuilder.buildContainer(LifecycleContainerBuilder.java:26) at org.nanocontainer.tools.deployer.NanoContainerDeployer.deploy(NanoContainerDeployer.java:144) at org.nanocontainer.tools.deployer.NanoContainerDeployerTestCase.testFolderWithDeploymentScriptAndClassesCanBeDeployed(NanoContainerDeployerTestCase.java:30) foo (the package name) is the issue in composition.groovy. The class is not mounted in a classloader thus groovy does not recognise it. Paul
        Hide
        Michael Rimov added a comment -

        !@#%$(%

        Yes, I can definitely replicate what you're experiencing now. I don't suppose that it would help to swear up and down that this wasn't happening a month ago?

        I spent this morning trying to track down the source of the error.

        Changing deploytest/META-INF/nanocontainer.groovy from

        builder = new org.nanocontainer.script.groovy.NanoContainerBuilder()
        pico = builder.container(parent:parent)

        { component(instance:'Groovy') component(key:'zap', class:foo.bar.Zap) }

        to

        builder = new org.nanocontainer.script.groovy.NanoContainerBuilder()
        pico = builder.container(parent:parent)

        { component(instance:'Groovy') component(key:'zap', class:'foo.bar.Zap') //Added single quotes around classname }

        at least got further. Instead of complaining about unknown property 'foo' (I assume groovy/nano/somewhere is trying to resolve foo as a property of nano – if this is the case then are the onsite docs regarding groovy configuration out of date if quotes have to be around the classnames when configuring?)

        But it then complains about class not found, foo.bar.Zap.

        I can verify in the test case that VFS classloader is getting passed in properly to NanoContainer, but I don't understand the internal workings of GroovyBuilder and Groovy to further track things down.

        So I guess that means that I'm going to have to punt on getting deployer working now.

        Sorry for the trouble and at thank you for taking the time to try to apply the patches.

        -Mike

        Show
        Michael Rimov added a comment - !@# %$(% Yes, I can definitely replicate what you're experiencing now. I don't suppose that it would help to swear up and down that this wasn't happening a month ago? I spent this morning trying to track down the source of the error. Changing deploytest/META-INF/nanocontainer.groovy from builder = new org.nanocontainer.script.groovy.NanoContainerBuilder() pico = builder.container(parent:parent) { component(instance:'Groovy') component(key:'zap', class:foo.bar.Zap) } to builder = new org.nanocontainer.script.groovy.NanoContainerBuilder() pico = builder.container(parent:parent) { component(instance:'Groovy') component(key:'zap', class:'foo.bar.Zap') //Added single quotes around classname } at least got further. Instead of complaining about unknown property 'foo' (I assume groovy/nano/somewhere is trying to resolve foo as a property of nano – if this is the case then are the onsite docs regarding groovy configuration out of date if quotes have to be around the classnames when configuring?) But it then complains about class not found, foo.bar.Zap. I can verify in the test case that VFS classloader is getting passed in properly to NanoContainer, but I don't understand the internal workings of GroovyBuilder and Groovy to further track things down. So I guess that means that I'm going to have to punt on getting deployer working now. Sorry for the trouble and at thank you for taking the time to try to apply the patches. -Mike
        Hide
        Michael Rimov added a comment -

        Unified Patch with Maven Build Update

        Show
        Michael Rimov added a comment - Unified Patch with Maven Build Update
        Michael Rimov made changes -
        Attachment deployer-patch.zip [ 16177 ]
        Hide
        Michael Rimov added a comment -

        Got it!

        Well, after a ton of digging, I found out that

        deployer/src/deploytest/foo/bar/Zap.class had been corrupted

        Delete it, rebuild it: (I don't see an automated rebuild anywhere available)

        javac -cp "%USERPROFILE%\.maven\repository\picocontainer\jars\picocontainer-1.2-SNAPSHOT.jar" Zap.java

        And things should work.

        I updated the patch to be a single patch for the whole project with maven dependencies updated to use the latest VFS and Groovy.

        HTH!!
        -Mike (R)

        Show
        Michael Rimov added a comment - Got it! Well, after a ton of digging, I found out that deployer/src/deploytest/foo/bar/Zap.class had been corrupted Delete it, rebuild it: (I don't see an automated rebuild anywhere available) javac -cp "%USERPROFILE%\.maven\repository\picocontainer\jars\picocontainer-1.2-SNAPSHOT.jar" Zap.java And things should work. I updated the patch to be a single patch for the whole project with maven dependencies updated to use the latest VFS and Groovy. HTH!! -Mike (R)
        Hide
        Michael Rimov added a comment -

        Whoops, missed one detail: You'll still need the badbuildscriptdeploy.jar and malformed-deployment.jar from the first attachment.

        Thanks

        -Mike (R)

        Show
        Michael Rimov added a comment - Whoops, missed one detail: You'll still need the badbuildscriptdeploy.jar and malformed-deployment.jar from the first attachment. Thanks -Mike (R)
        Jörg Schaible made changes -
        Assignee Joerg Schaible [ joehni ]
        Hide
        Paul Hammant added a comment -

        applied

        Show
        Paul Hammant added a comment - applied
        Paul Hammant made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Mauro Talevi made changes -
        Key NANOSANDBOX-7 NANO-147
        Component/s deployer [ 11788 ]
        Project NanoContainer Sandbox [ 11010 ] NanoContainer [ 10121 ]
        Component/s deployer [ 11641 ]

          People

          • Assignee:
            Jörg Schaible
            Reporter:
            Michael Rimov
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: