简体   繁体   English

由 java.lang.RuntimeException 引起的线程“main”java.lang.ExceptionInInitializerError 中的异常:无法实例 KieServices

[英]Exception in thread "main" java.lang.ExceptionInInitializerError caused by java.lang.RuntimeException: Unable to instance KieServices

I am trying to get started with Drools 6x, and in eclipse, I have created a Drools project, which creates the boilerplate code to run a simple drl.我正在尝试开始使用 Drools 6x,并且在 eclipse 中,我创建了一个 Drools 项目,该项目创建了样板代码来运行一个简单的 drl。

I have the drools runtime installed via Eclipse.我通过 Eclipse 安装了 drools 运行时。

I have drools libraries, drools-core-5.0.1.jar,kie-api-6.0.0.beta4.jar,kie-internal-6.0.0.beta2.jar as External jars in my project.我有 drools 库,drools-core-5.0.1.jar,kie-api-6.0.0.beta4.jar,kie-internal-6.0.0.beta2.jar 作为我项目中的外部 jars。

Yet, when I try to run the following, I get the following error:但是,当我尝试运行以下命令时,出现以下错误:

 java.lang.ExceptionInInitializerError 
at com.sample.PetStoreExample.init(PetStoreExample.java:78)
at com.sample.PetStoreExample.main(PetStoreExample.java:67) Caused by: java.lang.RuntimeException: Unable to instance KieServices 
    at org.kie.api.KieServices$Factory.<clinit>(KieServices.java:137) 
    ... 1 more Caused by: java.lang.ClassNotFoundException:org.drools.compiler.kie.builder.impl.KieServicesImpl  at java.net.URLClassLoader$1.run(Unknown Source) 
    at java.net.URLClassLoader$1.run(Unknown Source) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.net.URLClassLoader.findClass(Unknown Source) 
    at java.lang.ClassLoader.loadClass(Unknown Source) 
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) 
    at java.lang.ClassLoader.loadClass(Unknown Source) 
    at java.lang.Class.forName0(Native Method) 
    at java.lang.Class.forName(Unknown Source) 
    at org.kie.api.KieServices$Factory.<clinit>(KieServices.java:165) 
    ... 1 more  

If you downloaded the zip of Jars from http://www.drools.org/ , you're going to want to include every jar from /binaries in your project.如果您从http://www.drools.org/下载了 Jars 的 zip,您将希望将 /binaries 中的每个 jar 都包含在您的项目中。 Even the ones that seem like you won't use.即使那些看起来你不会使用的。

I had this same problem too because I assumed I only needed to use a few Jars, but it turns out they all depend on classes from the other jars in that zip folder.我也遇到了同样的问题,因为我假设我只需要使用几个 jar,但事实证明它们都依赖于该 zip 文件夹中其他 jar 的类。

I had this problem because I had both kie-api and kie-ci as dependencies in my pom file.我遇到了这个问题,因为我的 pom 文件中有kie-apikie-ci作为依赖项。 I removed the kie-ci dependency and I'm not getting this issue any more.我删除了kie-ci依赖项,我不再遇到这个问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 原因:java.lang.ExceptionInInitializerError原因:java.lang.RuntimeException - Caused by: java.lang.ExceptionInInitializerError Caused by: java.lang.RuntimeException 线程“主”中的异常java.lang.ExceptionInInitializerError原因:java.lang.NullPointerException - Exception in thread “main” java.lang.ExceptionInInitializerError Caused by: java.lang.NullPointerException 在线程“主”中获取异常java.lang.ExceptionInInitializerError异常 - Getting Exception in thread “main” java.lang.ExceptionInInitializerError Exception 配置中的无效映射导致线程“主”中的休眠映射异常java.lang.ExceptionInInitializerError - Hibernate Mapping Exception in thread “main” java.lang.ExceptionInInitializerError caused by Invalid Mapping at configuration 获取错误“线程“ main”中的异常java.lang.ExceptionInInitializerError” - Getting Error “Exception in thread ”main“ java.lang.ExceptionInInitializerError” Spring Error-线程“ main”中的异常java.lang.ExceptionInInitializerError - Spring Error- Exception in thread “main” java.lang.ExceptionInInitializerError 线程“主”中的休眠异常java.lang.ExceptionInInitializerError - Hibernate Exception in thread “main” java.lang.ExceptionInInitializerError 线程“主”中的异常java.lang.ExceptionInInitializerError(Clojure) - Exception in thread “main” java.lang.ExceptionInInitializerError (Clojure) 线程“ main”中的异常java.lang.RuntimeException:无法构造应用程序实例:类View - Exception in thread “main” java.lang.RuntimeException: Unable to construct Application instance: class View java.lang.ExceptionInInitializerError异常 - java.lang.ExceptionInInitializerError exception
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM