i guess you are reading the drl file from the file syste. Instead i suggest bundle your file with package and using relative path read the file. This is one solution.
The other solution is while start your application server read all the rules from the drl and create a rulebase. so for that you can write your drl parsing code in helper class callable from your servlet. vista2007 wrote: > > I want to call rules from session bean. I implement this by calling a > utility callss from the Session bean method. > That Utility class load the rule file as > > "final Reader source = new > InputStreamReader(BaseRuleImpl.class.getResourceAsStream(rulefile));" > > this gives the result as expected. But it throws an exception in the > server as follows,(Server log) > > java.lang.Throwable > at > com.sun.enterprise.loader.EJBClassLoader$SentinelInputStream.<init>(EJBClassLoader.java:1123) > at > com.sun.enterprise.loader.EJBClassLoader$InternalJarURLConnection.getInputStream(EJBClassLoader.java:1216) > at java.net.URL.openStream(URL.java:1009) > at > java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:1161) > at > com.sun.enterprise.loader.EJBClassLoader.getResourceAsStream(EJBClassLoader.java:782) > at java.lang.Class.getResourceAsStream(Class.java:2030) > at org.drools.semantics.java.RuleBuilder.<clinit>(Unknown Source) > at org.drools.compiler.PackageBuilder.addRule(Unknown Source) > at org.drools.compiler.PackageBuilder.addPackage(Unknown Source) > at org.drools.compiler.PackageBuilder.addPackageFromDrl(Unknown > Source) > at > com.argosoftware.rules.impl.BaseRuleImpl.readRule(BaseRuleImpl.java:29) > at com.argosoftware.rules.impl.RuleImpl.fireRule(RuleImpl.java:54) > at > com.argosoftware.rules.ejb.session.LogicHandlerBean.ruleHandler(LogicHandlerBean.java:42) > > I think this is because of the IO operation. > Can anybody kindly suggest a solution for this.? > > -- View this message in context: http://www.nabble.com/Help-%3A-drools-implementing-tf3530032.html#a9853724 Sent from the drools - user mailing list archive at Nabble.com. _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
