<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Wildcard support in Dynamic-imports
</h3>
<span style="margin-bottom: 10px;">
reply from <a href="http://community.jboss.org/people/alesj">Ales Justin</a> in <i>JBoss Microcontainer Development</i> - <a href="http://community.jboss.org/message/543228#543228">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><blockquote class="jive-quote">I fixed the module tracking issue<p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code jive-java">      <span style="color: darkgreen;">// Add the modules that can resolve the requirement</span>
      <span style="color: navy;"><strong>for</strong></span> (Module aux : domain.getModules(null, <span style="color: navy;"><strong>null</strong></span>))
      <span style="color: navy;">{</span>
         <span style="color: darkgreen;">// The wildcard policy should not load from this module</span>
         <span style="color: navy;"><strong>if</strong></span> (aux == module)
            <span style="color: navy;"><strong>continue</strong></span>;
        
         <span style="color: darkgreen;">// Add the module if it can resolve the requirement</span>
         <span style="color: navy;"><strong>if</strong></span> (aux.canResolve(requirement))
            modules.add(aux);
      <span style="color: navy;">}</span>
</code></pre>
<p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p>
<p>and the capability resolve issue.</p>
</blockquote><p>This is not done right, as you're not taking parent order into account.</p><p>And the capability issue is a hack, hence it will be removed -- module needs a name.</p><blockquote class="jive-quote"><code class="jive-code">2010-05-15 08:31:19,327 WARN  [org.jboss.detailed.classloader.ClassLoaderManager] Unexpected error during load of:org.jboss.test.osgi.classloader.support.a.A
java.lang.IllegalStateException: No classloader for this module OSGiModule dynamic-wildcard-c:0.0.0
    at org.jboss.classloading.spi.dependency.Module.getResource(Module.java:587)
    at org.jboss.classloading.spi.dependency.policy.WildcardClassLoaderPolicy.findModule(WildcardClassLoaderPolicy.java:113)
    at org.jboss.classloading.spi.dependency.policy.WildcardClassLoaderPolicy.getBaseClassLoader(WildcardClassLoaderPolicy.java:289)
    at org.jboss.classloading.spi.dependency.policy.WildcardDelegateLoader.getBaseClassLoader(WildcardDelegateLoader.java:51)
    at org.jboss.classloader.spi.base.BaseDelegateLoader.getPackage(BaseDelegateLoader.java:160)
    at org.jboss.classloader.spi.filter.FilteredDelegateLoader.getPackage(FilteredDelegateLoader.java:173)
    at org.jboss.classloader.spi.base.BaseClassLoaderDomain.getPackageFromImports(BaseClassLoaderDomain.java:1014)
    at org.jboss.classloader.spi.base.BaseClassLoaderDomain.getPackage(BaseClassLoaderDomain.java:590)
    at org.jboss.classloader.spi.base.BaseClassLoaderDomain.getPackage(BaseClassLoaderDomain.java:1218)
    at org.jboss.classloader.spi.base.BaseClassLoader.getPackage(BaseClassLoader.java:262)
    at org.jboss.classloader.spi.base.BaseClassLoader.definePackage(BaseClassLoader.java:806)
    at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:645)
    at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:609)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:608)
    at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:585)
    at org.jboss.classloader.spi.base.BaseDelegateLoader.loadClass(BaseDelegateLoader.java:138)
    at org.jboss.classloader.spi.base.ClassLoadingTask$ThreadTask.run(ClassLoadingTask.java:461)
    at org.jboss.classloader.spi.base.ClassLoaderManager.nextTask(ClassLoaderManager.java:262)
    at org.jboss.classloader.spi.base.ClassLoaderManager.process(ClassLoaderManager.java:161)
    at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:262)
    at org.jboss.osgi.framework.classloading.OSGiClassLoaderDomain.loadClass(OSGiClassLoaderDomain.java:55)
    at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:1164)
    at org.jboss.classloader.spi.base.BaseClassLoader.loadClassFromDomain(BaseClassLoader.java:883)
    at org.jboss.classloader.spi.base.BaseClassLoader.doLoadClass(BaseClassLoader.java:505)
    at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:450)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at org.jboss.osgi.framework.bundle.OSGiBundleState.loadClass(OSGiBundleState.java:145)
    at org.jboss.osgi.framework.bundle.OSGiBundleWrapper.loadClass(OSGiBundleWrapper.java:171)
    at org.jboss.osgi.testing.OSGiTestHelper.assertLoadClass(OSGiTestHelper.java:278)
    at org.jboss.osgi.testing.OSGiTest.assertLoadClass(OSGiTest.java:213)
    at org.jboss.osgi.testing.OSGiFrameworkTest.assertLoadClass(OSGiFrameworkTest.java:193)
    at org.jboss.test.osgi.classloader.DynamicImportPackageTestCase.testAllPackagesWildcardNotWired(DynamicImportPackageTestCase.java:195)
</code><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>This seems to be caused by an issue that the exporting bundle is not RESOLVED. The BaseClassLoaderDomain can find the resource, but when it comes to the actual load the module has no ClassLoader associated. In OSGi a call to Bundle.loadClass() triggers bundle resolution for the exporting module.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>How can we assure that the module transistions to CLASSLOADER stage after the resource was found, but before the class is loaded. Perhaps that should be done in WildcardClassLoaderPolicy when a resource is found in an unresolved module.</p></blockquote><p>I'll add an extra check whether the Module is actually capabale of loading the class.</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/543228#543228">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Microcontainer Development at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2115">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>