[jboss-jira] [JBoss JIRA] (DROOLS-466) Reading Rules packaged inside jar

Ashish Nayyar (JIRA) issues at jboss.org
Tue May 6 19:02:56 EDT 2014


    [ https://issues.jboss.org/browse/DROOLS-466?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12965979#comment-12965979 ] 

Ashish Nayyar commented on DROOLS-466:
--------------------------------------

I am using Kie-spring (6.1.0-Beta) in the project and following is the scenario. If I rename 'knowledge-services.xml' to 'kmodule.xml' my context does not loads up as it expects the file with knowledge-services,xml.

//This project is built from BRMS and the rules repository is maintained there.
project-rules-repo:
---All the data model used in the rules
---all the rule files in src/main/resources folder.
--knowledge-services.xml  (contains Spring configuration and kie module related stuff)

//This project source is in some other location.
project-war-file
--All the UI and Spring controllers 
--includes the above project as a maven dependency

The build is configured in such a way that it first build the rules repository and then the main war file. The intent is to always have latest rules in the war file as a dependent JAR.

if i run the rules with this setup shown above, the rules are not fired. I only see in logs that objects are asserted etc. the console logging done in the rules are not displayed.

if I copy all the rules from 'project-rules-repo' into 'WEB-INF/rules' directory of the 'project-war', the rules run fine.
I have tried adding the maven dependency for jboss-vfs (as suggested by Mark, but it did not worked).

Some server startup logs...


08:51:30,615 INFO  [org.jboss.web] (ServerService Thread Pool -- 209) JBAS018210: Register web context: /DSAASRuleEngine
08:51:30,619 INFO  [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/DSAASRuleEngine]] (ServerService Thread Pool -- 209) No Spring WebApplicationInitializer types detected on classpath
08:51:30,624 INFO  [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/DSAASRuleEngine]] (ServerService Thread Pool -- 209) Initializing Spring root WebApplicationContext
08:51:30,624 INFO  [org.springframework.web.context.ContextLoader] (ServerService Thread Pool -- 209) Root WebApplicationContext: initialization started
08:51:30,655 INFO  [org.springframework.web.context.support.AnnotationConfigWebApplicationContext] (ServerService Thread Pool -- 209) Refreshing Root WebApplicationContext: startup date [Wed May 07 08:51:30 EST 2014]; root of context hierarchy
08:51:30,683 INFO  [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] (ServerService Thread Pool -- 209) JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
08:51:30,683 INFO  [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] (ServerService Thread Pool -- 209) JSR-330 'javax.inject.Named' annotation found and supported for component scanning
08:51:30,684 INFO  [org.springframework.web.context.support.AnnotationConfigWebApplicationContext] (ServerService Thread Pool -- 209) Successfully resolved class for [au.org.nps.dsaas.re.config.RootConfiguration]
08:51:30,718 INFO  [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] (ServerService Thread Pool -- 209) JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
08:51:30,719 INFO  [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] (ServerService Thread Pool -- 209) JSR-330 'javax.inject.Named' annotation found and supported for component scanning
08:51:30,750 INFO  [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (ServerService Thread Pool -- 209) Loading XML bean definitions from class path resource [beans.xml]
08:51:30,767 INFO  [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (ServerService Thread Pool -- 209) Loading XML bean definitions from class path resource [knowledge-services.xml]
08:51:30,840 INFO  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] (ServerService Thread Pool -- 209) Loading properties file from class path resource [com/expedia/config/application.properties]
08:51:30,846 INFO  [org.kie.spring.KModuleBeanFactoryPostProcessor] (ServerService Thread Pool -- 209) classpath root URL: vfs:/C:/Apps/jboss-eap-6.1/standalone/deployments/DSAASRuleEngine.war/WEB-INF/classes/
08:51:30,846 INFO  [org.kie.spring.KModuleBeanFactoryPostProcessor] (ServerService Thread Pool -- 209) :: BeanFactoryPostProcessor::postProcessBeanFactory called ::
08:51:30,906 INFO  [org.drools.compiler.kie.builder.impl.ClasspathKieProject] (ServerService Thread Pool -- 209) Virtual file physical path = C:\Apps\jboss-eap-6.1\standalone\deployments\DSAASRuleEngine.war\WEB-INF\classes
08:51:30,906 DEBUG [org.drools.compiler.kie.builder.impl.ClasspathKieProject] (ServerService Thread Pool -- 209) KieModule URL type=vfs url=\Apps\jboss-eap-6.1\standalone\deployments\DSAASRuleEngine.war\WEB-INF\classes
08:51:30,909 DEBUG [org.drools.compiler.kie.builder.impl.ClasspathKieProject] (ServerService Thread Pool -- 209) Found and used pom.properties \Apps\jboss-eap-6.1\standalone\deployments\DSAASRuleEngine.war\META-INF\maven\au.org.nps\DSAAS-rules-engine\pom.properties
08:51:30,910 INFO  [org.kie.spring.KModuleBeanFactoryPostProcessor] (ServerService Thread Pool -- 209) Found project with releaseId: test::DSAAS-rules-engine:0.0.1-SNAPSHOT
08:51:30,923 INFO  [org.kie.spring.KModuleBeanFactoryPostProcessor] (ServerService Thread Pool -- 209) adding KieModule from vfs:/C:/Apps/jboss-eap-6.1/standalone/deployments/DSAASRuleEngine.war/WEB-INF/classes/ to repository.
08:51:30,925 INFO  [org.drools.compiler.kie.builder.impl.KieRepositoryImpl] (ServerService Thread Pool -- 209) KieModule was added:FileKieModule[ ReleaseId=au.org.nps:DSAAS-rules-engine:0.0.1-SNAPSHOTfile=\Apps\jboss-eap-6.1\standalone\deployments\DSAASRuleEngine.war]
08:51:30,927 INFO  [org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor] (ServerService Thread Pool -- 209) JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
08:51:30,935 INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] (ServerService Thread Pool -- 209) Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory at 3a5abfaf: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,rootConfiguration,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,loader,properties,restTemplate,jsonParser,fhirRequestTransformer,droolsFactBuilder,requestProcessor,fhirsonParserWrapper,fhirRequestValidator,rulesProcessor,ksession1_fl0,ksession1,kie-base,kie-spring,kiePostProcessor,dtsValueSet]; root of factory hierarchy
08:51:31,318 INFO  [stdout] (ServerService Thread Pool -- 209)  wagon http use multi threaded http connection manager maxPerRoute 20, max total 40

