java.lang.NoClassDefFoundError: Failed to get fields for class [org.xwiki.git.internal.GitScriptService] because the class [org/eclipse/jgit/lib/Repository] couldn't be found in the ClassLoader.

XWiki.org JIRA | Vincent Massol | 4 years ago
  1. 0

    I've tried to install an extension defined on e.x.o that was missing a dependency (jgit). The installation stopped in mid-flight because of this error (in the console, not in the UI): {noformat} 2012-07-13 18:19:43,588 [http://localhost:8080/xwiki/bin/view/Main/] INFO .HibernateDataMigrationManager - No storage migration required since current version is [40001] Exception in thread "Thread-17" java.lang.NoClassDefFoundError: Failed to get fields for class [org.xwiki.git.internal.GitScriptService] because the class [org/eclipse/jgit/lib/Repository] couldn't be found in the ClassLoader. at org.xwiki.component.util.ReflectionUtils.getAllFields(ReflectionUtils.java:70) at org.xwiki.component.annotation.ComponentDescriptorFactory.createComponentDescriptor(ComponentDescriptorFactory.java:132) at org.xwiki.component.annotation.ComponentDescriptorFactory.createComponentDescriptors(ComponentDescriptorFactory.java:105) at org.xwiki.component.annotation.ComponentAnnotationLoader.register(ComponentAnnotationLoader.java:164) at org.xwiki.component.annotation.ComponentAnnotationLoader.initialize(ComponentAnnotationLoader.java:139) at org.xwiki.extension.jar.internal.handler.JarExtensionHandler.loadComponents(JarExtensionHandler.java:145) at org.xwiki.extension.jar.internal.handler.JarExtensionHandler.install(JarExtensionHandler.java:102) at org.xwiki.extension.handler.internal.DefaultExtensionHandlerManager.install(DefaultExtensionHandlerManager.java:80) at org.xwiki.extension.job.internal.InstallJob.installExtension(InstallJob.java:208) at org.xwiki.extension.job.internal.InstallJob.applyAction(InstallJob.java:263) at org.xwiki.extension.job.internal.InstallJob.start(InstallJob.java:161) at org.xwiki.job.AbstractJob.start(AbstractJob.java:134) at org.xwiki.job.internal.DefaultJobManager.run(DefaultJobManager.java:156) at java.lang.Thread.run(Thread.java:680) {noformat}

    XWiki.org JIRA | 4 years ago | Vincent Massol
    java.lang.NoClassDefFoundError: Failed to get fields for class [org.xwiki.git.internal.GitScriptService] because the class [org/eclipse/jgit/lib/Repository] couldn't be found in the ClassLoader.
  2. Speed up your debug routine!

    Automated exception search integrated into your IDE

  3. 0

    Problems with Guice in Eclipse: Class Loading Exceptions

    Google Groups | 8 years ago | Anne Martens
    java.lang.NoClassDefFoundError: com/google/ > >> inject/internal/collect/Lists > >>  at com.google.inject.multibindings.Multibinder > >> $RealMultibinder.initialize(Multibinder.java:254) > >>  at org.opt4j.start.Opt4JModule.multi(Opt4JModule.java:128) > > >> This was after I fixed a bug in my own code, which might be a reason > >> why you did not see it. I uploaded a fixed version of my code to the > >> url named above (http://sdqweb.ipd.uka.de/temp/org.opt4j-wrapper- > >> plugin.zip<http://sdqweb.ipd.uka.de/temp/org.opt4j-wrapper-%0Aplugin.zip> > >> ). > > >> Is it possible that the guice-multibindings-....jar also needs a > >> patch? Or is it a problem that multibindings resides in its own jar? > >> For the latter, it might be an option to join the two into one jar. > > > Note this is actually a different issue unrelated to the previous problem, > > the issue here is that the multibindings extension uses classes from the > > internal Guice package which (rightly) isn't exported > > > Seehttp://code.google.com/p/google-guice/issues/detail?id=311 > > > If you've got them inside the same Bundle-ClassPath (as you had before) > > then it shouldn't matter because the internal package is only hidden from > > other bundles / plug-in ... jars on the same Bundle-ClassPath will merge > > together just like in a classic Java application > > > however, if you're using them as separate bundles then you'd need to > > patch the multibindings jar to attach as a fragment to the Guice bundle > > as suggested in Issue 311 > > > I'll take a look at your updated code to see what's changed... > > Aha, found the problem - it's because the packaging of Google-Collection > classes inside Guice changed post-20090205... so when you use the old > multibindings jar with the new Guice jar there's a package mismatch. > > In the 20090205 snapshot it was "com.google.inject.internal.common.Lists", > now it is "com.google.inject.internal.Lists" - if you build Guice > multibindings > from trunk (or use the jar I'm going to send you) then everything should > work > > > Kind regards, > >> Anne > > >> On 3 Mrz., 18:51, Anne Martens <annema...@googlemail.com> wrote: > >> > Dear Stuart, > > >> > thanks a lot for your fast reply! Yes, I'm absolutely ok with using a > >> > patched version, I'm glad that there is a readily available solution. > > >> > I will try it and then let you know. > > >> > Kind regards > >> > from a very happy Anne > > >> > On 3 Mrz., 17:34, Stuart McCulloch <mcc...@gmail.com> wrote: > > >> > > 2009/3/3 Anne Martens <annema...@googlemail.com> > > >> > > > Dear Stuart, > > >> > > > I have uploaded to code to > >> > > >http://sdqweb.ipd.uka.de/temp/org.opt4j-wrapper-plugin.zip. > >> > > > You also find a .project file for Eclipse there. Currently, the > >> plugin > >> > > > needs org.eclipse.core.runtime for the plugin activator > >> > > > Opt4JPluginActivator, but you can delete the class and the > >> dependency > >> > > > if you do not use Eclipse. To get the error, please call > >> > > > de.uka.ipd.sdq.dsexplore.opt4j.start.Opt4JStarter.startOpt4J() > > >> > > Hi Anne, > > >> > > I tracked the exception down to a binding for a system type > >> > > (java.util.Random) > >> > > in the OPT4J codebase that requires a constructor proxy - Guice checks > >> with > >> > > the BytecodeGen utility class to decide whether it needs a bridge > >> > > classloader > >> > > and it decides it doesn't for a system type, as mentioned in the Guice > >> wiki: > > >> > >    http://code.google.com/p/google-guice/wiki/ClassLoading > > >> > > Unfortunately, the classloader then returned by BytecodeGen is not the > >> Guice > >> > > classloader but the system classloader. Of course this does not have > >> access > >> > > to the internal Guice AOP classes, and the injector blows up :( > > >> > > I tried changing the OPT4J code to avoid the constructor proxy, but I > >> > > couldn't > >> > > get round it without making major changes to the code, so you'll need > >> to use > >> > > a patched version of Guice (at least until this is fixed in trunk) > > >> > > A quick fix would be to remove the following check from > >> BytecodeGen.java: > > >> > >     if (delegate == getSystemClassLoaderOrNull()) { > >> > >       return delegate; > >> > >     } > > >> > > Which would then enable bridging for system types - another option > >> would be > >> > > to return the Guice class loader at this point instead of the system > >> > > classloader: > > >> > >     if (delegate == getSystemClassLoaderOrNull()) { > >> > >       return GUICE_CLASS_LOADER; > >> > >     } > > >> > > Either of these would solve your problem, but they are not complete > >> because > >> > > the Guice classloader won't have access to types in the system > >> classloader > >> > > that don't reside in the "java" namespace (such as javax.* / > >> org.omg.*) > >> > > unless > >> > > of course you enabled OSGi bootdelegation for these packages... > > >> > > I've coded up a solution that doesn't suffer from this and raised a > >> Guice > >> > > issue: > > >> > >    http://code.google.com/p/google-guice/issues/detail?id=343 > > >> > > You can download a patched version of Guice here: > > >> > >http://code.google.com/p/peaberry/source/browse/trunk/lib/build/guice. > >> .. > > >> > > which avoids the AOP exception. > > >> > > Not sure if this patch will make it into Guice 2 because it is in a > >> critical > >> > > piece > >> > > of code, and I don't want to put any undue pressure on Jesse who's > >> already > >> > > done a lot of testing with the current code. > > >> > > Are you ok using the patched build until this is fixed in an official > >> > > release? > > >> > > For configuration details, I also uploaded > > >> > > >http://sdqweb.ipd.uka.de/temp/eclipse-config.txt, > >> > > > which is a copy of the configuration details Eclipse provides > >> > > > in Help -> About Eclipse Platform. I currently use version: > >> 3.4.1build > >> > > > id: M20080911-1700. > > >> > > > Thanks a lot! If you need more information, please let me know. > > >> > > > Kind regards, > >> > > > Anne > > >> > > > On 2 Mrz., 15:22, Stuart McCulloch <mcc...@gmail.com> wrote: > >> > > > > 2009/3/2 Anne Martens <annema...@googlemail.com> > > >> > > > > > Dear Stuart, > > >> > > > > > thanks a lot for your help. > > >> > > > > > Indeed, I only need Guice within a single plugin/bundle. That's > >> why I > >> > > > > > now put the three guice jars (guice-snapshot, > >> guice-multibindings- > >> > > > > > snapshot and aopalliance) back into the "referenced libraries" > >> of my > >> > > > > > opt4j wrapper plugin. I also tried to move the code starting > >> Opt4J to > >> > > > > > a new plugin activator class, that is activated when OSGi loads > >> the > >> > > > > > bundle. > > >> > > > > > Still, I get the same error (with a different stacktrace, of > >> course): > > >> > > > > > com.google.inject.internal.ComputationException: > >> > > > > > com.google.inject.internal.ComputationException: > >> > > > > > com.google.inject.internal.ComputationException: > >> > > > > > com.google.inject.internal.ComputationException: > >> > > > > > com.google.inject.internal.cglib.core.CodeGenerationException: > >> > > > > > java.lang.reflect.InvocationTargetException-->null at > >> com.google.inject.internal.MapMaker$StrategyImpl.compute > >> > > > > > (MapMaker.java:538) at > >> com.google.inject.internal.MapMaker$StrategyImpl.compute > >> > > > > > (MapMaker.java:404) at com.google.inject.internal.CustomConcurrentHashMap > >> > > > > > $ComputingImpl.get(CustomConcurrentHashMap.java:2031) at > >> > > > com.google.inject.internal.FailableCache.get(FailableCache.java: > >> > > > > > 46) at > >> com.google.inject.InjectorImpl$LateBoundConstructor.bind > >> > > > > > (InjectorImpl.java:457) at com.google.inject.ClassBindingImpl.initialize > >> > > > > > (ClassBindingImpl.java:52) at > > >> com.google.inject.InjectorImpl.initializeBinding(InjectorImpl.java: > >> > > > > > 347) at com.google.inject.InjectorImpl.createJustInTimeBinding > >> > > > > > (InjectorImpl.java:639) at > >> > > > com.google.inject.InjectorImpl.createJustInTimeBindingRecursive > >> > > > > > (InjectorImpl.java:584) at com.google.inject.InjectorImpl.getJustInTimeBinding > >> > > > > > (InjectorImpl.java:179) at > > >> com.google.inject.InjectorImpl.getBindingOrThrow(InjectorImpl.java: > >> > > > > > 139) at com.google.inject.InjectorImpl.getInternalFactory > >> > > > > > (InjectorImpl.java:645) at > >> com.google.inject.FactoryProxy.notify(FactoryProxy.java:48) at > >> com.google.inject.BindingProcessor.runCreationListeners > >> > > > > > (BindingProcessor.java:215) at com.google.inject.InjectorBuilder.initializeStatically > >> > > > > > (InjectorBuilder.java:131) at > >> > > > com.google.inject.InjectorBuilder.build(InjectorBuilder.java:105)
  4. 0

    Problems with Guice in Eclipse: Class Loading Exceptions

    Google Groups | 8 years ago | Anne Martens
    java.lang.NoClassDefFoundError: com/google/ >> inject/internal/collect/Lists >> at com.google.inject.multibindings.Multibinder >> $RealMultibinder.initialize(Multibinder.java:254) >> at org.opt4j.start.Opt4JModule.multi(Opt4JModule.java:128) >> >> This was after I fixed a bug in my own code, which might be a reason >> why you did not see it. I uploaded a fixed version of my code to the >> url named above (http://sdqweb.ipd.uka.de/temp/org.opt4j-wrapper- >> plugin.zip<http://sdqweb.ipd.uka.de/temp/org.opt4j-wrapper-%0Aplugin.zip> >> ). >> >> Is it possible that the guice-multibindings-....jar also needs a >> patch? Or is it a problem that multibindings resides in its own jar? >> For the latter, it might be an option to join the two into one jar. >> > > Note this is actually a different issue unrelated to the previous problem, > the issue here is that the multibindings extension uses classes from the > internal Guice package which (rightly) isn't exported > > See http://code.google.com/p/google-guice/issues/detail?id=311 > > If you've got them inside the same Bundle-ClassPath (as you had before) > then it shouldn't matter because the internal package is only hidden from > other bundles / plug-in ... jars on the same Bundle-ClassPath will merge > together just like in a classic Java application > > however, if you're using them as separate bundles then you'd need to > patch the multibindings jar to attach as a fragment to the Guice bundle > as suggested in Issue 311 > > I'll take a look at your updated code to see what's changed... > Aha, found the problem - it's because the packaging of Google-Collection classes inside Guice changed post-20090205... so when you use the old multibindings jar with the new Guice jar there's a package mismatch. In the 20090205 snapshot it was "com.google.inject.internal.common.Lists", now it is "com.google.inject.internal.Lists" - if you build Guice multibindings from trunk (or use the jar I'm going to send you) then everything should work > Kind regards, >> Anne >> >> >> On 3 Mrz., 18:51, Anne Martens <annema...@googlemail.com> wrote: >> > Dear Stuart, >> > >> > thanks a lot for your fast reply! Yes, I'm absolutely ok with using a >> > patched version, I'm glad that there is a readily available solution. >> > >> > I will try it and then let you know. >> > >> > Kind regards >> > from a very happy Anne >> > >> > On 3 Mrz., 17:34, Stuart McCulloch <mcc...@gmail.com> wrote: >> > >> > > 2009/3/3 Anne Martens <annema...@googlemail.com> >> > >> > > > Dear Stuart, >> > >> > > > I have uploaded to code to >> > > >http://sdqweb.ipd.uka.de/temp/org.opt4j-wrapper-plugin.zip. >> > > > You also find a .project file for Eclipse there. Currently, the >> plugin >> > > > needs org.eclipse.core.runtime for the plugin activator >> > > > Opt4JPluginActivator, but you can delete the class and the >> dependency >> > > > if you do not use Eclipse. To get the error, please call >> > > > de.uka.ipd.sdq.dsexplore.opt4j.start.Opt4JStarter.startOpt4J() >> > >> > > Hi Anne, >> > >> > > I tracked the exception down to a binding for a system type >> > > (java.util.Random) >> > > in the OPT4J codebase that requires a constructor proxy - Guice checks >> with >> > > the BytecodeGen utility class to decide whether it needs a bridge >> > > classloader >> > > and it decides it doesn't for a system type, as mentioned in the Guice >> wiki: >> > >> > > http://code.google.com/p/google-guice/wiki/ClassLoading >> > >> > > Unfortunately, the classloader then returned by BytecodeGen is not the >> Guice >> > > classloader but the system classloader. Of course this does not have >> access >> > > to the internal Guice AOP classes, and the injector blows up :( >> > >> > > I tried changing the OPT4J code to avoid the constructor proxy, but I >> > > couldn't >> > > get round it without making major changes to the code, so you'll need >> to use >> > > a patched version of Guice (at least until this is fixed in trunk) >> > >> > > A quick fix would be to remove the following check from >> BytecodeGen.java: >> > >> > > if (delegate == getSystemClassLoaderOrNull()) { >> > > return delegate; >> > > } >> > >> > > Which would then enable bridging for system types - another option >> would be >> > > to return the Guice class loader at this point instead of the system >> > > classloader: >> > >> > > if (delegate == getSystemClassLoaderOrNull()) { >> > > return GUICE_CLASS_LOADER; >> > > } >> > >> > > Either of these would solve your problem, but they are not complete >> because >> > > the Guice classloader won't have access to types in the system >> classloader >> > > that don't reside in the "java" namespace (such as javax.* / >> org.omg.*) >> > > unless >> > > of course you enabled OSGi bootdelegation for these packages... >> > >> > > I've coded up a solution that doesn't suffer from this and raised a >> Guice >> > > issue: >> > >> > > http://code.google.com/p/google-guice/issues/detail?id=343 >> > >> > > You can download a patched version of Guice here: >> > >> > >http://code.google.com/p/peaberry/source/browse/trunk/lib/build/guice. >> .. >> > >> > > which avoids the AOP exception. >> > >> > > Not sure if this patch will make it into Guice 2 because it is in a >> critical >> > > piece >> > > of code, and I don't want to put any undue pressure on Jesse who's >> already >> > > done a lot of testing with the current code. >> > >> > > Are you ok using the patched build until this is fixed in an official >> > > release? >> > >> > > For configuration details, I also uploaded >> > >> > > >http://sdqweb.ipd.uka.de/temp/eclipse-config.txt, >> > > > which is a copy of the configuration details Eclipse provides >> > > > in Help -> About Eclipse Platform. I currently use version: >> 3.4.1build >> > > > id: M20080911-1700. >> > >> > > > Thanks a lot! If you need more information, please let me know. >> > >> > > > Kind regards, >> > > > Anne >> > >> > > > On 2 Mrz., 15:22, Stuart McCulloch <mcc...@gmail.com> wrote: >> > > > > 2009/3/2 Anne Martens <annema...@googlemail.com> >> > Dear Stuart, >> > thanks a lot for your help. >> > Indeed, I only need Guice within a single plugin/bundle. That's >> why I now put the three guice jars (guice-snapshot, >> guice-multibindings- snapshot and aopalliance) back into the "referenced libraries" >> of my opt4j wrapper plugin. I also tried to move the code starting >> Opt4J to a new plugin activator class, that is activated when OSGi loads >> the bundle. >> > Still, I get the same error (with a different stacktrace, of >> course): >> > com.google.inject.internal.ComputationException: com.google.inject.internal.ComputationException: com.google.inject.internal.ComputationException: com.google.inject.internal.ComputationException: com.google.inject.internal.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null at >> com.google.inject.internal.MapMaker$StrategyImpl.compute (MapMaker.java:538) at >> com.google.inject.internal.MapMaker$StrategyImpl.compute (MapMaker.java:404) at com.google.inject.internal.CustomConcurrentHashMap $ComputingImpl.get(CustomConcurrentHashMap.java:2031) at >> > > > com.google.inject.internal.FailableCache.get(FailableCache.java: 46) at >> com.google.inject.InjectorImpl$LateBoundConstructor.bind (InjectorImpl.java:457) at com.google.inject.ClassBindingImpl.initialize (ClassBindingImpl.java:52) at >> com.google.inject.InjectorImpl.initializeBinding(InjectorImpl.java: 347) at com.google.inject.InjectorImpl.createJustInTimeBinding (InjectorImpl.java:639) at >> > > > com.google.inject.InjectorImpl.createJustInTimeBindingRecursive (InjectorImpl.java:584) at com.google.inject.InjectorImpl.getJustInTimeBinding (InjectorImpl.java:179) at >> com.google.inject.InjectorImpl.getBindingOrThrow(InjectorImpl.java: 139) at com.google.inject.InjectorImpl.getInternalFactory (InjectorImpl.java:645) at >> com.google.inject.FactoryProxy.notify(FactoryProxy.java:48) at >> com.google.inject.BindingProcessor.runCreationListeners (BindingProcessor.java:215) at com.google.inject.InjectorBuilder.initializeStatically (InjectorBuilder.java:131) at >> > > > com.google.inject.InjectorBuilder.build(InjectorBuilder.java:105)

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NoClassDefFoundError

      Failed to get fields for class [org.xwiki.git.internal.GitScriptService] because the class [org/eclipse/jgit/lib/Repository] couldn't be found in the ClassLoader.

      at org.xwiki.component.util.ReflectionUtils.getAllFields()
    2. org.xwiki.component
      ComponentAnnotationLoader.initialize
      1. org.xwiki.component.util.ReflectionUtils.getAllFields(ReflectionUtils.java:70)
      2. org.xwiki.component.annotation.ComponentDescriptorFactory.createComponentDescriptor(ComponentDescriptorFactory.java:132)
      3. org.xwiki.component.annotation.ComponentDescriptorFactory.createComponentDescriptors(ComponentDescriptorFactory.java:105)
      4. org.xwiki.component.annotation.ComponentAnnotationLoader.register(ComponentAnnotationLoader.java:164)
      5. org.xwiki.component.annotation.ComponentAnnotationLoader.initialize(ComponentAnnotationLoader.java:139)
      5 frames
    3. org.xwiki.extension
      InstallJob.start
      1. org.xwiki.extension.jar.internal.handler.JarExtensionHandler.loadComponents(JarExtensionHandler.java:145)
      2. org.xwiki.extension.jar.internal.handler.JarExtensionHandler.install(JarExtensionHandler.java:102)
      3. org.xwiki.extension.handler.internal.DefaultExtensionHandlerManager.install(DefaultExtensionHandlerManager.java:80)
      4. org.xwiki.extension.job.internal.InstallJob.installExtension(InstallJob.java:208)
      5. org.xwiki.extension.job.internal.InstallJob.applyAction(InstallJob.java:263)
      6. org.xwiki.extension.job.internal.InstallJob.start(InstallJob.java:161)
      6 frames
    4. org.xwiki.job
      DefaultJobManager.run
      1. org.xwiki.job.AbstractJob.start(AbstractJob.java:134)
      2. org.xwiki.job.internal.DefaultJobManager.run(DefaultJobManager.java:156)
      2 frames
    5. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:680)
      1 frame