Re: [rules-users] Need Help: Error creating bean with name 'kbase'
I was able to fix this one. The issue was that the jars are not visible during runtime. So what i did was include the jar files in the maven file with runtime scope dependency groupIdorg.drools/groupId artifactIddrools-compiler/artifactId version5.4.0.CR1/version scoperuntime/scope /dependency dependency groupIdorg.drools/groupId artifactIddrools-core/artifactId version5.4.0.CR1/version scoperuntime/scope /dependency dependency groupIdorg.drools/groupId artifactIddrools-decisiontables/artifactId version5.4.0.CR1/version scoperuntime/scope /dependency dependency groupIdorg.drools/groupId artifactIddrools-jsr94/artifactId version5.4.0.CR1/version scoperuntime/scope /dependency dependency groupIdorg.drools/groupId artifactIdknowledge-api/artifactId version5.4.0.CR1/version scoperuntime/scope /dependency dependency groupIdorg.mvel/groupId artifactIdmvel2/artifactId version2.1.0.drools14/version scoperuntime/scope /dependency dependency groupIdxpp3/groupId artifactIdxpp3_min/artifactId version1.1.4c/version scoperuntime/scope /dependency dependency groupIdorg.drools/groupId artifactIddrools-spring/artifactId version5.4.0.CR1/version scoperuntime/scope /dependency dependency groupIdorg.antlr/groupId artifactIdantlr-runtime/artifactId version3.4/version scoperuntime/scope /dependency -- View this message in context: http://drools.46999.n3.nabble.com/Need-Help-Error-creating-bean-with-name-kbase-tp3937782p3949913.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Need Help: Error creating bean with name 'kbase'
Based from the logs my error is on the autowiring of session and/or the knowledgebase. I am not sure what i did wrong. Here's my latest setup. ?xml version=1.0 encoding=UTF-8? beans:beans xmlns=http://www.springframework.org/schema/mvc; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:beans=http://www.springframework.org/schema/beans; xmlns:context=http://www.springframework.org/schema/context; xmlns:drools=http://drools.org/schema/drools-spring; xsi:schemaLocation=http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd 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.xsd; annotation-driven / drools:kbase id=kbase drools:resources drools:resource type=DRL source=classpath:validation.drl/drools:resource /drools:resources /drools:kbase drools:ksession id=ksession type=stateless name=ksession kbase=kbase / resources mapping=/resources/** location=/resources/ / beans:bean class=org.springframework.web.servlet.view.InternalResourceViewResolver beans:property name=prefix value=/WEB-INF/views/ / beans:property name=suffix value=.jsp / /beans:bean context:component-scan base-package=com.spring.drools / /beans:beans === @Controller public class HomeController { private static final Logger logger = LoggerFactory.getLogger(HomeController.class); @Autowired private StatelessKnowledgeSession ksession; /** * Simply selects the home view to render by returning its name. */ @RequestMapping(value = /, method = RequestMethod.GET) public String home(Locale locale, Model model) { logger.info(Welcome home! the client locale is + locale.toString()); Date date = new Date(); DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale); String formattedDate = dateFormat.format(date); model.addAttribute(serverTime, formattedDate ); return home; } } === *Exception* === SEVERE: PWC1306: Startup of context /SpringDrools1 failed due to previous errors INFO: PWC1412: WebModule[null] ServletContext.log():Destroying Spring FrameworkServlet 'appServlet' INFO: PWC1412: WebModule[null] ServletContext.log():Closing Spring root WebApplicationContext INFO: INFO : org.springframework.web.context.support.XmlWebApplicationContext - Closing Root WebApplicationContext: startup date [Thu Apr 26 14:06:19 CST 2012]; root of context hierarchy INFO: INFO : org.springframework.beans.factory.support.DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@33eca56a: defining beans []; root of factory hierarchy SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'resource' threw exception; nested exception is java.lang.NoSuchMethodError: org.drools.util.ClassLoaderUtil.getClassLoader([Ljava/lang/ClassLoader;Ljava/lang/Class;Z)Lorg/drools/util/CompositeClassLoader; at org.apache.catalina.core.StandardContext.start(StandardContext.java:5389) at com.sun.enterprise.web.WebModule.start(WebModule.java:498) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2018) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1669) at com.sun.enterprise.web.WebApplication.start(WebApplication.java:109) at
[rules-users] Need Help: Error creating bean with name 'kbase'
Hi everyone. I am new to Drools and Spring MVC. I tried out the example from http://blog.athico.com/2011/01/rules-based-validation-using-drools.html http://blog.athico.com/2011/01/rules-based-validation-using-drools.html but still I am getting an error. I have beeng looking over the net for hours now. and have tried everything i can/know to make it work. I also have tried multiple tutorials, blogs etc. But i still cant seem to get away from that error. I would greatly appreciate any help. Thanks in advance. *Servlet Context* === ?xml version=1.0 encoding=UTF-8? beans:beans xmlns=http://www.springframework.org/schema/mvc; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:beans=http://www.springframework.org/schema/beans; xmlns:context=http://www.springframework.org/schema/context; xmlns:drools=http://drools.org/schema/drools-spring; xsi:schemaLocation=http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd 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.xsd; annotation-driven / resources mapping=/resources/** location=/resources/ / beans:bean class=org.springframework.web.servlet.view.InternalResourceViewResolver beans:property name=prefix value=/WEB-INF/views/ / beans:property name=suffix value=.jsp / /beans:bean context:component-scan base-package=com.spring.mvc / drools:kbase id=kbase drools:resources drools:resource type=DRL source=classpath:validation.drl/drools:resource /drools:resources /drools:kbase drools:ksession id=ksession type=stateless name=ksession kbase=kbase / beans:bean id=validator class=org.springframework.validation.beanvalidation.LocalValidatorFactoryBean/beans:bean beans:bean id=collaborators class=com.spring.mvc.validation.Collaborators beans:constructor-arg beans:map beans:entry key=applicantDao value-ref=applicantDao/beans:entry /beans:map /beans:constructor-arg /beans:bean beans:bean id=applicantDao class=com.spring.mvc.service.ApplicantDaoImpl/beans:bean /beans:beans === *Here's the exception* === INFO: ERROR: org.springframework.web.servlet.DispatcherServlet - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'kbase': Cannot create inner bean '(inner bean)' of type [org.drools.container.spring.beans.DroolsResourceAdapter] while setting bean property 'resources' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#16': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'resource' threw exception; nested exception is java.lang.NoSuchMethodError: org.drools.util.ClassLoaderUtil.getClassLoader([Ljava/lang/ClassLoader;Ljava/lang/Class;Z)Lorg/drools/util/CompositeClassLoader; at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:281) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:125) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:353) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:153) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1360) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118) at
Re: [rules-users] Need Help: Error creating bean with name 'kbase'
I am still working on this item today I would greatly appreciate any help. Thanks. -- View this message in context: http://drools.46999.n3.nabble.com/Need-Help-Error-creating-bean-with-name-kbase-tp3937782p3940150.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users