Problems when Fire Rules using Kie Server JAVA Client API

783 views
Skip to first unread message

Giovanni Persico

unread,
May 21, 2018, 6:42:51 AM5/21/18
to Drools Usage
HI,

I'm using Drools Workbench 7.7 and Kie-Server. In "Servers" on Workbench I see that exist the servers template. 
The next Step is to fire my rules (that are in the workbench) using a Kie Server JAVA Client API.
I do this in Spring. But when Execute the test this is the message that I read : 

org.kie.server.api.marshalling.MarshallingException: Error while creating JAXB context from default classes! 5 counts of IllegalAnnotationExceptions
at org.kie.server.api.marshalling.jaxb.JaxbMarshaller.buildMarshaller(JaxbMarshaller.java:393)
at org.kie.server.api.marshalling.jaxb.JaxbMarshaller.<init>(JaxbMarshaller.java:376)
at org.kie.server.api.marshalling.BaseMarshallerBuilder.build(BaseMarshallerBuilder.java:40)
at org.kie.server.api.marshalling.MarshallerFactory.getMarshaller(MarshallerFactory.java:52)
at org.kie.server.client.impl.AbstractKieServicesClientImpl.<init>(AbstractKieServicesClientImpl.java:83)
at org.kie.server.client.impl.KieServicesClientImpl.<init>(KieServicesClientImpl.java:71)
at org.kie.server.client.KieServicesFactory.newKieServicesClient(KieServicesFactory.java:101)
at com.accenture.aspi.inbound.reasoner.brm.BRMImplementation.test(BRMImplementation.java:49)
at com.accenture.aspi.inbound.reasoner.BRMImplementationTest.BRMTest(BRMImplementationTest.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:73)
at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:83)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 5 counts of IllegalAnnotationExceptions
Class has two properties of the same name "classificationName"
this problem is related to the following location:
at public java.lang.String com.accenture.aspi.inbound.reasoner.brm.MailParameter.getClassificationName()
at com.accenture.aspi.inbound.reasoner.brm.MailParameter
this problem is related to the following location:
at public java.lang.String com.accenture.aspi.inbound.reasoner.brm.MailParameter.classificationName
at com.accenture.aspi.inbound.reasoner.brm.MailParameter
Class has two properties of the same name "classificationScore"
this problem is related to the following location:
at public double com.accenture.aspi.inbound.reasoner.brm.MailParameter.getClassificationScore()
at com.accenture.aspi.inbound.reasoner.brm.MailParameter
this problem is related to the following location:
at public double com.accenture.aspi.inbound.reasoner.brm.MailParameter.classificationScore
at com.accenture.aspi.inbound.reasoner.brm.MailParameter
Class has two properties of the same name "result"
this problem is related to the following location:
at public java.lang.String com.accenture.aspi.inbound.reasoner.brm.MailParameter.getResult()
at com.accenture.aspi.inbound.reasoner.brm.MailParameter
this problem is related to the following location:
at public java.lang.String com.accenture.aspi.inbound.reasoner.brm.MailParameter.result
at com.accenture.aspi.inbound.reasoner.brm.MailParameter
Class has two properties of the same name "sentimentName"
this problem is related to the following location:
at public java.lang.String com.accenture.aspi.inbound.reasoner.brm.MailParameter.getSentimentName()
at com.accenture.aspi.inbound.reasoner.brm.MailParameter
this problem is related to the following location:
at public java.lang.String com.accenture.aspi.inbound.reasoner.brm.MailParameter.sentimentName
at com.accenture.aspi.inbound.reasoner.brm.MailParameter
Class has two properties of the same name "sentimentScore"
this problem is related to the following location:
at public double com.accenture.aspi.inbound.reasoner.brm.MailParameter.getSentimentScore()
at com.accenture.aspi.inbound.reasoner.brm.MailParameter
this problem is related to the following location:
at public double com.accenture.aspi.inbound.reasoner.brm.MailParameter.sentimentScore
at com.accenture.aspi.inbound.reasoner.brm.MailParameter

Someone can help me?
Thanks





Maciej Swiderski

