Spring Tool Suite
  1. Spring Tool Suite
  2. STS-3577

Grails 2.3.0: java.lang.NoSuchMethodError: org.codehaus.plexus.DefaultPlexusContainer.lookup(Ljava/lang/Class;)Ljava/lang/Object;

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.4.0.M1
    • Fix Version/s: 3.5.0.M1
    • Component/s: GRAILS
    • Labels:
      None

      Description

      This error has been observed occasionally executing grails commands from GGTS with Grails 2.3.0.

      E.g: https://build.springsource.com/browse/STS-GRAILSIDETESTGRAILSBUILDSNAP-JOB1-78/test/case/107416851

      That test fails ostensibly with an NPE, but this NPE is most likely caused by a previous error (found in the log). GGTS user would see this error in the Eclipse console where Grails command output is shown.

       Loading Grails 2.3.0
      | Error java.lang.NoSuchMethodError: org.codehaus.plexus.DefaultPlexusContainer.lookup(Ljava/lang/Class;)Ljava/lang/Object;
      | Error 	at org.codehaus.groovy.grails.resolve.maven.aether.AetherDependencyManager.<init>(AetherDependencyManager.groovy:137)
      | Error 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      | Error 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      | Error 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      | Error 	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      | Error 	at java.lang.Class.newInstance0(Class.java:355)
      | Error 	at java.lang.Class.newInstance(Class.java:308)
      | Error 	at org.codehaus.groovy.grails.resolve.DependencyManagerConfigurer.loadAetherDependencyManager(DependencyManagerConfigurer.groovy:68)
      | Error 	at org.codehaus.groovy.grails.resolve.DependencyManagerConfigurer.configureAether(DependencyManagerConfigurer.groovy:48)
      | Error 	at grails.util.BuildSettings.configureDependencyManager(BuildSettings.groovy:1268)
      | Error 	at grails.util.BuildSettings.postLoadConfig(BuildSettings.groovy:1208)
      | Error 	at grails.util.BuildSettings.loadConfig(BuildSettings.groovy:1104)
      | Error 	at grails.util.BuildSettings.loadConfig(BuildSettings.groovy:1076)
      | Error 	at grails.util.BuildSettings.loadConfig(BuildSettings.groovy)
      | Error 	at grails.util.BuildSettings.loadConfig(BuildSettings.groovy:1062)
      | Error 	at grails.util.BuildSettings.loadConfig(BuildSettings.groovy)
      | Error 	at grails.util.BuildSettings$loadConfig.callCurrent(Unknown Source)
      | Error 	at grails.util.BuildSettings.loadConfig(BuildSettings.groovy:1042)
      | Error 	at grails.util.BuildSettings.loadConfig(BuildSettings.groovy)
      | Error 	at org.grails.ide.api.impl.GrailsConnectorImpl.ensureInitialized(GrailsConnectorImpl.java:123)
      | Error 	at org.grails.ide.api.impl.GrailsConnectorImpl.executeCommand(GrailsConnectorImpl.java:153)
      | Error 	at org.grails.ide.eclipse.longrunning.process.GrailsProcess.run(GrailsProcess.java:130)
      | Error 	at org.grails.ide.eclipse.longrunning.process.GrailsProcess.main(GrailsProcess.java:93)
      | Error 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      | Error 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      | Error 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      | Error 	at java.lang.reflect.Method.invoke(Method.java:597)
      | Error 	at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:235)
      | Error 	at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:263)
      

        Activity

        Hide
        Kris De Volder (c) added a comment -

        Using debugger to observe the long running process. I have discovered the following about the failing test case.

        Breakpoint in AetherDependencyManager gets hit twice. (Presumably because multiple commands executed).

        The first time

        • context classloader is an instance of GrailsRootLoader
        • command executes fine.

        The second time

        • context classloader is an instance of a plain 'URLClassLoader'
        • => error happens.

        I don't know if this is the cause of the error but it is very suspicious at least that the classloader isn't the same the second time around.

        Show
        Kris De Volder (c) added a comment - Using debugger to observe the long running process. I have discovered the following about the failing test case. Breakpoint in AetherDependencyManager gets hit twice. (Presumably because multiple commands executed). The first time context classloader is an instance of GrailsRootLoader command executes fine. The second time context classloader is an instance of a plain 'URLClassLoader' => error happens. I don't know if this is the cause of the error but it is very suspicious at least that the classloader isn't the same the second time around.
        Hide
        Lari Hotari added a comment -

        After I get this problem, I have to remove the Grails project from the workspace and restart STS. After adding it again, it usually works.

        Show
        Lari Hotari added a comment - After I get this problem, I have to remove the Grails project from the workspace and restart STS. After adding it again, it usually works.
        Hide
        Kris De Volder (c) added a comment - - edited

        Thanks for the workaround info.

        I think I fixed the problem (after 3.4.0.RELEASE). So I will close the issue for now.
        If you continue to encounter it after 3.5.0.M1 please post here and we can reopen.

        Show
        Kris De Volder (c) added a comment - - edited Thanks for the workaround info. I think I fixed the problem (after 3.4.0.RELEASE). So I will close the issue for now. If you continue to encounter it after 3.5.0.M1 please post here and we can reopen.

          People

          • Assignee:
            Kris De Volder (c)
            Reporter:
            Kris De Volder (c)
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              First Response Date: