[forge-issues] [JBoss JIRA] (FORGE-980) Failed retrieving forge modules (ClassNotFoundException: org.jboss.forge.maven.plugins.Configuration)

Lennart Jörelid (JIRA) jira-events at lists.jboss.org
Wed Jul 3 12:04:20 EDT 2013


    [ https://issues.jboss.org/browse/FORGE-980?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12787393#comment-12787393 ] 

Lennart Jörelid commented on FORGE-980:
---------------------------------------

h3. ClassLoading bug possibly identified

I provided a classloading debug printout for both potential classloaders (i.e. ThreadContext classloader and 
getClass().getClassLoader()) [attached to this issue as a file]. Assuming those standard classloaders are the
ones actually used (and no JBoss Modules magic contortions are used on this level, the analysis should prove
valid.

None of these 2 standard classloaders contain the JARs copies as module dependencies to the active plugin, and 
I believe that the root cause is illustrated in the debug printout in the attached 
jbossForgeClassLoadingDebugging_1_incorrectRejectionMaybe.png file - the pathFilter of the ModuleClassLoader has 
the REJECT flag set for the dependent JARs of the plugin, implying that no dependencies of the JAR holding the 
plugin are actually present within the classpath of the Forge Plugin class.

h3. Initial conclusion
This is a rather big bug, but should be decently simple to fix - given that the ModuleLoader pathFilter is a simple configuration property.
Attaching a trace file, which acquires the URLs to "/META-INF/MANIFEST.MF" for both classloader hierarchies at two places (within the 
Forge Plugin's constructor and within the command handler method of the Plugin). Note 2 things:

# The Forge APIs are available only in the Constructor of the plugin, and only through the ThreadContext classloader. Is this desired/done by design? 
(i.e. why not provide the forge APIs within the Forge Plugin handler methods too?)
# From what I can see in the debug logs, the ModuleClassLoader claims that it should load classes from the locations where
the dependent modules are kept... but it clearly does not.

The module.xml in the dependencies directory under ~/.forge/plugins/..../dependencies/[correctPluginVersion]/ seems, however,
to contain the correct resource-roots:

{code:xml}
$ cat module.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<module xmlns="urn:jboss:module:1.0" name="se.jguru.nazgul.forge.factory.impl.aggregate.nazgul-forge-factory-impl-aggregate.dependencies" slot="1.0.0-SNAPSHOT-686874c7-26ea-4afb-a271-848133c8fb9c">
  <resources>
   <resource-root path="nazgul-forge-factory-api-1.0.0-SNAPSHOT.jar"/>
    <resource-root path="nazgul-forge-factory-model-1.0.0-SNAPSHOT.jar"/>
    <resource-root path="nazgul-core-persistence-model-1.4.4-SNAPSHOT.jar"/>
    <resource-root path="nazgul-core-xmlbinding-api-1.4.4-SNAPSHOT.jar"/>
    <resource-root path="nazgul-core-reflection-api-1.4.4-SNAPSHOT.jar"/>
    <resource-root path="nazgul-core-algorithms-api-1.4.4-SNAPSHOT.jar"/>
    <resource-root path="jaxb-api-osgi-2.2.7.jar"/>
    <resource-root path="commons-lang3-3.1.jar"/>
    <resource-root path="nazgul-forge-analyzer-impl-nazgul-1.0.0-SNAPSHOT.jar"/>
    <resource-root path="nazgul-forge-analyzer-api-1.0.0-SNAPSHOT.jar"/>
    <resource-root path="slf4j-simple-1.5.10.jar"/>
    <resource-root path="slf4j-api-1.5.10.jar"/>
    <resource-root path="nazgul-tools-validation-aspect-2.0.7.jar"/>
    <resource-root path="nazgul-tools-validation-api-2.0.7.jar"/>
    <resource-root path="aspectjrt-1.7.2.jar"/>
  </resources>
  <dependencies>
   <module name="javax.api"/>
    <module name="org.jboss.forge.shell.api"/>
  </dependencies>
</module>
{code}
                
> Failed retrieving forge modules (ClassNotFoundException: org.jboss.forge.maven.plugins.Configuration)
> -----------------------------------------------------------------------------------------------------
>
>                 Key: FORGE-980
>                 URL: https://issues.jboss.org/browse/FORGE-980
>             Project: Forge
>          Issue Type: Bug
>            Reporter: Lennart Jörelid
>         Attachments: jbossForgeClassLoadingDebugging_1_incorrectRejectionMaybe.png, jbossForgeClassLoadingDebugging_2_okModuleClassLoader.png
>
>
> https://community.jboss.org/message/825612
> Following a successful build, including unit tests for the Forge plugin, the installation (forge source-install . ) fails with a ClassNotFoundException: org.jboss.forge.maven.plugins.Configuration within the ~/.forge/runtime.log.
> This class is located in forge-maven-api, which should be available for all plugins being installed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the forge-issues mailing list