在KIE执行服务器中创建求解器的异常

时间:2017-08-29 14:47:59

标签: drools optaplanner kie drools-guvnor

我正在尝试将我的kjar部署到KIE执行服务器,但在创建解算器时遇到异常' taskPlanningSolver'在URL上使用PUT:

http://localhost:8080/kie-server/services/rest/server/containers/taskplanning1/solvers/taskPlanningSolver

以下是我所拥有的:

一个。我有一个在tomcat(windows)上运行的KIE执行服务器。它支持BRMS和BPM B.我有一个maven项目(使用optaplanner),并将其安装到我当地的maven repo。 C.我使用PUT在KIE服务器上成功创建了一个容器:

http://localhost:8080/kie-server/services/rest/server/containers/taskplanning1

身体:

<kie-container container-id="taskplanning1">
  <release-id>
    <group-id>com.kairos.planning</group-id>
    <artifact-id>task-planning</artifact-id>
    <version>1.0.1-SNAPSHOT</version>
  </release-id>
</kie-container>

我需要帮助创建一个抛出异常的解算器:

"Unexpected error during processing: sun.reflect.annotation.TypeNotPresentExceptionProxy"

注意: 我在maven repo中安装了jar中的kmodule.xml,其内部是META-INF,它的内容只有:

2017-08-30 11:56:07,977 ERROR [org.kie.server.remote.rest.optaplanner.SolverResource] (default task-3) Unexpected error creating solver 'taskPlanningSolver' on container 'taskplanning2': sun.reflect.annotation.TypeNotPresentExceptionProxy: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724)
at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531)
at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355)
at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
at java.lang.Class.createAnnotationData(Class.java:3521)
at java.lang.Class.annotationData(Class.java:3510)
at java.lang.Class.getAnnotation(Class.java:3415)
at com.thoughtworks.xstream.mapper.AnnotationMapper$UnprocessedTypesSet.add(AnnotationMapper.java:614)
at com.thoughtworks.xstream.mapper.AnnotationMapper$UnprocessedTypesSet.add(AnnotationMapper.java:599)
at com.thoughtworks.xstream.mapper.AnnotationMapper.processAnnotations(AnnotationMapper.java:162)
at com.thoughtworks.xstream.XStream.processAnnotations(XStream.java:2036)
at com.thoughtworks.xstream.XStream.processAnnotations(XStream.java:2047)
at org.kie.server.api.marshalling.xstream.XStreamMarshaller.configureMarshaller(XStreamMarshaller.java:186)
at org.kie.server.api.marshalling.xstream.XStreamMarshaller.<init>(XStreamMarshaller.java:103)
at org.kie.server.api.marshalling.BaseMarshallerBuilder.build(BaseMarshallerBuilder.java:37)
at org.kie.server.api.marshalling.MarshallerFactory.getMarshaller(MarshallerFactory.java:52)
at org.kie.server.services.impl.KieContainerInstanceImpl.getMarshaller(KieContainerInstanceImpl.java:175)

我在创建容器时也看到了很多异常,但容器已成功创建。所有错误都是NoClassDefFoundError,即使我将所有依赖项添加到我的项目的pom中,我仍然会得到一个导致NoClassDefFoundError的新类。

我也没有很好的指南将kjar部署到kie执行服务器。我成功测试后会创建一个。请尽可能帮助。提前谢谢。

1 个答案:

答案 0 :(得分:1)

Kie执行服务器已经有optaplanner jar,它具有所有需要的依赖项,包括所有日志记录依赖项。因此,您需要确保项目的pom没有运行时依赖性。您在项目中需要的所有依赖项都应标记为provided范围,如:

        <dependency>
            <groupId>org.optaplanner</groupId>
            <artifactId>optaplanner-persistence-common</artifactId>
            <version>${version.optaplanner.bom}</version>
            <scope>provided</scope>
        </dependency>