我正在使用带有弹簧集成的Drools 6.2.0。 spring-context.xml文件如下:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:kie="http://drools.org/schema/kie-spring"
xsi:schemaLocation="http://drools.org/schema/kie-spring http://drools.org/schema/kie-spring.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<kie:kmodule id="poc-module">
<kie:kbase name="kbase" packages="com.sample">
<kie:ksession name="droolsSession">
<kie:consoleLogger />
</kie:ksession>
</kie:kbase>
</kie:kmodule>
<bean id="kiePostProcessor" class="org.kie.spring.KModuleBeanFactoryPostProcessor"/>
<bean id="ruleRunner" class="com.sample.RuleRunner"/>
</beans>
然后我在部署应用程序时遇到了spring bean初始化错误。
[ERROR ] Uncaught.init.exception.thrown.by.servlet mvc-dispatcher springexample
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'droolsSession':
Cannot resolve reference to bean 'kbase' while setting bean property 'kBase';
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'kbase':
Invocation of init method failed;
nested exception is java.lang.IllegalArgumentException:
Unable to retrieve contents of directory 'C:\Documents and Settings'.
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:334)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1419)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:618)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:651)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:602)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:665)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:521)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:462)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
at javax.servlet.GenericServlet.init(GenericServlet.java:161)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:325)
at [internal classes]
似乎drools kbase bean包试图访问root“/”。请建议我在drools 6.2.0 Spring集成中缺少的任何配置。
答案 0 :(得分:-1)
反斜杠字符是Java中的转义字符。要使用它&#34;按原样#34;,你必须加倍:&#34; \\&#34;。
如果你注意,你会发现路径不完整。它可能试图推断一些默认路径。
尝试明确提供。