-
1. Re: Integration with Drools
ffang Apr 15, 2013 3:14 AM (in response to mpalvankar)Hi,
Drools has some issues in OSGi container, so that servicemix re-wrap it as OSGi bundle, please try the one here[1]
http://repo2.maven.org/maven2/org/apache/servicemix/bundles/org.apache.servicemix.bundles.drools/5.5.0.Final_1/
Freeman
-
2. Re: Integration with Drools
mpalvankar Apr 15, 2013 9:47 AM (in response to ffang)Thanks Freeman.
I was able to deploy org.apache.servicemix.bundles/org.apache.servicemix.bundles.drools/5.5.0.Final_1 successfully to FUSE 4.4.1
But there is another issue. My service on FUSE ESB has following code to access and execute a rule.
private void executeRuleWithKAgent(){
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent( "SecurityAgent" );
kagent.applyChangeSet( ResourceFactory.newClassPathResource( "securityValidate2.xml" ) );
KnowledgeBase kbase = kagent.getKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
PortfolioHolding vo = new PortfolioHolding();
vo.setSecurityId("TEST");
ksession.insert(vo);
ksession.fireAllRules();
for (Object o : ksession.getObjects()) {
if (o instanceof PortfolioHolding) {
System.out.println("----
"+((PortfolioHolding) o).getResultMessage());
}
}
kagent.dispose();
System.out.println("----
***-----DONE");}
This requires jaxb-xjc as the code gives compilation errors as:
could not parse error message: org\drools\builder\KnowledgeBuilderFactoryService.java(org\drools\builder:KnowledgeBuilderFactoryService.java):
24: package com.sun.tools.xjc does not exist
import com.sun.tools.xjc.Options;
Hence I tried to deploy org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-xjc/2.2.6_1
This deployment fails as it requires package
com.sun.istack (version=2.2.0)
Appreciate a quick help on this issue.
-
3. Re: Integration with Drools
ffang Apr 15, 2013 10:01 AM (in response to mpalvankar)Hi,
The error message indicates you should install another bundle which export package com.sun.istack (version=2.2.0), this is actually exposed by the jaxb-impl bundle, servicemix also has a wrapper for it.
Freeman
-
4. Re: Integration with Drools
mpalvankar Apr 15, 2013 11:43 AM (in response to ffang)Once again thanks Freeman.
But unfortunately I have some new problem. Now the deployment of org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-xjc/2.2.6_1 fails for constraint
Unresolved constraint in bundle org.apache.servicemix.bundles.jaxb-xjc : Unable to resolve 225.0: missing requirement package; (package=com.sun.source.tree)
I looked for OSGi wrapper for a jar that's exporting com.sun.source.tree, ut I have not been able to find any OSGi bundle exporting package com.sun.source.tree
Any clue for resolving this error. By the way I am using "apache-servicemix-4.4.1-fuse-00-08".
Thank you so much for prompt responses. This forum really rocks.
-
5. Re: Integration with Drools
ffang Apr 15, 2013 8:46 PM (in response to mpalvankar)Hi,
Though Servicemix provide lots of bundles, but it can't provide all necessary bundles for a specific user project(sometimes also due to license issue), so you probably still need create necessary bundles yourself.
Freeman
-
6. Re: Integration with Drools
mpalvankar Apr 16, 2013 11:56 AM (in response to ffang)Thanks Freeman.
This package (com.sun.source.tree) is available in tools.jar a JDK internal package. Repackaging tools.jar will not be viable option.
I also read that JDK internal packages can be made available by setting org.osgi.framework.system.packages.extra in etc\custom.properties file.
Please correct me if I am wrong or if I am missing any information.
-
7. Re: Integration with Drools
ffang Apr 16, 2013 8:06 PM (in response to mpalvankar)Hi,
Yes, you can add it in org.osgi.framework.system.packages.extra property
Freeman
-
8. Re: Integration with Drools
mpalvankar Apr 17, 2013 5:32 AM (in response to ffang)Thanks Freeman.
After updating the properties file with required JDK package, I was able to resolve the deployment issues for org.apache.servicemix.bundles.drools/5.5.0.Final_1.
But now when I deploy a my application / service that uses drools packages, I get below error:
Unable to resolve 239.0: missing requirement package; (&(package=org.mvel2)(version>=2.1.0)(!(version>=3.0.0)))
I checked below things:
1] the bundle org.apache.servicemix.bundles.drools version 5.5.0.Final_1 contains org.mvel2 (2.1.8 Final)
2] My pom file has dependency of org.apache.servicemix.bundles.drools version 5.5.0.Final_1 (I have attached my application pom file)
I am not able understand the above error. Is there anything that I am missing.
Any help on the same is appreciated.
-
pom.xml 3.3 KB
-
-
9. Re: Integration with Drools
ffang Apr 17, 2013 5:44 AM (in response to mpalvankar)Hi,
No, org.apache.servicemix.bundles.drools doesn't export org.mvel2 package, you need install mvel2 bundle yourself.
Freeman
-
10. Re: Integration with Drools
mpalvankar Apr 17, 2013 9:15 AM (in response to ffang)There is no servicemix bundle for mvel2 version 2.1.3.Final. The highest version thats available is org.apache.servicemix.bundles.mvel/2.0.18_3.
I tried wrapping mvel2 2.1.3.Final and deploying the same but this version 2.1.3.Final imports mvel2 2.1.0 and hence I may to wrap mvel2 2.1.0 as osgi bundle and deploy the same to resolve this constraint issue
Can I wrap two jars in one osgi bundle or do I have create two separate osgi bundles for version 2.1.0 and 2.1.3.Final
-
11. Re: Integration with Drools
ffang Apr 17, 2013 10:02 AM (in response to mpalvankar)Hi,
mvel2 2.1.3.Final is already a OSGi bundle so that you needn't wrap it anymore, just do
osgi:install -s mvn:org.mvel/mvel2/2.1.3.Final
should be fine.
Freeman
-
12. Re: Integration with Drools
mpalvankar Apr 19, 2013 7:14 AM (in response to ffang)Thanks Freeman for instant responses. I was able resolve all the issues.
I am also able execute my service on FUSE ESB which retrieves a rule from Guvnor running on Tomcat and execute the same.
Putting down the summary, in case anyone wants to try similar use case.
I installed following bundles to retrieve a rule from Guvnor and execute a rule.
1. org.apache.servicemix.bundles/org.apache.servicemix.bundles.drools/5.5.0.Final_1
2. org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-xjc/2.2.6_1
3. org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-impl/2.2.6_1
4. org.mvel/mvel2/2.1.3.Final
As I have said in my earlier posts, this forum really rocks.
-
13. Re: Integration with Drools
ffang Apr 22, 2013 9:25 PM (in response to mpalvankar)Hi,
Thanks for this positive feedback and sharing your solutions.
Freeman