[jboss-user] [JBoss Microcontainer] - Re: How to stop my WAR loading JBoss's provided 3rd party classes?
Ales Justin
do-not-reply at jboss.com
Mon Dec 13 12:04:31 EST 2010
Ales Justin [http://community.jboss.org/people/alesj] created the discussion
"Re: How to stop my WAR loading JBoss's provided 3rd party classes?"
To view the discussion, visit: http://community.jboss.org/message/575727#575727
--------------------------------------------------------------
> Is there any documentation on how the jboss-classloading-domain.xml file? I'm running into a similar situation with CXF in 6.0.0.CR1 and I'd like to give this a try.
No particular docs, as the usage is quite simple.
Simply drop properly configured jboss-classloading-domain.xml file into your app's META-INF and it should work.
These two code snippest show how parent policy gets created.
(which is what filters cl lookups between cl domains)
public ParentPolicy createParentPolicy()
{
if (parentPolicy == null)
{
if (name != null)
{
String upper = name.toUpperCase();
try
{
Field instance = ParentPolicy.class.getField(upper);
parentPolicy = (ParentPolicy) instance.get(null);
}
catch (Throwable t)
{
throw new RuntimeException("Cannot create parent-policy, wrong name perhaps? - " + name, t);
}
}
else
{
ClassFilter before = (beforeFilter != null) ? beforeFilter.createFilter() : ClassFilterUtils.EVERYTHING;
ClassFilter after = (afterFilter != null) ? afterFilter.createFilter() : ClassFilterUtils.NOTHING;
parentPolicy = new ParentPolicy(before, after, description);
}
}
return parentPolicy;
}
public ClassFilter createFilter()
{
// perhaps it's JavaBean
if (value instanceof ClassFilter)
{
return (ClassFilter) value;
}
else
{
try
{
Class<?> clazz = getClass().getClassLoader().loadClass(filterClassName);
Constructor<?> ctor = (value != null) ? clazz.getDeclaredConstructor(value.getClass()) : clazz.getDeclaredConstructor();
return (ClassFilter) ctor.newInstance(value);
}
catch (Throwable t)
{
throw new RuntimeException("Cannot instantiate filter: " + filterClassName + " / " + value, t);
}
}
}
By default the filterClassName is PackageClassFilter.class.getName().
Let me know if you need some more help.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/575727#575727]
Start a new discussion in JBoss Microcontainer at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20101213/83da6d4d/attachment.html
More information about the jboss-user
mailing list