Uploaded image for project: 'OptaPlanner'
  1. OptaPlanner
  2. PLANNER-650

NullPointerException when using an empty kmodule.xml or a default ksessionName

XMLWordPrintable

    • Hide

      1. Build the attached project using Drools Workbench 6.5.0.CR1
      2. Create a container 'optacloud_1_0_0' in Drools Workbench
      3. Create Solver via REST API (http://localhost/kie-server/services/rest/server/containers/optacloud_1_0_0/solvers/solver1) with request:
      <solver-instance>
      <solver-config-file>demo/optacloud/cloudBalancingSolverConfig.solver.xml</solver-config-file>
      </solver-instance>
      4. Submit problem via REST API (http://localhost:8080/kie-server/services/rest/server/containers/optacloud_1_0_0/solvers/solver1) with request:
      <solver-instance>
      <status>SOLVING</status>
      <planning-problem class="demo.optacloud.CloudBalance">
      <computerList>
      <demo.optacloud.Computer>
      <cpuPower>10</cpuPower>
      <memory>4</memory>
      <networkBandwidth>100</networkBandwidth>
      <cost>1000</cost>
      </demo.optacloud.Computer>
      <demo.optacloud.Computer>
      <cpuPower>20</cpuPower>
      <memory>8</memory>
      <networkBandwidth>100</networkBandwidth>
      <cost>3000</cost>
      </demo.optacloud.Computer>
      </computerList>
      <processList>
      <demo.optacloud.Process>
      <requiredCpuPower>1</requiredCpuPower>
      <requiredMemory>7</requiredMemory>
      <requiredNetworkBandwidth>1</requiredNetworkBandwidth>
      </demo.optacloud.Process>
      </processList>
      </planning-problem>
      </solver-instance>

      Show
      1. Build the attached project using Drools Workbench 6.5.0.CR1 2. Create a container 'optacloud_1_0_0' in Drools Workbench 3. Create Solver via REST API ( http://localhost/kie-server/services/rest/server/containers/optacloud_1_0_0/solvers/solver1 ) with request: <solver-instance> <solver-config-file>demo/optacloud/cloudBalancingSolverConfig.solver.xml</solver-config-file> </solver-instance> 4. Submit problem via REST API ( http://localhost:8080/kie-server/services/rest/server/containers/optacloud_1_0_0/solvers/solver1 ) with request: <solver-instance> <status>SOLVING</status> <planning-problem class="demo.optacloud.CloudBalance"> <computerList> <demo.optacloud.Computer> <cpuPower>10</cpuPower> <memory>4</memory> <networkBandwidth>100</networkBandwidth> <cost>1000</cost> </demo.optacloud.Computer> <demo.optacloud.Computer> <cpuPower>20</cpuPower> <memory>8</memory> <networkBandwidth>100</networkBandwidth> <cost>3000</cost> </demo.optacloud.Computer> </computerList> <processList> <demo.optacloud.Process> <requiredCpuPower>1</requiredCpuPower> <requiredMemory>7</requiredMemory> <requiredNetworkBandwidth>1</requiredNetworkBandwidth> </demo.optacloud.Process> </processList> </planning-problem> </solver-instance>
    • NEW
    • NEW

      There is null pointer exception error when try to submit problem to solver via REST API in KIE server. The attached project is created by Drools Workbench 6.5.0.CR1.

      KIE Container and Solver are created successfully.

      08:27:50,569 INFO [org.kie.server.services.impl.KieServerImpl] (EJB default - 2) Container optacloud_1_0_0 (for release id demo:optacloud:0.0.1) successfully started
      08:27:56,076 INFO [org.uberfire.ext.security.management.BackendUserSystemManager] (default task-21) Using the user management service named 'WildflyCLIUserManagementService'
      08:28:19,332 INFO [org.kie.server.services.optaplanner.SolverServiceBase] (default task-7) Solver 'solver1' successfully created in container 'optacloud_1_0_0'

      Null pointer exception when submitting problem via REST API:

      08:35:54,444 ERROR [org.kie.server.services.optaplanner.SolverServiceBase] (pool-8-thread-2) Exception executing solver 'solver1' from container 'optacloud_1_0_0'. Thread will terminate.: java.lang.NullPointerException
      at java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011)
      at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006)
      at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:692)
      at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:652)
      at org.optaplanner.core.impl.score.director.drools.DroolsScoreDirectorFactory.newKieSession(DroolsScoreDirectorFactory.java:113)
      at org.optaplanner.core.impl.score.director.drools.DroolsScoreDirector.resetKieSession(DroolsScoreDirector.java:68)
      at org.optaplanner.core.impl.score.director.drools.DroolsScoreDirector.setWorkingSolution(DroolsScoreDirector.java:61)
      at org.optaplanner.core.impl.solver.scope.DefaultSolverScope.setWorkingSolutionFromBestSolution(DefaultSolverScope.java:198)
      at org.optaplanner.core.impl.solver.DefaultSolver.solvingStarted(DefaultSolver.java:196)
      at org.optaplanner.core.impl.solver.DefaultSolver.solve(DefaultSolver.java:175)
      at org.kie.server.services.optaplanner.SolverServiceBase$1.run(SolverServiceBase.java:329)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)

              gdesmet@redhat.com Geoffrey De Smet (Inactive)
              tseji_jira Jim Tse (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: