<div dir="ltr"><br><br><div class="gmail_quote">On Mon, Nov 17, 2008 at 7:17 PM, Maxim Veksler <span dir="ltr">&lt;<a href="mailto:maxim.veksler@gmail.com">maxim.veksler@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<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>

</div></blockquote><div><br>Hello,<br><br>This seems like it should have been the solver of my problem, but for some reason this does not work:<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; PackageBuilderConfiguration pbc = new PackageBuilderConfiguration();<br>
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pbc.setCompiler(PackageBuilderConfiguration.JANINO);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pbc.setClassLoader(DynamicBeanManager.getInstance().getCl());<br><br>Any one got (any) idea about what I&#39;m doing wrong?<br><br><br>Also (a bit off topic), In the old version we used the commented line (setting drl compiler to janino). <br>
Does 4.0.7 version uses JANINO as default?<br><br><br>Thank you,<br>Maxim.<br></div></div><br>-- <br>Cheers, <br>Maxim Veksler<br><br>&quot;Free as in Freedom&quot; - Do u GNU ?<br>
</div>