08:51:34,345 DEBUG [org.drools.core.reteoo.ReteooRuleBase] (ServerService Thread Pool -- 209) Starting Engine in PHREAK mode
08:51:34,911 DEBUG [org.drools.core.reteoo.ReteooRuleBase] (ServerService Thread Pool -- 209) Starting Engine in PHREAK mode
08:51:35,021 INFO  [org.springframework.web.context.ContextLoader] (ServerService Thread Pool -- 209) Root WebApplicationContext: initialization completed in 4397 ms
08:51:35,034 INFO  [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/DSAASRuleEngine]] (ServerService Thread Pool -- 209) Initializing Spring FrameworkServlet 'dispatcher'
08:51:35,034 INFO  [org.springframework.web.servlet.DispatcherServlet] (ServerService Thread Pool -- 209) FrameworkServlet 'dispatcher': initialization started

> Reading Rules packaged inside jar
> ---------------------------------
>
>                 Key: DROOLS-466
>                 URL: https://issues.jboss.org/browse/DROOLS-466
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 6.0.1.Final
>            Reporter: Ashish Nayyar
>            Assignee: Mario Fusco
>              Labels: drools, drools-compiler
>
> I am working on DROOLS 6.0.1 application. I have my rule files (*.drl) packaged inside a separate project which is included as a jar file as a maven dependency. When I deploy my project, KIEModule is not able to find the rules files (which are packaged inside the jar above). I am not getting an error though but rules are not getting fired.
> If I manually place the rules files under classpath say WEB-INF/rules/*.drl they are detected and rules are executed.
> I was under impression that KIEmodules are auto discovered from anywhere in classpath.
> Any pointers are appreciated. This is general question hence I have not included the comprehensive code files. Everything start working once I place the *.drl files in the classpath (take them outside of jar).
> On Further invstigation by looking into the code, I found that 
> addFiles(assets,  kBaseModel, kModule);
> Call from "AbstractKieModule" fails and its not able to find the rules packaged inside the JAR file placed under WEB-INF\lib folder. I get this warning message on the console
> 08:40:02,113 WARN  [org.drools.compiler.kie.builder.impl.AbstractKieModule] (ServerService Thread Pool -- 55) No files found for KieBase kie-base-old, searching folder \Apps\jboss-eap-6.1\standalone\deployments\Application.war



--
This message was sent by Atlassian JIRA
(v6.2.3#6260)


More information about the jboss-jira mailing list