Re: [rules-users] Help : drools implementing
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.(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.(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 rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Help : drools implementing
Hi Thank You For your answer. I understand the problum. I'm using "Sun Java System Application Server". Is there any other way to implement rools, without loading the rule file from an I/O operation in J2EE environment? Thank You Steven Williams-5 wrote: > > J2EE does not allow File I/O so it may be that your app server does not > allow it by default and you need to give your application permission to do > it. This would generally be done in a policy file (in WebSphere it is > was.policy). > > Steve > > On 4/5/07, vista2007 <[EMAIL PROTECTED]> 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.( >> 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.(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#a9851208 >> Sent from the drools - user mailing list archive at Nabble.com. >> >> ___ >> rules-users mailing list >> rules-users@lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/rules-users >> > > > > -- > Steven Williams > > Supervising Consultant > > Object Consulting > Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501 > [EMAIL PROTECTED] > www.objectconsulting.com.au > > consulting | development | training | support > our experience makes the difference > > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > > -- View this message in context: http://www.nabble.com/Help-%3A-drools-implementing-tf3530032.html#a9853558 Sent from the drools - user mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Help : drools implementing
J2EE does not allow File I/O so it may be that your app server does not allow it by default and you need to give your application permission to do it. This would generally be done in a policy file (in WebSphere it is was.policy). Steve On 4/5/07, vista2007 <[EMAIL PROTECTED]> 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.( 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.(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#a9851208 Sent from the drools - user mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Steven Williams Supervising Consultant Object Consulting Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501 [EMAIL PROTECTED] www.objectconsulting.com.au consulting | development | training | support our experience makes the difference ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Help : drools implementing
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.(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.(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#a9851208 Sent from the drools - user mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users