Drools 5.4.0.Final无法在Java 8

时间:2016-06-21 21:48:18

标签: java eclipse jar drools

Caused by: java.lang.RuntimeException: The Eclipse JDT Core jar is not in the classpath

当我尝试构建我的类时,我遇到了上述错误。我正在使用Drools 5.4.0.Final,我已手动将ecj-4.5.1.jar添加到我的构建路径中,但它仍然说:

  

JDT核心不在类路径中。

我正在使用Eclipse MarsJdk 1.8drools 5.4.0.Final

有人可以建议解决方案吗?

编辑:(StackTrace已添加)

 [echo] Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'droolsProcessingFactory' defined in class path resource [com/opr/amt/atm/testConfig.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.att.lpp.fw.drools.factory.DroolsProcessingFactory]: Constructor threw exception; nested exception is org.drools.RuntimeDroolsException: Unable to load dialect 'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java:org.drools.rule.builder.dialect.java.JavaDialectConfiguration'
 [echo]     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1105)
 [echo]     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1050)
 [echo]     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
 [echo]     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
 [echo]     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)
 [echo]     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
 [echo]     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301)
 [echo]     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
 [echo]     at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
 [echo] Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.drools.factory.DroolsProcessingFactory]: Constructor threw exception; nested exception is org.drools.RuntimeDroolsException: Unable to load dialect 'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java:org.drools.rule.builder.dialect.java.JavaDialectConfiguration'
 [echo]     at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163)
 [echo]     at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89)
 [echo]     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1098)
 [echo] Caused by: org.drools.RuntimeDroolsException: Unable to load dialect 'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java:org.drools.rule.builder.dialect.java.JavaDialectConfiguration'
 [echo]     at org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:313)
 [echo]     at org.drools.compiler.PackageBuilderConfiguration.buildDialectConfigurationMap(PackageBuilderConfiguration.java:298)
 [echo]     at org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:187)
 [echo]     at org.drools.compiler.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:165)
 [echo]     at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:301)
 [echo]     at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:229)
 [echo]     at org.drools.builder.impl.KnowledgeBuilderFactoryServiceImpl.newKnowledgeBuilder(KnowledgeBuilderFactoryServiceImpl.java:34)
 [echo]     at org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(KnowledgeBuilderFactory.java:46)
 [echo]     at com.drools.factory.DroolsProcessingFactory.<init>(DroolsProcessingFactory.java:21)
 [echo]     at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
 [echo]     at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
 [echo] Caused by: java.lang.RuntimeException: The Eclipse JDT Core jar is not in the classpath

1 个答案:

答案 0 :(得分:0)

添加ecj-4.5.1.jar后问题得以解决。问题是ecj jar必须与项目位于同一类路径下。如果jar的类路径不同,那么在库文件夹下添加ecj jar本身就行不通了。