unread,
May 21, 2018, 9:11:12 AM5/21/18
to drools...@googlegroups.com
looks like some JAXB annotation/configuration issues with your data object class. Do you have any JAXB annotations on them? if you could share that class(es) that can help to troubleshoot

Maciej

--
You received this message because you are subscribed to the Google Groups "Drools Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/9ae08e05-e084-4267-9a6e-8c179a76df13%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Giovanni Persico

unread,
May 21, 2018, 9:14:26 AM5/21/18
to Drools Usage
This is my Object:

public class MailParameter {
public String sentimentName;
public double sentimentScore;
public String classificationName;
public double classificationScore;
public String result;
public MailParameter() {
}


public double getSentimentScore() {
return sentimentScore;
}

public void setSentimentScore(double sentimentScore) {
this.sentimentScore = sentimentScore;
}


public double getClassificationScore() {
return classificationScore;
}

public String getSentimentName() {
return sentimentName;
}

public void setSentimentName(String sentimentName) {
this.sentimentName = sentimentName;
}

public String getClassificationName() {
return classificationName;
}

public void setClassificationName(String classificationName) {
this.classificationName = classificationName;
}

public void setClassificationScore(double classificationScore) {
this.classificationScore = classificationScore;
}

public String getResult() {
return result;
}

public void setResult(String result) {
this.result = result;

Maciej Swiderski

unread,
May 21, 2018, 9:15:31 AM5/21/18
to drools...@googlegroups.com
try to annotate this class with 

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement

Maciej

Giovanni Persico

unread,
May 21, 2018, 9:26:16 AM5/21/18
to Drools Usage
org.kie.server.api.exception.KieServicesException: Error while deserializing data received from server!

This is my error now. Can you help me again? thank you

Maciej Swiderski

unread,
May 21, 2018, 9:31:51 AM5/21/18
to drools...@googlegroups.com
check the server log to see what it failed at

p.s. 

this change with JAXB annotations must be at both ends - client and server

Maciej

Giovanni Persico

unread,
May 21, 2018, 9:39:13 AM5/21/18
to Drools Usage
org.kie.server.api.exception.KieServicesException: Error while deserializing data received from server!
at org.kie.server.client.impl.AbstractKieServicesClientImpl.deserialize(AbstractKieServicesClientImpl.java:592)
at org.kie.server.client.impl.AbstractKieServicesClientImpl.makeHttpGetRequestAndCreateServiceResponse(AbstractKieServicesClientImpl.java:187)
at org.kie.server.client.impl.KieServicesClientImpl.getServerInfo(KieServicesClientImpl.java:157)
at org.kie.server.client.impl.KieServicesClientImpl.getCapabilitiesFromServer(KieServicesClientImpl.java:130)
at org.kie.server.client.impl.KieServicesClientImpl.init(KieServicesClientImpl.java:85)
at org.kie.server.client.impl.KieServicesClientImpl.<init>(KieServicesClientImpl.java:72)
at org.kie.server.client.KieServicesFactory.newKieServicesClient(KieServicesFactory.java:101)

This is the log referred to the server. One question : what do you mean with "this change with JAXB 
annotations must be at both ends - client and server" ? I have to change or add something server-side?
Thanks again.

jagan reddy

unread,
May 21, 2018, 9:50:19 AM5/21/18
to Drools Usage
same problem for me

Please, help us

19:19:49.291 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to send POST request to 'http://localhost:8080/kie-server/services/rest/server/containers/instances/com.bayview.loan:bayviewloan:1.0' with payload 'BatchExecutionCommandImpl{lookup='ksession', commands=[session.entryPoints(DEFAULT).insert(com.bayview.soa.model.mismo.servicing.LOAN@29626d54);, session.fireAllRules();, session.getAgenda().getAgendaGroup(loanservice).setFocus();]}'
Exception in thread "main" org.kie.server.client.KieServicesException: Error while serializing request data!
    at org.kie.server.client.impl.AbstractKieServicesClientImpl.serialize(AbstractKieServicesClientImpl.java:514)
    at org.kie.server.client.impl.AbstractKieServicesClientImpl.makeBackwardCompatibleHttpPostRequestAndCreateServiceResponse(AbstractKieServicesClientImpl.java:684)
    at org.kie.server.client.impl.RuleServicesClientImpl.executeCommands(RuleServicesClientImpl.java:109)
    at org.jbpm.test.kieserver.FireRulesKieApi.main(FireRulesKieApi.java:137)
Caused by: org.kie.server.api.marshalling.MarshallingException: Error marshalling input
    at org.kie.server.api.marshalling.json.JSONMarshaller.marshall(JSONMarshaller.java:191)
    at org.kie.server.client.impl.AbstractKieServicesClientImpl.serialize(AbstractKieServicesClientImpl.java:512)
    ... 3 more
Caused by: org.codehaus.jackson.map.JsonMappingException: Can not create bean serializer for Object.class (through reference chain: org.drools.core.command.runtime.BatchExecutionCommandImpl["commands"]->java.util.ArrayList[0]->org.drools.core.command.runtime.rule.InsertObjectCommand["object"]->com.bayview.soa.model.mismo.servicing.LOAN["ParentLoanIDREF_Referencing_LoanID"])
    at org.codehaus.jackson.map.ser.StdSerializerProvider._createAndCacheUntypedSerializer(StdSerializerProvider.java:740)
    at org.codehaus.jackson.map.ser.StdSerializerProvider.findValueSerializer(StdSerializerProvider.java:344)
    at org.codehaus.jackson.map.ser.impl.PropertySerializerMap.findAndAddSerializer(PropertySerializerMap.java:39)
    at org.codehaus.jackson.map.ser.BeanPropertyWriter._findAndAddDynamic(BeanPropertyWriter.java:463)
    at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:441)
    at org.codehaus.jackson.map.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:150)
    at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:112)
    at org.codehaus.jackson.map.ser.StdSerializerProvider._serializeValue(StdSerializerProvider.java:610)
    at org.codehaus.jackson.map.ser.StdSerializerProvider.serializeValue(StdSerializerProvider.java:256)
    at org.codehaus.jackson.map.ObjectMapper._configAndWriteValue(ObjectMapper.java:2575)
    at org.codehaus.jackson.map.ObjectMapper.writeValueAsString(ObjectMapper.java:2097)
    at org.kie.server.api.marshalling.json.JSONMarshaller$WrappingObjectSerializer.serialize(JSONMarshaller.java:313)
    at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:446)
    at org.codehaus.jackson.map.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:150)
    at org.codehaus.jackson.map.ser.std.BeanSerializerBase.serializeWithType(BeanSerializerBase.java:125)
    at org.codehaus.jackson.map.ser.std.CollectionSerializer.serializeContents(CollectionSerializer.java:74)
    at org.codehaus.jackson.map.ser.std.CollectionSerializer.serializeContents(CollectionSerializer.java:23)
    at org.codehaus.jackson.map.ser.std.AsArraySerializerBase.serialize(AsArraySerializerBase.java:86)
    at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:446)
    at org.codehaus.jackson.map.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:150)
    at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:112)
    at org.codehaus.jackson.map.ser.StdSerializerProvider._serializeValue(StdSerializerProvider.java:610)
    at org.codehaus.jackson.map.ser.StdSerializerProvider.serializeValue(StdSerializerProvider.java:256)
    at org.codehaus.jackson.map.ObjectMapper._configAndWriteValue(ObjectMapper.java:2575)
    at org.codehaus.jackson.map.ObjectMapper.writeValueAsString(ObjectMapper.java:2097)
    at org.kie.server.api.marshalling.json.JSONMarshaller.marshall(JSONMarshaller.java:188)
    ... 4 more
