0

Drools Rule Engine (7.36) の新しいバージョンをローカルサーバーにインストールしました KIE Workbench と KIE Server をローカルホスト Tomcat 8 にデプロイしました (新しいバージョンにはwebcバージョンがなかったため、現在 Workbench 7.11 を使用していますTomcat 展開用)

サーバーを構成し、Rule Project を展開することができました。そのKieSessions はkmodule.xmlでステートレスとして設定されているため、ランタイム戦略はPER REQUESTとして設定されています。

次に、このサーバーを呼び出すクライアントを作成しましたが、数分間は問題なく動作しています。その後(10分になると思います)、1つおきのリクエストで、何があってもClassCastExceptionがスローされます。展開ユニットを再起動すると、さらに 10 分間は再び機能します。

これは例外です:

20-Apr-2020 17:29:49.205 GRAVE [http-nio-8080-exec-2] org.kie.server.services.drools.DroolsKieContainerCommandServiceImpl.callContainer Error calling container 'PruebaDrools'
    java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to org.kie.api.command.Command
            at org.kie.server.services.drools.DroolsKieContainerCommandServiceImpl.callContainer(DroolsKieContainerCommandServiceImpl.java:60)
            at org.kie.server.remote.rest.drools.CommandResource.manageContainer(CommandResource.java:91)
            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.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140)
            at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:509)
            at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:399)
            at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$0(ResourceMethodInvoker.java:363)
            at org.jboss.resteasy.core.interception.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:358)
            at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:365)
            at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:337)
            at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:310)
            at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:443)
            at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:233)
            at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:139)
            at org.jboss.resteasy.core.interception.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:358)
            at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:142)
            at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:219)
            at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:227)
            at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
            at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
            at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
            at org.kie.server.services.impl.security.web.CaptureHttpRequestFilter.doFilter(CaptureHttpRequestFilter.java:42)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
            at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:668)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
            at org.kie.integration.tomcat.JACCValve.invoke(JACCValve.java:113)
            at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:688)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
            at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:615)
            at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
            at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:818)
            at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1623)
            at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
            at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
            at java.lang.Thread.run(Thread.java:748)

これは私のクライアントです:

public class MyConfigurationObject {

private static final String URL = "http://localhost:8080/kie-server/services/rest/server";
private static final String USER = "kieserver";
private static final String PASSWORD = "kieserver1!";

private static final String CONTAINER_ID = "PruebaDrools";
private static final String SESSION_ID = "ksession-dtables";

private static Marshaller xStreamXml;
private static KieServicesConfiguration conf;
private static KieServicesClient client;
private static RuleServicesClient ruleClient;


public static void initialize() {

    conf = KieServicesFactory.newRestConfiguration(URL, USER, PASSWORD);
    conf.setMarshallingFormat(MarshallingFormat.JSON);

    Set<Class<?>> allClasses = new HashSet<Class<?>>();
    allClasses.add(MyClass.class);
    conf.addExtraClasses(allClasses);

    xStreamXml = MarshallerFactory.getMarshaller(allClasses, MarshallingFormat.JSON, MyConfigurationObject.class.getClassLoader());


    client  = KieServicesFactory.newKieServicesClient(conf);
    ruleClient = client.getServicesClient(RuleServicesClient.class);
}

//Para la version 7.36
public static void sendCommands() {
    BatchExecutionCommandImpl command = new BatchExecutionCommandImpl(new ArrayList<Command>());
    command.setLookup(SESSION_ID);

    InsertObjectCommand insertObjectCommand = new InsertObjectCommand("banana");
    FireAllRulesCommand fireAllRulesCommand = new FireAllRulesCommand();

    command.getCommands().add(insertObjectCommand);
    command.getCommands().add(fireAllRulesCommand);

    ServiceResponse<ExecutionResults> response = ruleClient.executeCommandsWithResults(CONTAINER_ID,command);
    System.out.println(response.getResult());
}

//Para la version 7.36
public static void sendCommands(Object[] args) {

    InsertObjectCommand insertObjectCommand = new InsertObjectCommand("enviar");

    InsertElementsCommand insertElementsCommand = new InsertElementsCommand(Arrays.asList(args));
    insertElementsCommand.setOutIdentifier("denuncia");

    FireAllRulesCommand fireAllRulesCommand = new FireAllRulesCommand();
    GetObjectsCommand getObjectsCommand = new GetObjectsCommand();
    getObjectsCommand.setOutIdentifier("denuncia");

    //Dispose session
    DisposeCommand disposeCommand = new DisposeCommand();

    KieCommands commandsFactory = KieServices.Factory.get().getCommands();
    List<Command<?>> commands = new ArrayList<Command<?>>();
    BatchExecutionCommand executionCommand = commandsFactory.newBatchExecution(commands, SESSION_ID);

    commands.add(insertObjectCommand);
    commands.add(insertElementsCommand);
    commands.add(fireAllRulesCommand);
    commands.add(getObjectsCommand);
    commands.add(disposeCommand);



    ServiceResponse<ExecutionResults> response = ruleClient.executeCommandsWithResults(CONTAINER_ID, xStreamXml.marshall(executionCommand));
    System.out.println(xStreamXml.marshall(response.getResult().getValue("denuncia")));
}

メインクラスで使用MyConfigurationObjectし、静的メソッドを呼び出し、最初にinitialize()を呼び出し、次にオブジェクトを引数としてsendCommands()を呼び出します

この例外は非常に一般的なものであり、さまざまな理由で発生する可能性がありますが、何が起こっているのかについての追加情報はログに記録されません。

何か不足していますか?

4

0 に答える 0