<div dir="ltr">Hello Everyone,<br><br>Here&#39;s a fun stuff to debug:<br><br><br>In our application we are using the concept of &quot;Dynamic Beans&quot;, Drools is running in a webapp. The servlet container is tomcat6.<br>
<br>Dynamic beans are beans we compile from java code and then load with a custom class loader. This happens in the following method :<br><br>The class that implements ServletContextListener has in his contextInitialized(...) method a code to do the following: (simplification)<br>
<br>ClassLoader cl = Janino.JavaSourceClassLoader(...)<br>originalCl = Thread.currentThread().getContextClassLoader();<br>
Thread.currentThread().setContextClassLoader(cl);<br>
<br>The above code allowed drools3 to find the Dynamic Classes (which didn&#39;t even
existed, not to be mention were available to ANY classloader).<br><br><br>Now, inside the .drl files we use properties from these dynamic beans - This allows us to be dynamic on the properties we can filter by.<br><br>All good, but now comes the new Drools4 code. The application is no longer able to find the mentioned classes. <br>
The only changes the I&#39;ve done was change Drools version from 3 to 4. <br><br>The errors I&#39;m getting are of the form :<br><br>Rule Compilation error : [Rule name=X Status, agendaGroup=MAIN, salience=0, no-loop=false]<br>
&nbsp;&nbsp;&nbsp; com/X/ruleEngine/filtering/Rule_X_Status_0.java (2:267) : Only a type can be imported. com.X.common.dataModel.facts.dynamic.X resolves to a package<br>&nbsp;&nbsp;&nbsp; com/X/ruleEngine/filtering/Rule_X_Status_0.java (2:334) : Only a type can be imported. com.X.common.dataModel.facts.dynamic.X resolves to a package<br>
&nbsp;&nbsp;&nbsp; com/X/ruleEngine/filtering/Rule_X_Status_0.java (2:1111) : Only a type can be imported. com.X.common.dataModel.facts.banner.X resolves to a package<br>&nbsp;&nbsp;&nbsp; com/X/ruleEngine/filtering/Rule_X_Status_0.java (2:1379) : The import com.X.common.dataModel.facts.X.X cannot be resolved<br>
...<br><br>Anyone has ideas how to over come this?<br><br>I&#39;m currently searching for alternatives, I&#39;m thinking about Configuring my custom class loader at the webapp level or something like that... <br>Help would be appreciated as I&#39;m not getting much success.<br>
<br>-- <br>Cheers, <br>Maxim Veksler<br><br>&quot;Free as in Freedom&quot; - Do u GNU ?<br>
</div>