请指出我的问题或提供一些建议我如何进一步调查问题!
我正在使用optaplanner v6.4.x.我创建了一个java项目,它只包含运行最小NQueens示例https://github.com/kiegroup/optaplanner/blob/6.4.x/optaplanner-examples/src/main/java/org/optaplanner/examples/nqueens/app/NQueensHelloWorld.java所需的类。以下是主要方法的输出:
Solved 8 queens:
_ _ _ _ Q _ _ _
_ Q _ _ _ _ _ _
_ _ _ Q _ _ _ _
_ _ _ _ _ Q _ _
_ _ _ _ _ _ _ Q
_ _ Q _ _ _ _ _
Q _ _ _ _ _ _ _
_ _ _ _ _ _ Q _
我正在使用maven-assembly-plugin构建一个uber-jar,它将应用程序和所有依赖项打包到一个可执行jar中。在pom.xml的相关部分下面
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<archive>
<manifest>
<mainClass>org.optaplanner.examples.nqueens.app.NQueensHelloWorld</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
我可以按如下方式构建jar:
$ mvn clean compile assembly:single
在target
目录中创建一个nqueens.jar。当我启动jar
$ java -jar target/nqueens.jar
我收到以下NullPointerException:
线程中的异常&#34; main&#34;显示java.lang.NullPointerException
在org.drools.compiler.rule.builder.PackageBuildContext.init(PackageBuildContext.java:104)
在org.drools.compiler.rule.builder.RuleBuildContext。(RuleBuildContext.java:80)
at org.drools.compiler.builder.impl.KnowledgeBuilderImpl.buildRuleBuilderContext(KnowledgeBuilderImpl.java:1804)
at org.drools.compiler.builder.impl.KnowledgeBuilderImpl.preProcessRules(KnowledgeBuilderImpl.java:1125)
at org.drools.compiler.builder.impl.KnowledgeBuilderImpl.compileRules(KnowledgeBuilderImpl.java:1106)
at org.drools.compiler.builder.impl.KnowledgeBuilderImpl.compileAllRules(KnowledgeBuilderImpl.java:989)
at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.buildRules(CompositeKnowledgeBuilderImpl.java:260)
at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.buildPackages(CompositeKnowledgeBuilderImpl.java:121)
at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:105)
在org.drools.compiler.kie.builder.impl.AbstractKieModule.buildKnowledgePackages(AbstractKieModule.java:243)
在org.drools.compiler.kie.builder.impl.AbstractKieProject.verify(AbstractKieProject.java:64)
在org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildKieProject(KieBuilderImpl.java:230)
在org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:198)
在org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig.buildDroolsScoreDirectorFactory(ScoreDirectorFactoryConfig.java:447)
在org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig.buildScoreDirectorFactory(ScoreDirectorFactoryConfig.java:298)
在org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig.buildScoreDirectorFactory(ScoreDirectorFactoryConfig.java:230)
在org.optaplanner.core.config.solver.SolverConfig.buildSolver(SolverConfig.java:233)
在org.optaplanner.core.impl.solver.AbstractSolverFactory.buildSolver(AbstractSolverFactory.java:52)
在org.optaplanner.examples.nqueens.app.NQueensHelloWorld.main(NQueensHelloWorld.java:33)