[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* === 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";> === *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 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913) at org.springframework.context.support.AbstractApplicationConte
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
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. 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";> === @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 org.glassfish.internal.data.EngineRef.start(EngineRef.java:130) at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269) at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:301) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240) at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389) at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunne
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 org.drools drools-compiler 5.4.0.CR1 runtime org.drools drools-core 5.4.0.CR1 runtime org.drools drools-decisiontables 5.4.0.CR1 runtime org.drools drools-jsr94 5.4.0.CR1 runtime org.drools knowledge-api 5.4.0.CR1 runtime org.mvel mvel2 2.1.0.drools14 runtime xpp3 xpp3_min 1.1.4c runtime org.drools drools-spring 5.4.0.CR1 runtime org.antlr antlr-runtime 3.4 runtime -- 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