Skip to content
This repository has been archived by the owner on Nov 24, 2020. It is now read-only.

Unable to deploy drool camel samples for neither for blueprint nor Spring. #5

Open
chiippy opened this issue Jul 28, 2015 · 8 comments
Assignees

Comments

@chiippy
Copy link

chiippy commented Jul 28, 2015

Maven compiles successfully.
When perform the install in the fuse shell :

JBossFuse:karaf@root> features:install drools-decisiontable-kie-blueprint-camel
Error executing command: Could not start bundle mvn:org.apache.camel/camel-cxf/2.14.0 in feature(s) camel-cxf-2.14.0: Us
es constraint violation. Unable to resolve bundle revision org.apache.camel.camel-cxf [313.0] because it is exposed to p
ackage 'org.apache.camel.converter.jaxp' from bundle revisions org.apache.camel.camel-core [311.0] and org.apache.camel.
camel-core [198.0] via two dependency chains.

Chain 1:
org.apache.camel.camel-cxf [313.0]
import: (&(osgi.wiring.package=org.apache.camel.converter.jaxp)(version>=2.14.0)(!(version>=2.15.0)))
|
export: osgi.wiring.package=org.apache.camel.converter.jaxp
org.apache.camel.camel-core [311.0]

Chain 2:
org.apache.camel.camel-cxf [313.0]
import: (&(osgi.wiring.package=org.apache.camel.blueprint)(version>=2.14.0)(!(version>=3.0.0)))
|
export: osgi.wiring.package=org.apache.camel.blueprint; uses:=org.apache.camel.impl
org.apache.camel.camel-blueprint [204.0]
import: (&(osgi.wiring.package=org.apache.camel.impl)(version>=2.15.1)(!(version>=2.15.2)))
|
export: osgi.wiring.package=org.apache.camel.impl; uses:=org.apache.camel.converter.jaxp
export: osgi.wiring.package=org.apache.camel.converter.jaxp
org.apache.camel.camel-core [198.0]
JBossFuse:karaf@root>

Seems like the examples haven't been updated to use the Fuse 6.2 library properly ?

@chiippy
Copy link
Author

chiippy commented Jul 28, 2015

https://repository.jboss.org/nexus/content/repositories/releases/org/drools/drools-karaf-features/6.2.0.Final/drools-karaf-features-6.2.0.Final-features.xml

The features definition for kie-camel in 6.2.0Final are using older version of camel-cxf (2.14.0) and camel-core :

<feature name="kie-camel" version="6.2.0.Final">
<feature version="6.2.0.Final">kie-spring</feature>
<feature version="6.2.0.Final">jbpm</feature>
<feature version="2.14.0">camel-core</feature>
<feature version="2.14.0">camel-spring</feature>
<feature version="2.14.0">camel-cxf</feature>
<feature version="[2.6,3.0)">cxf-specs</feature>
<feature version="[2.6,3.0)">cxf-core</feature>
<feature version="[2.6,3.0)">cxf-jaxrs</feature>
<bundle>mvn:org.kie/kie-camel/6.2.0.Final</bundle>
</feature>

changed it to use the one in Fuse : 2.15.1.redhat-620133 and I managed to deploy the sample and it works !

@weimeilin79
Copy link

Eric, can you open a ticket on BPM Suite side, when you are back? This is a product problem.

@chiippy
Copy link
Author

chiippy commented Jul 30, 2015

Thanks WeiMei.

Now that I have got both of the samples deployed and working nicely in Fuse, however, I don't believe they work as the demo intended ?

The log did print something as
Chilton | 198 - org.apache.camel.camel-core - 2.15.1.redhat-620133 | Cheese Cheddar costs 50 EUR.
Chilton | 198 - org.apache.camel.camel-core - 2.15.1.redhat-620133 | Cheese Stilton costs 10 EUR.

However, that only prints whatever the Cheese object was created. If you look at the kie.xml, camel choice end-point and the XLS rule definition, I don't believe this work as whatever the sample would like to demo ?

  1. the end point 'ChesseType' always TRUE because the Chesse object has been generated with a Type. So, the Chilton logger always uses. You will never see the 'Otherwise' part !

  2. I don't see any where in the Kie.xml of loading the Rule Decision table. Even remove the XLS from the Project, makes no different as I believes Drools simply applies empty rule. So, the setup ends up like printing a 'hello world' in a VERY complicating way !

Is this really a sample of demo the camel decision table usage or just a dummy for completeness ? May be this thing has never works ? Or I totally misunderstood the purpose of these demos ?

Regards

Alex

@chiippy
Copy link
Author

chiippy commented Jul 31, 2015

Carry on with the demo as I really want to know if this works :

  1. the decision table was picked up by default as Kie picks up anything in the "resources" by default.
  2. the rule was fired but no result because rule data is case sensitive. So, need to create the cheese name as all lower cases to match the XLS rule definitions.
  3. Now, I can see the rule fired but error with nullPointerException because Drool unable to add the result in the 'List' as we haven't created it.
  4. now, we can't use "kie:ksession-dt-1?action=insertBody" as we won't be able to define the set-global for the List. Or if anyone know how to do this using the URI syntax ?
  5. changed the camel route to use the DroolsCommandHelper bean to add the SetGlobalCommand as Batch Execution Commands.
  6. using kie:ksession-dt-1?action=execute to fire the rule(s).
  7. but then, I lost the Cheese as the next message becomes ExecitionRestults of the rule.

8) yet, I had to use another bean to cover the result back to the Cheese. This causes an Exception which confused me ?!?!? :

org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: org.drools.core.runtime.impl.ExecutionResultImpl@7556840a]
at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1635)[org.apache.camel:camel-core:2.15.1.redhat-620133 com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4.2]
....
....
at java.util.TimerThread.run(Timer.java:505)[:1.8.0_40]
Caused by: java.lang.NoClassDefFoundError: org/drools/core/runtime/impl/ExecutionResultImpl
at org.drools.camel.example.DroolsCommandResultHelper.passResult(DroolsCommandResultHelper.java:21)[368:org.drools.example.spring-camel-decision-table:1.0.0.SNAPSHOT]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_40]

So, Camel do know the message in the Exchaneg object that it is a "org.drools.core.runtime.impl.ExecutionResultImpl" object as it had print out at the beginning of the exception, but my bean unable to load the same Class in the message ?? How ?

If I can't reference the ExecutionResultImpl Class in my bean, there is not way I can harvest the result of the rule execution.

I thought this was a problem with the Blueprint container, but seems like same for Spring.

Any help is appreciated.

Thanks

Alex

PS : I am not sure if this is the right place discuss about these DEMO app issues, if not, please point me to the right place. thanks.

@chiippy
Copy link
Author

chiippy commented Aug 7, 2015

Just had another look with this one. Problem was the kie.api.runtime package wasn't included in the bundle. Added it and resolved the problem.

However, uri : kie:ksession1?action=insertBody works in stateless ksession but no fire the rules in stateful. No error, so I have no idea why.

@chiippy
Copy link
Author

chiippy commented Aug 25, 2015

Just had another go with this, instead of using kie:session?action=execute, I am trying to execute the batch commands on a remote kie-server, then umarshall the result using BatchExecutionHelper, but then I am getting the error as following :

Caused by: java.lang.ClassNotFoundException: org.drools.core.runtime.help.impl.BatchExecutionHelperProviderImpl not found by org.kie.internalapi [281]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1556)
at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:77)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1993)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)[:1.8.0_40]
at java.lang.Class.forName0(Native Method)[:1.8.0_40]
at java.lang.Class.forName(Class.java:264)[:1.8.0_40]
at org.kie.internal.runtime.helper.BatchExecutionHelper.loadProvider(BatchExecutionHelper.java:275)[org.kie:kie-internal:6.2.0.Final]

I can see the code tried to load the provider :

Class cls = (Class) Class.forName( "org.drools.core.runtime.help.impl.BatchExecutionHelperProviderImpl" );

However, this wasn't in the kie-api import list and I don't know how to change this. :(

Any suggestions ?

Thanks

Alex

@sanchezw
Copy link

chiippy,

I have the same issue when performing the following operation

features:install kie-camel

Have you found a work around?

Thanks

William

@chiippy
Copy link
Author

chiippy commented Sep 10, 2015

Hi William

kie-camel is an interface implementation, unfortunately, the actual implementation wasn't imported in the package. You have to use the actual implementation, i.e BatchExecutionHelperProviderImpl to harvest the result. No pretty but it works.

Alex

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants