Petr H [
http://community.jboss.org/people/hostalp] 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/578782#578782
--------------------------------------------------------------
You are controlling this by the before-filter config.
If it's AFTER_BUT_JAVA_ONLY then it's the same as what you get with
parent-first=false.
jb-cl-domain.xml is by default java-se compliant, meaning parent-first=true.
It could be debated what should be the default, but I think this is more natural.
before-filter? Didn't you mean parent-policy instead? Because what could be simply
done is:
<?xml version="1.0" encoding="UTF-8"?>
<classloading-domain xmlns="urn:jboss:classloading-domain:1.0"
name="jboss.j2ee:extension=LoaderRepository,service=EARDeployment,url='ibs.ear'"
parent-domain="DefaultDomain">
<parent-policy name="AFTER_BUT_JAVA_BEFORE">
<before-filter>
<javabean xmlns="urn:jboss:javabean:2.0"
class="org.jboss.classloader.plugins.filter.NegatingClassFilter">
<constructor>
<parameter>
<javabean xmlns="urn:jboss:javabean:2.0"
class="org.jboss.classloader.spi.filter.RecursivePackageClassFilter">
<constructor>
<parameter>org.hibernate</parameter>
</constructor>
</javabean>
</parameter>
</constructor>
</javabean-->
</before-filter>
<after-filter>
<javabean xmlns="urn:jboss:javabean:2.0"
class="org.jboss.classloader.plugins.filter.NegatingClassFilter">
<constructor>
<parameter>
<javabean xmlns="urn:jboss:javabean:2.0"
class="org.jboss.classloader.spi.filter.RecursivePackageClassFilter">
<constructor>
<parameter>org.hibernate</parameter>
</constructor>
</javabean>
</parameter>
</constructor>
</javabean>
</after-filter>
</parent-policy>
</classloading-domain>
but then only parent policy is set to AFTER_BUT_JAVA_BEFORE and additional filters have no
effect.
Equivalent to AFTER_BUT_JAVA_BEFORE parent policy via filters would be that already
posted:
<?xml version="1.0" encoding="UTF-8"?>
<classloading-domain xmlns="urn:jboss:classloading-domain:1.0"
name="jboss.j2ee:extension=LoaderRepository,service=EARDeployment,url='myapp.ear'"
parent-domain="DefaultDomain">
<parent-policy>
<before-filter>
<javabean xmlns="urn:jboss:javabean:2.0"
class="org.jboss.classloader.plugins.filter.JavaOnlyClassFilter" />
</before-filter>
<after-filter>
<javabean xmlns="urn:jboss:javabean:2.0"
class="org.jboss.classloader.plugins.filter.EverythingClassFilter" />
</after-filter>
</parent-policy>
</classloading-domain>
but that of course doesn't work because of private constructors (and even if it would
work it wouldn't be of much help when multiple filters can't be specified in each
(before/after) section).
As a quick solution I've currently removed the hibernate-validator-legacy.jar from
JBoss libs which got us further, but I'll try to look at some solution with combining
filters. but generally I was hoping that this jboss-classloading-domain.xml approach would
bring an easy solution right away - at least for this case which is probably to be used
most - I believe.
And yes, I too think that parent-first is more natural, but the weirdness here is that
"plain default" is false while adding classloading config turns it automatically
into true. Then if you want to use filters the previous behavior changes significantly
just because of that. The optimal target would be either to allow for multiple filters
directly, or at least alllow change the parent-first state and let filters work over it.
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/578782#578782]
Start a new discussion in JBoss Microcontainer at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]