[jboss-jira] [JBoss JIRA] (DROOLS-396) Caused by: java.lang.NoClassDefFoundError: org/drools/event/DebugProcessEventListener

Kenny Wottrich (JIRA) issues at jboss.org
Tue Aug 2 09:09:02 EDT 2016


    [ https://issues.jboss.org/browse/DROOLS-396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13273659#comment-13273659 ] 

Kenny Wottrich edited comment on DROOLS-396 at 8/2/16 9:08 AM:
---------------------------------------------------------------

-I had the same issue, and determined that it was caused by attempting to use Spring to inject a rules engine into a class that had other dependencies autowired in (as in, the rules engine was not autowired in, but all of the other dependencies were).  The fix for me was to put all dependencies into the XML config, and not mix and match autowire and XML-

EDIT: Never mind.  This fixed the issue for one bean, but did NOT fix the issue for another bean.  I'm still searching for a solution.


was (Author: kenny.wottrich):
I had the same issue, and determined that it was caused by attempting to use Spring to inject a rules engine into a class that had other dependencies autowired in -- as in, the rules engine was not autowired in, but all of the other dependencies were.  In our Spring XML config, I had:

<bean id="myBean" class="com.example.myBeanImpl" scope="request">
	<aop:scoped-proxy />
	<property name="rulesEngine" ref="rulesEngineDef" />
</bean>

I think the {{<aop:scoped-proxy />}} was causing it to try to set dependencies with different scopes.

*The fix for me was to put all dependencies into the XML config, and not mix and match autowire and XML*:

<bean id="myBean" class="com.example.myBeanImpl" scope="request">
	<aop:scoped-proxy />
	<property name="otherDependency" ref="otherDependencyDef" />
	...
	<property name="rulesEngine" ref="rulesEngineDef" />
</bean>

> Caused by: java.lang.NoClassDefFoundError: org/drools/event/DebugProcessEventListener
> -------------------------------------------------------------------------------------
>
>                 Key: DROOLS-396
>                 URL: https://issues.jboss.org/browse/DROOLS-396
>             Project: Drools
>          Issue Type: Bug
>    Affects Versions: 6.0.0.Final
>            Reporter: leonardo lizana
>            Assignee: Petr Široký
>            Priority: Critical
>         Attachments: noclassdeffound.zip
>
>
> I'm trying to testing latest version of drools 6.0.1.Final version and i have the issue of  " java.lang.NoClassDefFoundError: org/drools/event/DebugProcessEventListener" . However, i can see class is now on the  the following path "org.drools.core.event.DebugProcessEventListener" and why the context is seeking in  org/drools/event/DebugProcessEventListener. instead of "org.drools.core.event.DebugProcessEventListener"
> is there anything that i'm doing bad?
> * with drools 5.5 everything is working OK.
> Here is my pom.xml
> --------------------------
> <dependency>
> 			<groupId>org.drools</groupId>
> 			<artifactId>knowledge-api</artifactId>
> 			<version>${drools.version}</version>
> 		</dependency>
> 		<dependency>
> 			<groupId>org.drools</groupId>
> 			<artifactId>drools-core</artifactId>
> 			<version>${drools.version}</version>
> 		</dependency>
> 		<dependency>
> 			<groupId>org.drools</groupId>
> 			<artifactId>drools-compiler</artifactId>
> 			<version>${drools.version}</version>
> 		</dependency>
> 		<dependency>
> 			<groupId>org.drools</groupId>
> 			<artifactId>drools-spring</artifactId>
> 			<version>5.5.0.Final</version>
> 		</dependency>
> here is the log error:
> ----------------------------
> Caused by: java.lang.NoClassDefFoundError: org/drools/event/DebugProcessEventListener
> 	at org.drools.container.spring.namespace.KnowledgeSessionDefinitionParser.parseInternal(KnowledgeSessionDefinitionParser.java:115)
> 	at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:59)
> 	at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)
> 	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1338)
> 	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1328)
> 	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
> 	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93)
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
> Here is the contex-drools.xml
> -------------------------------------
> <beans xmlns="http://www.springframework.org/schema/beans"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xmlns:context="http://www.springframework.org/schema/context"
>     xmlns:drools="http://drools.org/schema/drools-spring"
>     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
>     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
>     http://drools.org/schema/drools-spring http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-container/drools-spring/src/main/resources/org/drools/container/spring/drools-spring-1.2.0.xsd"
>     default-autowire="byName">
>      
>   <drools:resource id="rulesEnergyUsage" type="DRL" source="classpath:com/aepenergy/b2b/miscpull/rules/rulesEnergyUsage.drl"/>
>   <drools:kbase id="kBaseEnergyUsage">
>     <drools:resources>
>       <drools:resource ref="rulesEnergyUsage"/>
>     </drools:resources>
>   </drools:kbase>
>   <drools:ksession id="kSessionEnergyUsage"  kbase="kBaseEnergyUsage" type="stateful"/>
>  </beans>



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)



More information about the jboss-jira mailing list