Hi,
WIKI Knowledgebase have a solution for the error
like:org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/eclipse/jdt/core/compiler/CategorizedProblem;
I have added the JANINO compiler in the PackageBuilderConfiguration in
the Java Code: But It's not resolving my problem and the same error
message is coming:
My Code:
public class RuleBaseBeanFactory implements FactoryBean, InitializingBean {
private List<Resource> drlResourceList;
private RuleBase ruleBase;
private PackageBuilderConfiguration packageBuilderConfiguration;
public void setDrlResourceList(List<Resource> drlResourceList) {
this.drlResourceList = drlResourceList;
}
public void afterPropertiesSet() throws Exception {
Assert.notEmpty(drlResourceList, "drlResourceList must not be empty");
PackageBuilder builder = (packageBuilderConfiguration != null
? new PackageBuilder(packageBuilderConfiguration) : new
PackageBuilder());
packageBuilderConfiguration.setCompiler(packageBuilderConfiguration.JANINO);
for (Resource resource : drlResourceList) {
builder.addPackageFromDrl(new
InputStreamReader(resource.getInputStream())); // TODO will use
default encoding which might not be wanted
}
ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage(builder.getPackage());
}
public RuleBase getObject() {
return ruleBase;
}
public Class getObjectType() {
return RuleBase.class;
}
public boolean isSingleton() {
return true;
}
public void
setPackageBuilderConfiguration(PackageBuilderConfiguration
packageBuilderConfiguration) {
this.packageBuilderConfiguration = packageBuilderConfiguration;
}
}
Please suggest a solution..
On 2/20/07, Niyas <niyasahmed(a)gmail.com> wrote:
Hi Edson,
Thanks for your reply.
Yes, you are correct and I have changed the operator ">" . But I am
getting some other error now.
javax.servlet.ServletException: Servlet.init() for servlet insurance
threw exception
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Thread.java:595)
root cause
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name '/home.htm' defined in ServletContext resource
[/WEB-INF/insurance-servlet.xml]: Cannot resolve reference to bean
'ruleBase' while setting bean property 'ruleBase'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'ruleBase' defined in ServletContext resource
[/WEB-INF/insurance-servlet.xml]: Initialization of bean failed;
nested exception is java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/eclipse/jdt/core/compiler/CategorizedProblem;
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:190)
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1046)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:857)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:378)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:233)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:145)
org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:537)
org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.registerHandler(AbstractUrlHandlerMapping.java:186)
org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping.initApplicationContext(BeanNameUrlHandlerMapping.java:62)
org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:73)
org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:84)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:277)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:395)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:233)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:145)
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:283)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:313)
org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:139)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:306)
org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:251)
org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:220)
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:112)
javax.servlet.GenericServlet.init(GenericServlet.java:211)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Thread.java:595)
And also while I starting the tomcat, in the server console the same
error message is displaying:
Feb 20, 2007 5:00:15 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Feb 20, 2007 5:00:16 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Feb 20, 2007 5:00:16 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/31 config=null
Feb 20, 2007 5:00:16 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Feb 20, 2007 5:00:16 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 9609 ms
java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult
.getProblems()[Lorg/eclipse/jdt/core/compiler/CategorizedProblem;
at
org.apache.commons.jci.compilers.EclipseJavaCompiler$2.acceptResult(E
clipseJavaCompiler.java:237)
at
org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:335)
at
org.apache.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJ
avaCompiler.java:268)
at org.drools.compiler.PackageBuilder.compileAll(Unknown Source)
at org.drools.compiler.PackageBuilder.addPackage(Unknown Source)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(Unknown
Source)
at
com.sample.RuleBaseBeanFactory.afterPropertiesSet(RuleBaseBeanFactory
.java:31)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1091)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:396)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:233)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:145)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver
.resolveReference(BeanDefinitionValueResolver.java:186)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver
.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1046)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.populateBean(AbstractAutowireCapableBeanFactory.java:857)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:378)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:233)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:145)
at
org.springframework.context.support.AbstractApplicationContext.getBea
n(AbstractApplicationContext.java:537)
at
org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.reg
isterHandler(AbstractUrlHandlerMapping.java:186)
at
org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping.ini
tApplicationContext(BeanNameUrlHandlerMapping.java:62)
at
org.springframework.context.support.ApplicationObjectSupport.setAppli
cationContext(ApplicationObjectSupport.java:73)
at
org.springframework.context.support.ApplicationContextAwareProcessor.
postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:84)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanF
actory.java:277)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:395)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:233)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:145)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.
preInstantiateSingletons(DefaultListableBeanFactory.java:283)
at
org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:313)
at
org.springframework.web.context.support.AbstractRefreshableWebApplica
tionContext.refresh(AbstractRefreshableWebApplicationContext.java:139)
at
org.springframework.web.servlet.FrameworkServlet.createWebApplication
Context(FrameworkServlet.java:306)
at
org.springframework.web.servlet.FrameworkServlet.initWebApplicationCo
ntext(FrameworkServlet.java:251)
at
org.springframework.web.servlet.FrameworkServlet.initServletBean(Fram
eworkServlet.java:220)
at
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.
java:112)
at javax.servlet.GenericServlet.init(GenericServlet.java:211)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
java:1105)
at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.jav
a:757)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:130)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:178)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:126)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:105)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:107)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:148)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:869)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p
rocessConnection(Http11BaseProtocol.java:664)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
int.java:527)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFol
lowerWorkerThread.java:80)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:684)
at java.lang.Thread.run(Thread.java:595)
On 2/20/07, Edson Tirelli <tirelli(a)post.com> wrote:
>
> Hi Niyas,
>
> This is something I faced yesterday but did not had the time to work
> on it yet. Basically, 2 problems:
>
> 1. Error message is crap... we need to improve that.
>
> 2. It should not be raising any error. The error means you have a String
> attribute you are trying to compare using operators like >, <, >=, <=.
> Example:
>
> Person( name > 'Edson' )
>
> And I think the above should work but is not working. I will open a
> JIRA for that.
> Meanwhile, if you need to have such constraint, a workaround is to
> use a predicate:
>
> Person( $n : name, ( $n.compareTo( 'Edson' ) > 0 ) )
>
> []s
> Edson
>
>
> Niyas wrote:
>
> > I have tried of using the sample coding given the link given by you:
> > But i am getting the following error:
> > org.springframework.beans.factory.BeanCreationException: Error
> > creating bean with name 'ruleBase' defined in ServletContext resource
> > [/WEB-INF/insurance-servlet.xml]: Initialization of bean failed;
> > nested exception is java.lang.RuntimeException: Operator '40' does not
> > exist for StringEvaluator
> >
>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:403)
> >
> >
>
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:233)
> >
> >
>
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:145)
> >
> >
>
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:277)
> >
> >
>
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:313)
> >
> >
>
org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:139)
> >
> >
>
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:306)
> >
> >
>
org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:251)
> >
> >
>
org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:220)
> >
> >
>
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:112)
> >
> > javax.servlet.GenericServlet.init(GenericServlet.java:211)
> >
>
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> >
> >
>
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> >
> >
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
> >
> >
>
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
> >
> >
>
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
> >
> >
>
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
> >
> >
>
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
> >
> > java.lang.Thread.run(Thread.java:595)
> > ========================================================
> > My insurance-servlet.xml:
> > <beans>
> > <!-- default handlermapping -->
> > <bean id="beanNameUrlMapping"
> >
>
class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"/>
> >
> >
> > <bean name="/home.htm"
class="com.sample.InsuranceController"
> > singleton="false">
> > <property name="ruleBase">
> > <ref bean="ruleBase"/>
> > </property>
> > <property name="insurBean">
> > <ref bean="insurance"/>
> > </property>
> > </bean>
> >
> > <!-- View Resolver -->
> > <bean id="viewResolver"
> >
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
> >
> > <property name="prefix">
> > <value>/WEB-INF/jsp/</value>
> > </property>
> > <property name="suffix">
> > <value>.jsp</value>
> > </property>
> > </bean>
> >
> > <!-- Bean -->
> > <bean id="insurance"
class="com.sample.InsuranceBean"/>
> >
> >
> > <bean id="ruleBase"
class="com.sample.RuleBaseBeanFactory">
> > <property name="drlResourceList">
> > <list>
> > <value
> >
>
type="org.springframework.core.io.Resource">classpath:/com/sample/Approval.drl</value>
> >
> > </list>
> > </property>
> >
> > <property name="packageBuilderConfiguration">
> > <bean
> > class="org.drools.compiler.PackageBuilderConfiguration">
> > <property name="javaLanguageLevel"
value="1.5"/>
> > </bean>
> > </property>
> > </bean>
> > </beans>
> >
> >
> >
> > On 2/19/07, Olenin, Vladimir (MOH) <Vladimir.Olenin(a)moh.gov.on.ca>
wrote:
> >
> >> Check out 'Spring Modules' subproject - it has a DROOLS
integration
> >> module.
> >> Haven't used it myself yet, so not sure whether it's
> >> mature/compatible with
> >> most recent release.
> >>
> >>
>
https://springmodules.dev.java.net/docs/reference/0.7/html/jsr94.html#d0e570
> >>
> >> 9
> >>
> >>
https://springmodules.dev.java.net/
> >>
> >> Vlad
> >>
> >>
> >> -----Original Message-----
> >> From: rules-users-bounces(a)lists.jboss.org
> >> [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Niyas
> >> Sent: 19 February 2007 09:49
> >> To: rules-users(a)lists.jboss.org
> >> Subject: [rules-users] Drools With Spring Framework Problem
> >>
> >> Hi all,
> >>
> >> I am in need of integrating Drools JBoss Rule Engine with Spring
> >> Framework.
> >> I have tried sample rule engine examples in the Drools in the
> >> standalone with the help od drools IDE for eclipse 3.2.
> >> And I also tried some example in the Spring Framework,to know how it
> >> works. I have tried some examples in IOC, MVC and JDBC in the spring
> >> framework.
> >>
> >> Now, I want to use both Drools and Spring Framework in such a way that
> >> Spring will have the MVC application and it should validate the rules,
> >> which written in the drools (.drl)
> >>
> >> I don't know how to begin with/what are he configuration files needed
> >> to setup. PLease if anyone have the sample coding on Drools with
> >> Spring or any other links willl be very useful.
> >>
> >> And also, guide me what are the things need to be know for Spring with
> >> Drools. While I have searched in google, lots of things came up like:
> >>
> >> Use JSR94... (which is mentioning to configure RuleServiceProvider,
> >> RuleRuntime, RuleSet..and others..which seeme to be confusing and not
> >> clear)
> >>
> >> Whether there are any API for drools with spring that DROOLS is
> >> supporting..like org.drools.spring.metadata.ArgumentMetadataSource. I
> >> don't find these Drools API section
> >>
>
http://labs.jboss.com/file-access/default/members/jbossrules/freezone/docs/3
> >>
> >> .0.5/apidocs/index.html
> >> _______________________________________________
> >> rules-users mailing list
> >> rules-users(a)lists.jboss.org
> >>
https://lists.jboss.org/mailman/listinfo/rules-users
> >> _______________________________________________
> >> rules-users mailing list
> >> rules-users(a)lists.jboss.org
> >>
https://lists.jboss.org/mailman/listinfo/rules-users
> >>
> > _______________________________________________
> > rules-users mailing list
> > rules-users(a)lists.jboss.org
> >
https://lists.jboss.org/mailman/listinfo/rules-users
> >
>
>
> --
> Edson Tirelli
> Software Engineer - JBoss Rules Core Developer
> Office: +55 11 3124-6000
> Mobile: +55 11 9218-4151
> JBoss, a division of Red Hat @
www.jboss.com
>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>