Search code examples
droolsoptaplannerkiedrools-guvnor

Exception creating solver in KIE execution server


I am trying to deploy my kjar to KIE execution server but getting an exception while creating a solver 'taskPlanningSolver' using PUT on URL:

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

Here's what I have:

A. I have a KIE execution server running on tomcat(windows). It supports BRMS and BPM.
B. I have a maven project (that uses optaplanner) and it's installed to my local maven repo.
C. I successfully created a container in KIE server using PUT on:

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

with body:

<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>

I need help with creating a solver which is throwing exception:

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

Notes: I do have kmodule.xml in jar installed in maven repo and its inside META-INF and it's content is only:

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)

I also see a lot of exceptions while creating container but container gets created successfully. All the errors are NoClassDefFoundError and even though I added all the dependencies to my project's pom I still get a new class that causes NoClassDefFoundError.

I also dont have a good guide to deploy kjar to kie execution server. I'll be creating one after successfully testing it. Please help if possible. Thanks in advance.


Solution

  • The Kie execution server already has optaplanner jars and it has all the dependencies that will ever be need including all logging dependencies. So, you need to make sure your project's pom has zero runtime dependencies. All the dependencies you require in your project should be marked provided scope like:

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