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

NullPointerException under scala's SBT

XMLWordPrintable

    • 2018 Week 30-32
    • 1
    • NEW
    • NEW

      [info]   java.lang.NullPointerException:
      [info]   at org.optaplanner.core.config.util.ConfigUtils.resolveThreadPoolSizeScript(ConfigUtils.java:268)
      [info]   at org.optaplanner.core.config.solver.SolverConfig.resolveMoveThreadCount(SolverConfig.java:310)
      [info]   at org.optaplanner.core.config.solver.SolverConfig.buildSolver(SolverConfig.java:250)
      [info]   at org.optaplanner.core.impl.solver.AbstractSolverFactory.buildSolver(AbstractSolverFactory.java:61)
      [info]   at SchoolYearScheduleSolverSpec.$anonfun$new$1(SchoolYearScheduleSolverSpec.scala:19)
      [info]   at org.scalatest.OutcomeOf.outcomeOf(OutcomeOf.scala:85)
      [info]   at org.scalatest.OutcomeOf.outcomeOf$(OutcomeOf.scala:83)
      [info]   at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
      [info]   at org.scalatest.Transformer.apply(Transformer.scala:22)
      [info]   at org.scalatest.Transformer.apply(Transformer.scala:20)
      

      <jcalonso> diggin a bit more I found that is because "new ScriptEngineManager().getEngineByName(scriptLanguage);" returns null
      <jcalonso> here https://github.com/kiegroup/optaplanner/blob/985dbe3b9575e8cf4663eb8e7ab12646dd110410/optaplanner-core/src/main/java/org/optaplanner/core/config/util/ConfigUtils.java#L267
      <jcalonso> and doing: new NashornScriptEngineFactory().getScriptEngine() works fine

      https://github.com/sbt/sbt/issues/1214

      Proposal A: fail fast with a clear error message
      Proposal B: fix it

      Workaround: adding fork in Test := true solves the problem

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

                Created:
                Updated:
                Resolved: