[Design of POJO Server] - Re: Classloader problem with NamingRestartUnitTestCase
by adrian@jboss.org
The ClassAdapter is retrieved during this processing in AbstractKernelConfigurator
| public BeanInfo getBeanInfo(BeanMetaData metaData) throws Throwable
| {
| ClassLoader cl = Configurator.getClassLoader(metaData);
| String className = metaData.getBean();
| if (className == null)
| return null;
| return getBeanInfo(className, cl);
| }
|
The links are:
BeanInfo -> ClassAdapter -> ClassInfo -> Class
The AnnotatedElement is just the real Class.
The Configurator.getClassLoader(...) uses the thread context classloader
to load the class if there isn't a specific one configured (which in your case
there isn't - that comes with the next gen of the MC :-).
So it looks like there are three options for why it fails.
1) The TCL is wrong. e.g. something is setting the TCL on the RMI thread
and not resetting it.
2) Somehow it is able to lookup the old class in the old classloader
without getting an error
3) There is some bad caching going on somewhere
(the BeanInfo/ClassInfo caches are based on classloader so (1) would
also appear as this problem).
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4126722#4126722
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4126722
18 years, 2 months
[Design of POJO Server] - Re: Classloader problem with NamingRestartUnitTestCase
by bstansberry@jboss.com
Quick report as I poke around in this as well.
Looking more into what AOPDependencyBuild.getDependencies does, following from the AspectManagerFactory.getAspectManager() call you highlighted:
| AspectManager manager = AspectManagerFactory.getAspectManager(metaData);
| try
| {
| ClassInfo classInfo = classAdapter.getClassInfo();
| String className = classInfo.getName();
| if (className != null)
| {
| ClassLoader loader = classAdapter.getClassLoader();
| if (loader == null)
| {
| loader = Thread.currentThread().getContextClassLoader();
| }
| Class clazz = loader.loadClass(className);
|
The classAdapter.getClassLoader() call is returning the BaseClassLoader from the previous deployment. That happens before any usage is made of the AspectManager.
Looking more into that, I see a chain of AbstractBeanInfo.classAdapter.classInfo.getType().getClassLoader(). Looking at classInfo.getType() I see it's actually ClassInfoImpl.annotatedElement.
I'm going to poke a bit more and see if I can figure out where the AbstractBeanInfo and the ClassInfoImpl.annotatedElement are coming from.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4126708#4126708
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4126708
18 years, 2 months
[Design the new POJO MicroContainer] - FileStructure and FileMatcher
by adrian@jboss.org
A while ago we discussed adding FileMatcher "incallbacks" to the FileStructure
so we automatically added recognised file suffixes as subdeployments.
But this wasn't completed properly. Instead of making all
AbstractParsingDeployerWithOutputs (which knows about suffixes)
into FileMatcher implementations, only the bean shell deployer does this.
If we did this for every parsing deployer, then there would be no need for any hardwiring
in the FileStructure, e.g. -ds.xml and -service.xml
It would also correctly fail those deployments when the relevant parsing deployer
wasn't present. e.g. currently it will add -ds.xml as a subdeployment even
if the DataSource deployer isn't installed and then fail it with
"nobody processed the subdeployment" later on.
An additional request from Mark Newton is to apply the file matching process
to top level deployments as well.
Currently we allow a top level deployment to be called anything,
but that doesn't mean it will be correctly processed if the parsing deployer
doesn't recognise it.
The reasoning behind this was that I didn't want to have configure all
the suffixes in two places (the FileStructure and the ParsingDeployer),
but if the above change is implemented this argument goes away.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4126700#4126700
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4126700
18 years, 2 months
[Design the new POJO MicroContainer] - Re: VersionImpl is not correct.
by adrian@jboss.org
"alesj" wrote :
| If you let any Version type to be present in our VersionRange, then you would have to let version be Object, which is a lot less type safe than our Version approach with comparators and thin wrappers present.
|
You read my mind. That is the approach I'm taking. i.e. I've removed the Version
interface altogether and just use an Object in its place in the spi.
I originally tried Comparable but that was redundant and messy since we don't really
use the compareTo() directly except when when comparing versions
of the same type (and even then that's not really a requirement ;-).
I'm also adding a default String <-> Version comparator
so in prinicple you could just a String as your version.
But this isn't as efficient since potentially it has to parse the String ever
time it wants to compare it, e.g. probably twice to do a VersionRange check.
What this does mean is that there is no VersionImpl in what is now a public spi.
There is just our Version class that can be compared to other version classes
(including Strings :-) using the VersionComparators.
P.S. The hashCode() problem is unsolvable. So it is probably best to just
document that "versions" (and anything that uses a "version" in its identity)
should be stored in Sorted Sets and Maps using a comparator based
on the VersionComparatorRegistry NOT the hashed collections.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4126688#4126688
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4126688
18 years, 2 months