Caused by: java.lang.IllegalArgumentException: Can not create bean serializer for Object.class
    at org.codehaus.jackson.map.ser.BeanSerializerFactory.constructBeanSerializer(BeanSerializerFactory.java:428)
    at org.codehaus.jackson.map.ser.BeanSerializerFactory.findBeanSerializer(BeanSerializerFactory.java:347)
    at org.codehaus.jackson.map.ser.BeanSerializerFactory.createSerializer(BeanSerializerFactory.java:291)
    at org.codehaus.jackson.map.ser.StdSerializerProvider._createUntypedSerializer(StdSerializerProvider.java:782)
    at org.codehaus.jackson.map.ser.StdSerializerProvider._createAndCacheUntypedSerializer(StdSerializerProvider.java:735)
    ... 29 more




thanks,
Jagan

Maciej Swiderski

unread,
May 21, 2018, 9:58:01 AM5/21/18
to drools...@googlegroups.com
On 21 May 2018, at 15:39, Giovanni Persico <giovanni.p...@gmail.com> wrote:

org.kie.server.api.exception.KieServicesException: Error while deserializing data received from server!
at org.kie.server.client.impl.AbstractKieServicesClientImpl.deserialize(AbstractKieServicesClientImpl.java:592)
at org.kie.server.client.impl.AbstractKieServicesClientImpl.makeHttpGetRequestAndCreateServiceResponse(AbstractKieServicesClientImpl.java:187)
at org.kie.server.client.impl.KieServicesClientImpl.getServerInfo(KieServicesClientImpl.java:157)
at org.kie.server.client.impl.KieServicesClientImpl.getCapabilitiesFromServer(KieServicesClientImpl.java:130)
at org.kie.server.client.impl.KieServicesClientImpl.init(KieServicesClientImpl.java:85)
at org.kie.server.client.impl.KieServicesClientImpl.<init>(KieServicesClientImpl.java:72)
at org.kie.server.client.KieServicesFactory.newKieServicesClient(KieServicesFactory.java:101)
this is still client side - look into server (wildfly that runs kie server)


This is the log referred to the server. One question : what do you mean with "this change with JAXB 
annotations must be at both ends - client and server" ? I have to change or add something server-side?
if your class is part of the kjar you need to update it there and deploy to kie server again to make sure it runs the same class (with annotations)

Maciej

Giovanni Persico

unread,
May 28, 2018, 11:52:29 AM5/28/18
to Drools Usage
Hi Maciej,

I update the object with:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement

in Drools Workbench. When I run the application now I see this message : 
org.kie.server.api.exception.KieServicesException: Error while deserializing data received from server!
at org.kie.server.client.impl.AbstractKieServicesClientImpl.deserialize(AbstractKieServicesClientImpl.java:592)
at org.kie.server.client.impl.AbstractKieServicesClientImpl.makeHttpGetRequestAndCreateServiceResponse(AbstractKieServicesClientImpl.java:187)
at org.kie.server.client.impl.KieServicesClientImpl.getServerInfo(KieServicesClientImpl.java:157)
at org.kie.server.client.impl.KieServicesClientImpl.getCapabilitiesFromServer(KieServicesClientImpl.java:130)
at org.kie.server.client.impl.KieServicesClientImpl.init(KieServicesClientImpl.java:85)
at org.kie.server.client.impl.KieServicesClientImpl.<init>(KieServicesClientImpl.java:72)
at org.kie.server.client.KieServicesFactory.newKieServicesClient(KieServicesFactory.java:101)
Caused by: org.kie.server.api.marshalling.MarshallingException: Can't unmarshall input string: <!--
  ~ JBoss, Home of Professional Open Source.
  ~ Copyright (c) 2014, Red Hat, Inc., and individual contributors
  ~ as indicated by the @author tags. See the copyright.txt file in the
  ~ distribution for a full listing of individual contributors.
  ~
  ~ This is free software; you can redistribute it and/or modify it
  ~ under the terms of the GNU Lesser General Public License as
  ~ published by the Free Software Foundation; either version 2.1 of
  ~ the License, or (at your option) any later version.
  ~
  ~ This software is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  ~ Lesser General Public License for more details.
  ~
  ~ You should have received a copy of the GNU Lesser General Public
  ~ License along with this software; if not, write to the Free
  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
    <title>Welcome to WildFly 11</title>
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
    <link rel="StyleSheet" href="wildfly.css" type="text/css">
</head>

<body>
<div class="wrapper">
    <div class="content">
        <div class="logo">
                <img src="wildfly_logo.png" alt="WildFly 11... it's here." border="0" />
        </div>
        <h1>Welcome to WildFly 11</h1>

        <h3>Your WildFly 11 is running.</h3>

        <p><a href="documentation.html">Documentation</a> | <a href="http://github.com/wildfly/quickstart">Quickstarts</a> | <a href="/console">Administration
            Console</a> </p>

        <p><a href="http://wildfly.org">WildFly Project</a> |
            <a href="https://community.jboss.org/en/wildfly">User Forum</a> |
            <a href="https://issues.jboss.org/browse/WFLY">Report an issue</a></p>
        <p class="logos"><a href="http://jboss.org"><img src="jbosscommunity_logo_hori_white.png" alt="JBoss and JBoss Community" width=
                "195" height="37" border="0"></a></p>

        <p class="note">To replace this page simply deploy your own war with / as its context path.<br />
            To disable it, remove the "welcome-content" handler for location / in the undertow subsystem.</p>
    </div>
</div>
</body>
</html>

at org.kie.server.api.marshalling.jaxb.JaxbMarshaller.unmarshall(JaxbMarshaller.java:417)
at org.kie.server.client.impl.AbstractKieServicesClientImpl.deserialize(AbstractKieServicesClientImpl.java:590)
... 39 more
Caused by: javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; lineNumber: 22; columnNumber: 63; White spaces are required between publicId and systemId.]
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:335)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:578)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:264)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:229)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:157)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:214)
at org.kie.server.api.marshalling.jaxb.JaxbMarshaller.unmarshall(JaxbMarshaller.java:415)
... 40 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 22; columnNumber: 63; White spaces are required between publicId and systemId.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1472)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanExternalID(XMLScanner.java:1072)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.scanDoctypeDecl(XMLDocumentScannerImpl.java:642)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:924)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:258)
... 44 more

Can you help me one more time? Thanks!

Maciej Swiderski

unread,
May 29, 2018, 4:07:55 AM5/29/18
to drools...@googlegroups.com
looks like you have given wrong URL to kie server, I believe it is http://localhost:8080 instead of http://localhost:8080/kie-server/services/rest/server

Maciej

Giovanni Persico

unread,
May 29, 2018, 10:09:16 AM5/29/18
to Drools Usage
Hi Maciej, thanks for all. I have another problem now.
This is my class :

@Component
public class BRMSImplementation {

    private static final String URL = "http://xxxxxxxxxx/kie-server/services/rest/server";
    private static final String USER = "kieserver";
    private static final String PASSWORD = "kieserver1!";
    private static final String CONTAINER = "container";
    private static final String SESSION = "session";

    private KieServicesClient kieServicesClient;
    private RuleServicesClient ruleClient;

    public void testLibrary() {

        KieServicesConfiguration config = KieServicesFactory.newRestConfiguration(URL, USER, PASSWORD);
        config.addExtraClasses(new HashSet<>(Arrays.asList(MailParameter.class)));

        this.kieServicesClient = KieServicesFactory.newKieServicesClient(config);
        this.ruleClient = this.kieServicesClient.getServicesClient(RuleServicesClient.class);

        ServiceResponse<KieContainerResourceList> listContainers = this.kieServicesClient.listContainers();
        ServiceResponse<KieContainerResource> containerInfo = this.kieServicesClient.getContainerInfo(CONTAINER);
        ServiceResponse<KieServerInfo> listSessions = this.kieServicesClient.getServerInfo();

        List<Command<?>> commands = new ArrayList<>();

        commands.add(KieServices.Factory.get().getCommands().newInsert(mockMail(), "insert-mail"));
        commands.add(KieServices.Factory.get().getCommands().newFireAllRules("fire-all"));

        BatchExecutionCommand batchCommand = KieServices.Factory.get().getCommands().newBatchExecution(commands);
        String xStreamXml = BatchExecutionHelper.newXStreamMarshaller().toXML(batchCommand);

        ServiceResponse<ExecutionResults> response = this.ruleClient.executeCommandsWithResults(CONTAINER, xStreamXml);
        System.out.println(response.getResult());

    }

When I Do the debug in response I have this message : ServiceResponse[SUCCESS, msg='Container container successfully called.', result='org.drools.core.runtime.impl.ExecutionResultImpl@217b0952']

Why result is in this way? In the container is present my project with a guided decision table and in MockMail I set the correct parameter ( Like the jar that i Deploy on Drools Workbench).
Can you help me again? Thanks

Maciej Swiderski

unread,
May 29, 2018, 10:15:15 AM5/29/18
to drools...@googlegroups.com
you should not use the string as payload as it’s easier to use the command directly like this:

 List<Command<?>> commands = new ArrayList<>();

        commands.add(KieServices.Factory.get().getCommands().newInsert(mockMail(), "insert-mail"));
        commands.add(KieServices.Factory.get().getCommands().newFireAllRules("fire-all"));

        BatchExecutionCommand batchCommand = KieServices.Factory.get().getCommands().newBatchExecution(commands);

        ServiceResponse<ExecutionResults> response = this.ruleClient.executeCommandsWithResults(CONTAINER, batchCommand);

Maciej

Giovanni Persico

unread,
May 29, 2018, 10:23:13 AM5/29/18
to Drools Usage
Ok I do this but I have the same message for the response. HAve you an other Idea to receive the result of the decision table?

Giovanni Persico

unread,
May 29, 2018, 10:30:03 AM5/29/18
to Drools Usage
And I have another question : is possibile that is necessary to add anything to the xml of the kie-server?
This is the mine: 

<response type="SUCCESS" msg="Kie Server info">
<kie-server-info>
<capabilities>KieServer</capabilities>
<capabilities>BRM</capabilities>
<capabilities>BPM</capabilities>
<capabilities>CaseMgmt</capabilities>
<capabilities>BPM-UI</capabilities>
<capabilities>BRP</capabilities>
<capabilities>DMN</capabilities>
<capabilities>Swagger</capabilities>
<messages>
<content>
Server KieServerInfo{serverId='kie-server-kie-server-84fdccb588-77d9h', version='7.7.0.Final', location='http://xxxxxxxxxx/kie-server/services/rest/server', capabilities=[KieServer, BRM, BPM, CaseMgmt, BPM-UI, BRP, DMN, Swagger]}started successfully at Mon May 28 08:02:05 UTC 2018
</content>
<severity>INFO</severity>
<timestamp>2018-05-28T08:02:05.183Z</timestamp>
</messages>
<name>kie-server-kie-server-84fdccb588-77d9h</name>
<id>kie-server-kie-server-84fdccb588-77d9h</id>
<version>7.7.0.Final</version>
</kie-server-info>
</response>


Thanks again!

Maciej Swiderski

unread,
May 29, 2018, 10:31:49 AM5/29/18
to Drools Usage
this actually looks valid as I believe you just made a toStirng on ServiceResponse while you should do something like this:

ServiceResponse<ExecutionResults> reply = ruleClient.executeCommandsWithResults(CONTAINER_ID, executionCommand);

ExecutionResults actualData = reply.getResult();
Object value = actualData.getValue(PERSON_OUT_IDENTIFIER);

PERSON_OUT_IDENTIFIER is the name that you give to command (like insert) to be able to retrieve the same object once you done with rule evaluation

Maciej
> To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/cfb4ae0a-05d2-4abc-92de-bd0db6f5f962%40googlegroups.com.

Maciej Swiderski

unread,
May 29, 2018, 10:32:20 AM5/29/18
to drools...@googlegroups.com

On 29 May 2018, at 16:30, Giovanni Persico <giovanni.p...@gmail.com> wrote:

And I have another question : is possibile that is necessary to add anything to the xml of the kie-server?
no, no need to add anything

Maciej
--
You received this message because you are subscribed to the Google Groups "Drools Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.

Giovanni Persico

unread,
May 29, 2018, 10:47:52 AM5/29/18
to Drools Usage
I don't undestand what do you think whit PERSON_OUT_IDENTIFIER. Can you explain? The object that I use in Workbench is called MAIL PARAMETERS and table name is RULE_TABLE

Giovanni Persico

unread,
May 29, 2018, 12:15:14 PM5/29/18
to Drools Usage
Ok Stupid question. I resolve and now it's OK for me. Thank you very match!
Reply all
Reply to author
Forward
0 new messages