Can we run drools 5 and drool 6 in parallel in same application ( drools- spring ) integration application -


i have existing application based on drools 5 rules engine , need migrate drools 6 can not in 1 go i.e have in multiple stages . requirement want support droosl 5 , drool 6 execution in parallel in same application .

for  have created sample poc  1) created drools spring integration application having both drools 5 , drool 6 spring integration configuration files .  drools 5 :  <beans xmlns="http://www.springframework.org/schema/beans"     xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context"     xmlns:util="http://www.springframework.org/schema/util" xmlns:oxm="http://www.springframework.org/schema/oxm"     xmlns:drools="http://drools.org/schema/drools-spring"     xsi:schemalocation="http://www.springframework.org/schema/beans       http://www.springframework.org/schema/beans/spring-beans-3.1.xsd       http://www.springframework.org/schema/context       http://www.springframework.org/schema/context/spring-context-3.1.xsd       http://www.springframework.org/schema/util       http://www.springframework.org/schema/util/spring-util-3.1.xsd       http://www.springframework.org/schema/oxm       http://www.springframework.org/schema/oxm/spring-oxm-3.1.xsd       http://drools.org/schema/drools-spring org/drools/container/spring/drools-spring-1.2.0.xsd       http://camel.apache.org/schema/spring       http://camel.apache.org/schema/spring/camel-spring.xsd">      <drools:grid-node id="node" />       <drools:kbase id="drools5kbase" node="node">         <drools:resources >             <!-- <drools:resource type="drf" source="classpath:rules/distribution/regulatory/test.rf" /> -->             <drools:resource type="drl" source="classpath:rules/sample.drl" />         </drools:resources>           </drools:kbase>      </beans>   ****drools 6 :****   <kie:kmodule id="drools6poc">          <kie:kbase name="rules-two" packages="rules.two" />          <kie:kbase name="drools6kiebase" packages="rules, process" includes="rules-two">             <!--<kie:ksession name="ksessionrules">                 <kie:filelogger file="drools.log" threaded="true" interval="10" />                 <kie:listeners>                     <kie:ruleruntimeeventlistener ref="org.kie.api.event.rule.debugruleruntimeeventlistener" />                     <kie:agendaeventlistener ref="org.kie.api.event.rule.debugagendaeventlistener" />                     <kie:processeventlistener ref="org.drools.core.event.debugprocesseventlistener" />                 </kie:listeners>             </kie:ksession>              -->              </kie:kbase>      </kie:kmodule>     2) added maven depencies both drools 5 , drools 6 changing drools 5 standard jar's group id , arctifact id in order avoid version overwite   3) above  configuration drools 6 working fine while loading drools 5 spring configuration file getting error   info: pre-instantiating singletons in org.springframework.beans.factory.support.defaultlistablebeanfactory@70c44470: defining beans [node,drools5kbase,drools5ruleset]; root of factory hierarchy apr 20, 2015 12:11:33 pm org.springframework.beans.factory.support.defaultsingletonbeanregistry destroysingletons info: destroying singletons in org.springframework.beans.factory.support.defaultlistablebeanfactory@70c44470: defining beans [node,drools5kbase,drools5ruleset]; root of factory hierarchy org.springframework.beans.factory.beancreationexception: error creating bean name 'drools5kbase': invocation of init method failed; nested exception org.drools.runtimedroolsexception: unable load dialect 'org.drools.compiler.rule.builder.dialect.mvel.mveldialectconfiguration:mvel:org.drools.compiler.rule.builder.dialect.mvel.mveldialectconfiguration'     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1455)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:519)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:456)     @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:294)     @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:225)     @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:291)     @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:193)     @ org.springframework.beans.factory.support.defaultlistablebeanfactory.preinstantiatesingletons(defaultlistablebeanfactory.java:567)     @ org.springframework.context.support.abstractapplicationcontext.finishbeanfactoryinitialization(abstractapplicationcontext.java:913)     @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:464)     @ org.springframework.context.support.classpathxmlapplicationcontext.<init>(classpathxmlapplicationcontext.java:139)     @ org.springframework.context.support.classpathxmlapplicationcontext.<init>(classpathxmlapplicationcontext.java:83)     @ com.sample.service.processandruleservice.main(processandruleservice.java:55) caused by: org.drools.runtimedroolsexception: unable load dialect 'org.drools.compiler.rule.builder.dialect.mvel.mveldialectconfiguration:mvel:org.drools.compiler.rule.builder.dialect.mvel.mveldialectconfiguration'     @ org.drools.compiler.packagebuilderconfiguration.adddialect(packagebuilderconfiguration.java:310)     @ org.drools.compiler.packagebuilderconfiguration.builddialectconfigurationmap(packagebuilderconfiguration.java:295)     @ org.drools.compiler.packagebuilderconfiguration.init(packagebuilderconfiguration.java:184)     @ org.drools.compiler.packagebuilderconfiguration.<init>(packagebuilderconfiguration.java:162)     @ org.drools.builder.impl.knowledgebuilderfactoryserviceimpl.newknowledgebuilderconfiguration(knowledgebuilderfactoryserviceimpl.java:22)     @ org.drools.builder.knowledgebuilderfactory.newknowledgebuilderconfiguration(knowledgebuilderfactory.java:74)     @ org.drools.container.spring.beans.knowledgebasebeanfactory.afterpropertiesset(knowledgebasebeanfactory.java:80)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.invokeinitmethods(abstractautowirecapablebeanfactory.java:1514)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1452)     ... 12 more caused by: java.lang.classcastexception: org.drools.compiler.rule.builder.dialect.mvel.mveldialectconfiguration cannot cast org.drools.compiler.dialectconfiguration     @ org.drools.compiler.packagebuilderconfiguration.adddialect(packagebuilderconfiguration.java:305)     ... 20 more   4) pom.xml   <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">   <modelversion>4.0.0</modelversion>   <groupid>testdroolsversion</groupid>   <artifactid>testdroolsversion</artifactid>   <version>1.0.0</version>   <name>testdroolsversion</name>   <description>testdroolsversion</description>        <properties>         <project.build.sourceencoding>utf-8</project.build.sourceencoding>          <drools6.version>6.1.0.final</drools6.version>          <spring.framework.version>3.1.0.release</spring.framework.version>          <mvel2.version>2.1.0.drools4</mvel2.version>        </properties>      <build>         <plugins>             <plugin>                 <groupid>org.kie</groupid>                 <artifactid>kie-maven-plugin</artifactid>                 <version>${drools6.version}</version>                 <extensions>true</extensions>               </plugin>         </plugins>     </build>       <dependencies>     <dependency>             <groupid>org.drools</groupid>             <artifactid>drools-compiler</artifactid>             <version>6.1.0.final</version>         </dependency>         <dependency>             <groupid>org.kie</groupid>             <artifactid>kie-api</artifactid>             <version>6.1.0.final</version>         </dependency>            <dependency>             <groupid>org.kie</groupid>             <artifactid>kie-ci</artifactid>             <version>6.1.0.final</version>         </dependency>         <dependency>             <groupid>org.kie</groupid>             <artifactid>kie-spring</artifactid>             <version>6.1.0.final</version>         </dependency>         <dependency>             <groupid>org.jbpm</groupid>             <artifactid>jbpm-bpmn2</artifactid>             <version>6.1.0.final</version>         </dependency>         <dependency>             <groupid>junit</groupid>             <artifactid>junit</artifactid>             <version>4.11</version>             <scope>test</scope>         </dependency>         <dependency>             <groupid>org.apache.logging.log4j</groupid>             <artifactid>log4j-core</artifactid>             <version>2.0.2</version>         </dependency>         <dependency>             <groupid>org.apache.logging.log4j</groupid>             <artifactid>log4j-slf4j-impl</artifactid>             <version>2.0.2</version>         </dependency>           <!-- start : drools 5  -->              <dependency>             <groupid>org.drools.custom</groupid>             <artifactid>drools-core-custom</artifactid>             <version>5.3.1.final</version>              <scope>provided</scope>         </dependency>          <dependency>             <groupid>org.drools.custom</groupid>             <artifactid>drools-compiler-custom</artifactid>             <version>5.3.1.final</version>              <exclusions>                 <exclusion>                     <groupid>org.mvel</groupid>                     <artifactid>mvel2</artifactid>                 </exclusion>             </exclusions>             <scope>provided</scope>         </dependency>            <dependency>             <groupid>org.drools</groupid>             <artifactid>drools-spring</artifactid>                 <version>5.3.1.final</version>          </dependency>          <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-context</artifactid>             <version>${spring.framework.version}</version>         </dependency>         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-core</artifactid>             <version>${spring.framework.version}</version>         </dependency>         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-beans</artifactid>             <version>${spring.framework.version}</version>         </dependency>          <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-tx</artifactid>             <version>${spring.framework.version}</version>         </dependency>        </dependencies>   </project>   appriciated .  1) can support drools 5 , drool 6 in parallel in same classpath   2) if yes there way or 1 have sample   , regards  sri 

it's possible run multiple versions of drools on same container, in case both versions being installed in same assembly.

using maven it's possible have parent pom project , multiple module sub-project structure. in case there not classpath collisions on drools compiler , work. otherwise conflicting versions in same project need maven exclusions , i'm work correctly.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -