[
http://jira.jboss.com/jira/browse/JBRULES-1212?page=comments#action_12378212 ]
Mark Proctor commented on JBRULES-1212:
---------------------------------------
private Class loadOrGenerateProxy(Class clazz,
Rete rete) {
Class shadowClass = null;
final String shadowProxyName = ShadowProxyFactory.getProxyClassNameForClass(
clazz );
try {
// if already loaded
shadowClass = rete.getRuleBase().getMapBackedClassLoader().loadClass(
shadowProxyName );
} catch ( final Throwable e ) {
// swallow this as we want to catch a number of exceptions and then
attempt
// again in the following line, if shadowClass still isn't assigned.
}
if ( shadowClass == null ) {
// otherwise, create and load
final byte[] proxyBytes = ShadowProxyFactory.getProxyBytes( clazz );
if ( proxyBytes != null ) {
rete.getRuleBase().getMapBackedClassLoader().addClass(
shadowProxyName,
proxyBytes );
try {
shadowClass =
rete.getRuleBase().getMapBackedClassLoader().loadClass( shadowProxyName );
} catch ( Throwable e ) {
throw new RuntimeException( "Unable to find or generate the
ShadowProxy implementation for '" + clazz + "'", e);
}
}
}
return shadowClass;
}
Rete throws NoClassDefFoundError when asserting facts with classess
loaded by inaccessible classloader.
--------------------------------------------------------------------------------------------------------
Key: JBRULES-1212
URL:
http://jira.jboss.com/jira/browse/JBRULES-1212
Project: JBoss Rules
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Reteoo
Affects Versions: 4.0.1
Reporter: Alexander Gavrilov
Assigned To: Mark Proctor
Attachments: ReteShadowProxyTest.java
We using drools as part of security enfocement engine in our application, based on
Tapestry4 framework. Tapestry4 pages and components is abstract classes with some abstract
methods, for which tapestry generates implementation at runtime. For example, if i declare
page
public abstract SomePage extends BasePage {
}
Tapestry will generate class in default package like
public SomePage$_0 extends BasePage {
}
On page loading whe using instantiated page objects ans Drools Facts to ensure, that
current user has permissions to load this page. In the previos verions we used (3.0.6) all
worked fine. After update to version 4.0.1 whe got the NoClassDefFoundError when triyng
to assert Page object into working memory.
This is becouse tapestry creates classes for pages in private classloader, which is child
of the application classloader. When Drools tries to generate shadowing proxy for
generated Page class it generate code like
public class SomePage$_0ShadowProxy extends SomePage$_0 {
}
Later, when it tries to load this class with MapBackedClassLoader, it can not find
definition for class SomePage$_0 and throws NoClassDefFoundError. This type of error does
not handled correctly by drools.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira