| Summary: | Camel integration: exception occurs when launching query command with arguments in JSON format | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [JBoss] JBoss Enterprise BRMS Platform 5 | Reporter: | Radovan Synek <rsynek> | ||||
| Component: | BRE (Expert, Fusion) | Assignee: | Nobody <nobody> | ||||
| Status: | VERIFIED --- | QA Contact: | Radovan Synek <rsynek> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | BRMS 5.3.0.GA | CC: | lpetrovi, mproctor | ||||
| Target Milestone: | --- | ||||||
| Target Release: | BRMS 5.3.0.GA | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | Type: | --- | |||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Attachments: |
|
||||||
Camel isn't being productised yet. So check with prakash/johng before progressing further on this one. If the bug seems genuine, please re-open a jira for .org and we'll make sure it's fixed there. ERD states that the Camel integration is being productized. (https://docspace.corp.redhat.com/docs/DOC-76523) This reproduce code uses the drools-grid stuff too:
GridImpl grid = new GridImpl();
grid.addService(WhitePages.class, new WhitePagesImpl());
GridNode node = grid.createGridNode("testnode");
Context context = new JndiContext();
context.bind("testnode", node);
node.set("ksession", session);
CamelContext camelContext = new DefaultCamelContext(context);
Please see the comments in this issue for more information:
https://bugzilla.redhat.com/show_bug.cgi?id=771203
Drools-grid is not support (or stable for that matter).
Would you mind creating a reproduce test case without using drools-grid?
here is a pull request with reproducers for these 3 connected issues: https://github.com/droolsjbpm/droolsjbpm-integration/pull/12 Fixed the unmarshalling issue in master and 5.3.x. The testcase is only on master currently. Fixed an import problem in the testcase on master. But, the API of the QueryResults object returned doesn't make much sense to me. How is user suppose to use that? Check with the documentation and/or Mark if that's a problem. https://github.com/droolsjbpm/drools/commit/142cc1dc7d0d3109d7f0b851fa9563733a067326 https://github.com/droolsjbpm/droolsjbpm-integration/commit/d5bdac6baa4db4411e5777251e4f182850fa9f56 Please verify this issue on ER5. |
Created attachment 550239 [details] camel json query command reproducer With camel routes defined as follows: camelContext.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from("direct:test-session").policy(new DroolsPolicy()).unmarshal("json").to("drools://testnode/ksession").marshal("json"); from("direct:unmarshall").policy(new DroolsPolicy()).unmarshal("json"); from("direct:marshall").policy(new DroolsPolicy()).marshal("json"); } }); , trying to execute query command through the first route ("direct:test-session"). To be sure JSON command format is right, first step is creating query command through API, second is marshalling this command to JSON and third step is sending marshalled command to drools. String queryStr = template.requestBody("direct:marshall", CommandFactory.newQuery("persons", "people over the age of x", new Object[]{30}), String.class); String json = template.requestBody("direct:test-session", queryStr, String.class); ExecutionResults res = (ExecutionResults) template.requestBody("direct:unmarshall", json); return (QueryResults) res.getValue("persons"); I am expecting query results in JSON (unmarshalling these result is the last step), but this exception occurs: Exception in thread "main" org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: QueryCommand{outIdentifier='persons', name='people over the age of x', arguments=[]}] at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1142) at org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:452) at org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:441) at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:119) at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:135) at org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:283) at org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:313) at com.redhat.cameljsonreproducer.JsonCamel.query(JsonCamel.java:109) at com.redhat.cameljsonreproducer.JsonCamel.testQuery(JsonCamel.java:100) at com.redhat.cameljsonreproducer.App.main(App.java:12) Caused by: java.lang.ArrayIndexOutOfBoundsException: 0 at org.drools.base.extractors.ArrayElementReader.isNullValue(ArrayElementReader.java:189) at org.drools.rule.VariableRestriction$LongVariableContextEntry.updateFromTuple(VariableRestriction.java:451) at org.drools.common.SingleBetaConstraints.updateFromTuple(SingleBetaConstraints.java:108) at org.drools.reteoo.JoinNode.assertLeftTuple(JoinNode.java:91) at org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:197) at org.drools.reteoo.SingleLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:146) at org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:158) at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59) at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:134) at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59) at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:215) at org.drools.reteoo.EntryPointNode.assertQuery(EntryPointNode.java:146) at org.drools.reteoo.ReteooWorkingMemory.getQueryResults(ReteooWorkingMemory.java:195) at org.drools.impl.StatefulKnowledgeSessionImpl.getQueryResults(StatefulKnowledgeSessionImpl.java:769) at org.drools.command.runtime.rule.QueryCommand.execute(QueryCommand.java:104) at org.drools.command.runtime.rule.QueryCommand.execute(QueryCommand.java:36) at org.drools.command.runtime.BatchExecutionCommandImpl.execute(BatchExecutionCommandImpl.java:155) at org.drools.command.runtime.BatchExecutionCommandImpl.execute(BatchExecutionCommandImpl.java:76) at org.drools.impl.StatefulKnowledgeSessionImpl.execute(StatefulKnowledgeSessionImpl.java:809) at org.drools.impl.StatefulKnowledgeSessionImpl.execute(StatefulKnowledgeSessionImpl.java:781) at org.drools.camel.component.DroolsExecuteProducer.process(DroolsExecuteProducer.java:100) at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70) at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:104) at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:272) at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:98) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70) at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89) at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:99) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70) at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:290) at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:202) at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:256) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70) at org.apache.camel.processor.Pipeline.process(Pipeline.java:143) at org.apache.camel.processor.Pipeline.process(Pipeline.java:78) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:91) at org.apache.camel.processor.Pipeline.process(Pipeline.java:58) at org.drools.camel.component.DroolsPolicy$DroolsProcess.process(DroolsPolicy.java:344) at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70) at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70) at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89) at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:99) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70) at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:290) at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:202) at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:256) at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:113) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70) at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89) at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70) at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:61) at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:99) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:91) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:85) at org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:63) at org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:333) at org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:304) at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:208) at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:303) at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:171) at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:114) at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:118) ... 6 more ------------------------------------------------------------------------------ See an attachment for the details. Build it and run as maven application.