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/578681#578681

--------------------------------------------------------------
Alright, made some progress. When specifying after and before filters it seems 
to have effect, however I've found one issue when trying to setup a 
configuration simulating default classloading behavior for ear deployments.

For ear deployments default is parent-first="false" ie. parent-policy 
"AFTER_BUT_JAVA_BEFORE".
When setting up jboss-classloading-domain.xml this changes to 
parent-first="true" ie. parent-policy "BEFORE"

So what I tried was to modify jboss-classloading.xml to simulate the default 
behavior based on ParentPolicy class:
/** Java and Javax classes before, everything else after */
   public static final ParentPolicy AFTER_BUT_JAVA_BEFORE = new 
ParentPolicy(ClassFilterUtils.JAVA_ONLY, ClassFilterUtils.EVERYTHING, 
"AFTER_BUT_JAVA_BEFORE");

To start from the beginning, I've setup:

<?xml version="1.0" encoding="UTF-8"?>
<classloading-domain xmlns="urn:jboss:classloading-domain:1.0" 
name="jboss.j2ee:extension=LoaderRepository,service=EARDeployment,url=&apos;myapp.ear&apos;"
 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>

However both JavaOnlyClassFilter and EverythingClassFilter have private 
constructor so I'm getting:
java.lang.RuntimeException: Error constructing javabean
Caused by: java.lang.IllegalAccessException: Class 
org.jboss.reflect.plugins.introspection.ReflectionUtils can not access a member 
of class org.jboss.classloader.plugins.filter.JavaOnlyClassFilter with 
modifiers "private"

And by the way - specifying multiple beans within one filter will work?
like for example:
<before-filter>
   <javabean xmlns="urn:jboss:javabean:2.0" 
class="org.jboss.classloader.plugins.filter.JavaOnlyClassFilter" />
   <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>
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/578681#578681]

Start a new discussion in JBoss Microcontainer at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]

_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to