[Design of POJO Server] - Re: Scoped domain with java2ParentDelegation=false loads cla
by kabir.khan@jboss.com
"adrian(a)jboss.org" wrote : The second part of your comment doesn't make sense.
| I think you are confusing explicit exports (named packages)
| with the "exportAll" behaviour (packages are discovered from a scan of the deployment
| classpath).
|
| It is clearly trying to load to resource from the classloader and not finding
Both sars contain the same packages. Only the scoped one contains the blah.txt.
This is trying to load it from the correct child domain.
| 2007-10-12 11:33:46,015 TRACE [org.jboss.classloader.spi.base.BaseClassLoaderDomain] ClassLoaderDoma
| in@11b3435{aop.loading:loader=scopedextender1} trying to get resource org/jboss/test/aop/scopedexten
| der/blah.txt from all exports null
|
The rest of the logging seems to be trying to load from a parent (which does not have the resource)
| 2007-10-12 11:34:10,906 TRACE [org.jboss.classloader.spi.ClassLoaderDomain] ClassLoaderDomain@11b343
| 5{aop.loading:loader=scopedextender1} org/jboss/test/aop/scopedextender/blah.txt matches parent afte
| rFilter=<EVERYTHING>
| 2007-10-12 11:34:10,921 TRACE [org.jboss.classloader.spi.ClassLoaderDomain] ClassLoaderDomain@11b343
| 5{aop.loading:loader=scopedextender1} get resource from parent org/jboss/test/aop/scopedextender/bla
| h.txt parent=ClassLoaderDomain@1f21056{<DEFAULT>}
|
For the domain, when registering classloaders the packages are added correctly. For the scoped domain, they are not
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4094562#4094562
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4094562
18 years, 6 months
[Design of POJO Server] - Re: Scoped domain with java2ParentDelegation=false loads cla
by adrian@jboss.org
The second part of your comment doesn't make sense.
I think you are confusing explicit exports (named packages)
with the "exportAll" behaviour (packages are discovered from a scan of the deployment
classpath).
It is clearly trying to load to resource from the classloader and not finding it:
|
| Trying all classloaders in the domain
|
| 2007-10-12 11:34:10,921 TRACE [org.jboss.classloader.spi.base.BaseClassLoaderDomain] ClassLoaderDoma
| in@1f21056{<DEFAULT>} trying to get resource org/jboss/test/aop/scopedextender/blah.txt from all exports [VFSClassLoader
| Policy@c1a0a6]
|
| This one matches.
|
| 2007-10-12 11:34:10,921 TRACE [org.jboss.classloader.spi.filter.FilteredDelegateLoader] FilteredDele
| gateLoader@d63b75{delegate=VFSClassLoaderPolicy@c1a0a6} org/jboss/test/aop/scopedextender/blah.txt m
| atches resource filter=[org.jboss.test.aop.scopedextender, aop-scopedextender-base.jar.META-INF, MET
| A-INF, aop-scopedextender-base.aop.META-INF, aop-scopedextender-base.jar.org.jboss.test.aop.scopedex
| tender]
|
| Tries to find it using the VFS
|
| 2007-10-12 11:34:10,921 TRACE [org.jboss.classloader.spi.base.BaseClassLoader] BaseClassLoader@1b28a
| f8 get resource locally org/jboss/test/aop/scopedextender/blah.txt
|
| Not found!
|
| 2007-10-12 11:34:10,937 TRACE [org.jboss.classloader.spi.base.BaseClassLoader] org.jboss.classloader
| .spi.base.BaseClassLoader$2@d9be5a resource not found locally org/jboss/test/aop/scopedextender/blah
| .txt
|
Like I said earlier, hack the policy to turn off the blacklisting and caching,
but this is clearly irrelevant if it can't find the resource in the first place.
The code to find the resource is:
|
| @Override
| public URL getResource(String path)
| {
| VirtualFile child = findChild(path);
| if (child != null)
| {
| try
| {
| return child.toURL();
| }
| catch (Exception ignored)
| {
| log.trace("Error determining URL for " + child, ignored);
| return null;
| }
| }
| return null;
| }
|
| /**
| * Find a child from a path
| *
| * @param path the path
| * @return the child if found in the roots
| */
| protected VirtualFile findChild(String path)
| {
| for (VirtualFile root : roots)
| {
| try
| {
| return root.findChild(path);
| }
| catch (Exception ignored)
| {
| // not found
| }
| }
| return null;
| }
|
with the "roots" coming from the determineAllPackages() for "exportAll",
you can see this result in the filter of logging above.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4094541#4094541
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4094541
18 years, 6 months
[Design of POJO Server] - Re: Scoped domain with java2ParentDelegation=false loads cla
by kabir.khan@jboss.com
ClassLoaderDomain.getResource() called on the scoped domain always seems to return null for any resource, and also blacklists it:
| ClassLoaderDomain myDomain = getClassLoaderDomain();
| URL blah = myDomain.getResource("org/jboss/test/aop/scopedextender/blah.txt"); //This file definitely exists
| System.out.println("---- FOUND blah.txt " + blah);
|
yields
| 2007-10-12 11:33:46,015 TRACE [org.jboss.classloader.spi.base.BaseClassLoaderDomain] ClassLoaderDomain@11b3435{aop.loading:loader=scopedextender1} trying to get resource org/jboss/test/aop/scopedextender/blah.txt from all exports null
| 2007-10-12 11:34:10,906 TRACE [org.jboss.classloader.spi.ClassLoaderDomain] ClassLoaderDomain@11b3435{aop.loading:loader=scopedextender1} org/jboss/test/aop/scopedextender/blah.txt matches parent afterFilter=<EVERYTHING>
| 2007-10-12 11:34:10,921 TRACE [org.jboss.classloader.spi.ClassLoaderDomain] ClassLoaderDomain@11b3435{aop.loading:loader=scopedextender1} get resource from parent org/jboss/test/aop/scopedextender/blah.txt parent=ClassLoaderDomain@1f21056{<DEFAULT>}
| 2007-10-12 11:34:10,921 TRACE [org.jboss.classloader.spi.ClassLoaderDomain] ClassLoaderDomain@1f21056{<DEFAULT>} org/jboss/test/aop/scopedextender/blah.txt matches parent beforeFilter=<EVERYTHING>
| 2007-10-12 11:34:10,921 TRACE [org.jboss.classloader.spi.ClassLoaderDomain] ClassLoaderDomain@1f21056{<DEFAULT>} get resource from parent org/jboss/test/aop/scopedextender/blah.txt parent=org.jboss.system.NoAnnotationURLClassLoader@56c3cf
| 2007-10-12 11:34:10,921 TRACE [org.jboss.classloader.plugins.loader.ClassLoaderToLoaderAdapter] Resource org/jboss/test/aop/scopedextender/blah.txt NOT found in org.jboss.system.NoAnnotationURLClassLoader@56c3cf
| 2007-10-12 11:34:10,921 TRACE [org.jboss.classloader.spi.ClassLoaderDomain] ClassLoaderDomain@1f21056{<DEFAULT>} resource not found in parent org/jboss/test/aop/scopedextender/blah.txt parent=org.jboss.system.NoAnnotationURLClassLoader@56c3cf
| 2007-10-12 11:34:10,921 TRACE [org.jboss.classloader.spi.base.BaseClassLoaderDomain] ClassLoaderDomain@1f21056{<DEFAULT>} trying to get resource org/jboss/test/aop/scopedextender/blah.txt from all exports [VFSClassLoaderPolicy@c1a0a6]
| 2007-10-12 11:34:10,921 TRACE [org.jboss.classloader.spi.filter.FilteredDelegateLoader] FilteredDelegateLoader@d63b75{delegate=VFSClassLoaderPolicy@c1a0a6} org/jboss/test/aop/scopedextender/blah.txt matches resource filter=[org.jboss.test.aop.scopedextender, aop-scopedextender-base.jar.META-INF, META-INF, aop-scopedextender-base.aop.META-INF, aop-scopedextender-base.jar.org.jboss.test.aop.scopedextender]
| 2007-10-12 11:34:10,921 TRACE [org.jboss.classloader.spi.base.BaseClassLoader] BaseClassLoader@1b28af8 get resource locally org/jboss/test/aop/scopedextender/blah.txt
| 2007-10-12 11:34:10,937 TRACE [org.jboss.classloader.spi.base.BaseClassLoader] org.jboss.classloader.spi.base.BaseClassLoader$2@d9be5a resource not found locally org/jboss/test/aop/scopedextender/blah.txt
| 2007-10-12 11:34:11,156 TRACE [org.jboss.classloader.spi.ClassLoaderDomain] ClassLoaderDomain@1f21056{<DEFAULT>} org/jboss/test/aop/scopedextender/blah.txt does NOT match parent afterFilter=<NOTHING>
| 2007-10-12 11:34:11,156 TRACE [org.jboss.classloader.spi.ClassLoaderDomain] ClassLoaderDomain@11b3435{aop.loading:loader=scopedextender1} resource not found in parent org/jboss/test/aop/scopedextender/blah.txt parent=ClassLoaderDomain@1f21056{<DEFAULT>}
| 2007-10-12 11:34:18,453 INFO [STDOUT] ---- FOUND blah.txt null
|
The problem seems to be that no loaders are able to load up the org.jboss.test.aop.scopedextender package:
| private URL getResourceFromExports(BaseClassLoader classLoader, String name, boolean trace)
| {
| ...
| String packageName = ClassLoaderUtils.getResourcePackageName(name);
| List<ClassLoaderInformation> list = classLoadersByPackageName.get(packageName); //This returns null
| if (trace)
| log.trace(this + " trying to get resource " + name + " from all exports " + list);
| if (list != null && list.isEmpty() == false)
| {
| ...
| }
| // Here is not found in the exports so can we blacklist it?
| if (canBlackList)
| globalResourceBlackList.add(name);
| return null;
| }
|
Digging into this a bit, when registering the BaseClassLoader with the scoped domain there are no packages being registered since these are null in the BaseClassLoader's underlying VFSClassLoaderPolicy.packageNames.
| void registerClassLoader(BaseClassLoader classLoader)
| {
| ...
| ClassLoaderInformation info = new ClassLoaderInformation(classLoader, policy, order++);
| classLoaders.add(info);
| infos.put(classLoader, info);
|
| // Index the packages
| String[] packageNames = policy.getPackageNames();
| if (packageNames != null && info.getExported() != null) //both of these are null
| {
| ...
| }
|
My AS trunk is pretty out of date, so I will try refreshing that
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4094524#4094524
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4094524
18 years, 6 months