Hi Paul,<br><br>As a temporary solution you could try to use AspectJ for this task (<a href="http://www.eclipse.org/aspectj/">http://www.eclipse.org/aspectj/</a>). Sounds like an ideal fit for this problem. It is a crosscutting concern after all.<br>
<br>You could use an around advice over the following pointcut:<br>call(public boolean java.io.File.Exists(..))<br><br>and simply return false. Then weave this advice to the Drools jars.<br><br>Best Regards,<br>Michal<br>
<br><br><div class="gmail_quote">On Thu, May 14, 2009 at 9:04 PM, Paul Browne <span dir="ltr">&lt;<a href="mailto:paulb@firstpartners.net">paulb@firstpartners.net</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>Geoffrey,</div>
<div> </div>
<div>The stack exception below is Drools looking for the conf file *before* it even looks for the DRL file. However *any* file IO is blocked - so even it Drools got past the File.exists(), it&#39;s likely to throw another SecurityException at the getClass().getResourceAsStream for the DRL file. </div>


<div> </div>
<div>I say &#39;likely&#39; as 3 months ago I was trying to get version 4 of Drools running in an Applet environment (has similar security constraints), and worked my way through the source code to resolve the security exceptions. In that case, getClass().getResourceAsStream was blocked.</div>


<div> </div>
<div>Any suggestions?</div>
<div> </div>
<div>Thanks</div>
<div> </div><font color="#888888">
<div>Paul</div></font><div><div></div><div class="h5">
<div> </div>
<div><br><br> </div>
<div class="gmail_quote">On Wed, May 13, 2009 at 4:51 PM, Geoffrey De Smet <span dir="ltr">&lt;<a href="mailto:ge0ffrey.spam@gmail.com" target="_blank">ge0ffrey.spam@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">Does this File.exists() usage occur even if your DRL is a classpath resource and fetched with getClass().getResourceAsStream()?<br>

<br>With kind regards,<br>Geoffrey De Smet<br><br><br>Paul Browne schreef:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">
<div>Folks,<br><br>Are there any plans to tweak Drools to allow it to run in a security constrained environment such as Google App Engine or Applets? I know some of the other JBoss.org projects have this on the &#39;todo&#39; list.<br>

<br>When I try to load a simple web application using drools into the Google App Engine, I get the error below.The app itself is the sample 8 from the following web page, but tweaked according to the Google &#39;howto&#39; to get it up and running in the app engine; <a href="http://code.google.com/p/red-piranha/" target="_blank">http://code.google.com/p/red-piranha/</a><br>

<br>My understanding of the problem is that drools is using File access to check if the configuration file exists the first time it is run. This is constrained in App Engine - just like the J2EE spec says it should be (although most other app servers allow you to get away with this!). I know that if I tweak the source code there will be other points where similar file access is required.<br>

<br></div>While not trivial, would it be possible to add a one-line check for that the user has permission to do <a href="http://file.io/" target="_blank">file.io</a> &lt;<a href="http://file.io/" target="_blank">http://file.io</a>&gt; before calling File.Exists  (the alternative , of catching and ignoring the AccessControlException is ugly!). The hardest part of this is that the check would need to be added at multiple points in the Drools source code. 
<div><br><br>Any thoughts / comments/ suggestions?<br><br>Paul<br><br></div><a href="http://www.firstpartners.net/blog" target="_blank">www.firstpartners.net/blog</a> &lt;<a href="http://www.firstpartners.net/blog" target="_blank">http://www.firstpartners.net/blog</a>&gt; 
<div>
<div></div>
<div><br><br><br>WARNING: java.security.AccessControlException: access denied (java.io.FilePermission /home/paul/drools.rulebase.conf read)<br>13-May-2009 09:04:16 com.google.apphosting.utils.jetty.JettyLogger warn<br>
WARNING: Nested in javax.servlet.ServletException: java.security.AccessControlException: access denied (java.io.FilePermission /home/paul/drools.rulebase.conf read):<br>java.security.AccessControlException: access denied (java.io.FilePermission /home/paul/drools.rulebase.conf read)<br>

   at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)<br>   at java.security.AccessController.checkPermission(AccessController.java:546)<br>   at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)<br>

   at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:76)<br>   at java.lang.SecurityManager.checkRead(SecurityManager.java:871)<br>   at java.io.File.exists(File.java:731)<br>

   at org.drools.util.ChainedProperties.loadProperties(ChainedProperties.java:225)<br>   at org.drools.util.ChainedProperties.&lt;init&gt;(ChainedProperties.java:59)<br>   at org.drools.util.ChainedProperties.&lt;init&gt;(ChainedProperties.java:31)<br>

   at org.drools.util.ChainedProperties.&lt;init&gt;(ChainedProperties.java:25)<br>   at org.drools.RuleBaseConfiguration.init(RuleBaseConfiguration.java:174)<br>   at org.drools.RuleBaseConfiguration.&lt;init&gt;(RuleBaseConfiguration.java:133)<br>

   at org.drools.common.AbstractRuleBase.&lt;init&gt;(AbstractRuleBase.java:147)<br>   at org.drools.reteoo.ReteooRuleBase.&lt;init&gt;(ReteooRuleBase.java:124)<br>   at org.drools.reteoo.ReteooRuleBase.&lt;init&gt;(ReteooRuleBase.java:101)<br>

   at org.drools.RuleBaseFactory.newRuleBase(RuleBaseFactory.java:57)<br>   at org.drools.RuleBaseFactory.newRuleBase(RuleBaseFactory.java:38)<br>   at net.firstpartners.drools.RuleRunner.loadRules(RuleRunner.java:39)<br>

   at net.firstpartners.drools.RuleRunner.runStatelessRules(RuleRunner.java:167)<br>   at net.firstpartners.rp2.rp2Servlet.callRules(rp2Servlet.java:96)<br>   at net.firstpartners.rp2.rp2Servlet.service(rp2Servlet.java:137)<br>

   at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)<br>   at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)<br>   at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)<br>

   at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)<br>   at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)<br>   at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)<br>

   at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)<br>   at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)<br>   at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)<br>

   at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)<br>   at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:54)<br>   at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)<br>

   at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:306)<br>   at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)<br>   at org.mortbay.jetty.Server.handle(Server.java:313)<br>

   at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)<br>   at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:830)<br>   at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)<br>

   at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)<br>   at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)<br>   at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)<br>

   at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)<br><br><br></div></div>------------------------------------------------------------------------<br><br>_______________________________________________<br>

rules-dev mailing list<br><a href="mailto:rules-dev@lists.jboss.org" target="_blank">rules-dev@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>

</blockquote><br>_______________________________________________<br>rules-dev mailing list<br><a href="mailto:rules-dev@lists.jboss.org" target="_blank">rules-dev@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>

</blockquote></div><br>
</div></div><br>_______________________________________________<br>
rules-dev mailing list<br>
<a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
<br></blockquote></div><br>