NPE loading Drools 5.4.0.Beta1 using drools-spring
by lhorton
I am trying to load up 5.4.0.Beta1. I'm using Spring configuration xml that
works fine in 5.2.0.Final. In the xml, my grid-node is defined as:
<drools:grid-node id="droolsClusterNode1"/>
The exception is a NPE on a method in WhitePagesClient. Any idea what the
cause might be? Has anyone successfully loaded 5.4.0 using Spring?
The full exception is:
ERROR 2012-01-06 15:51:05,998
[org.springframework.web.context.ContextLoader] - Context initialization
failed
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'droolsClusterNode1': Invocation of init method failed; nested
exception is java.lang.NullPointerException
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:563)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1399)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
at
org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1500)
at
org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:252)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:186)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NullPointerException
at
org.drools.grid.service.directory.impl.WhitePagesClient.getGsd(WhitePagesClient.java:32)
at
org.drools.grid.service.directory.impl.WhitePagesClient.create(WhitePagesClient.java:80)
at org.drools.grid.impl.GridImpl.createGridNode(GridImpl.java:107)
at
org.drools.container.spring.beans.GridNodeBeanFactory.afterPropertiesSet(GridNodeBeanFactory.java:63)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
... 47 more
--
View this message in context: http://drools.46999.n3.nabble.com/NPE-loading-Drools-5-4-0-Beta1-using-dr...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 4 months
Eclipse, Groovy and Drools - java.lang.NoClassDefFoundError
by sweeneymj
Hi,
I have just started trying out Drools and having an issue trying to run the
sample applications under Eclipse Helios with Groovy installed.
When I try run any sample Drools application I get the stack trace shown
below. I have looked around extensively on Google for assistance but have
been unable to find any thing that has helped me determine what the issue
is.
Any suggestions would be appreciated.
Regards
--
Build groovy files option has not been set one way or the other: use
'options.put(CompilerOptions.OPTIONG_BuildGroovyFiles,
CompilerOptions.ENABLED);'
java.lang.NoClassDefFoundError: org/eclipse/core/runtime/Plugin
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at
org.eclipse.jdt.internal.compiler.Compiler.initializeParser(Compiler.java:737)
at
org.eclipse.jdt.internal.compiler.Compiler.<init>(Compiler.java:294)
at
org.eclipse.jdt.internal.compiler.Compiler.<init>(Compiler.java:159)
at
org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:364)
at
org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:51)
at
org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:366)
at
org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:55)
at
org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:69)
at
org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:674)
at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:633)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:278)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:451)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:40)
at com.sample.DroolsTest.main(DroolsTest.java:23)
Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.Plugin
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 27 more
--
View this message in context: http://drools.46999.n3.nabble.com/Eclipse-Groovy-and-Drools-java-lang-NoC...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 4 months
Drools Planner changing problem fact
by Ralph Schwitalla
Hi all,
i am new to drools planner and try to model a 2dimensional rectangle packing
problem.
I have some problems modelling the problem facts because one of them (the
list of free spaces) is constantly
changing.
For example I have a list of rectangles I try to pack on a fixed size layer.
This list is fixed.
But the list of free space is dynamic (first you have the whole layer as
free space,
then you cut out the space occupied by the first rectangle which gives you 3
remaining free spaces, and so on)
All the examples in the drools-planner-examples seem to have a fixed list of
problem facts (rooms, teachers, timeslots) which only should be combined
optimally.
How can a dynamic number of problem facts be modelled?
Greetings Ralph
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Planner-changing-problem-fact-tp...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 5 months
Migrating from 4.0.7 to 5.4.0.Final
by JP Chemali
Hi all,
I'm currently in the process of migrating an application using drools 4.0.7
to 5.4.0.Final and I've stumbled into a few issues with the new version that
I find disturbing:
- Our unit tests failed because the JVM ran out of perm gen space, which
looks odd as in 4.0.7 we've had quite a margin to start with.
- Doing several Yourkit analysis, I finally find classloading leaks:
* *org.drools.rule.builder.dialect.asm.ClassGenerator.EMPTY_METHOD_BODY*
is a static instance which will hold to the last instance of
InternalClassLoader created
* *org.drools.rule.constraint.MvelConstraint* uses an ExecutorHolder that
spawns daemon threads and keeps them in a pool. Problem is these threads
create class loaders, and can only be garbage collected when the thread
dies, meaning never in my case...
- I've quick fixed both issues, the second one by simply disabling the
thread pool.
- Once this is done, the perm gen behaves correctly, but the execution times
are 2-3 times slower on very large set of rules (~1000). Looking at Yourkit
analysis again, I see that the number of classes generated and the perm gen
consumption is about 3 times higher in 5.4.0.Final. I honestly don't know
how to address this.
I've tried to find some other posts concerning these issues, to no avail. I
don't see any work around this, short of code changes, and for reducing the
number of generated classes I simply have no idea.
Please correct me if I am wrong, any help would be greatly appreciated
--
View this message in context: http://drools.46999.n3.nabble.com/Migrating-from-4-0-7-to-5-4-0-Final-tp4...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 5 months
Inserting Facts from Json Format
by ihabo01
Hello to all,
I have the following simple rule:
declare FlatData
param1 : String
param2 : String
end
rule "Test"
when
a:FlatData(param1=="something")
then
a.setParam2("hi");
end
And I have the following code to load the rule:
KnowledgeBuilder kBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kBuilder.add(ResourceFactory.newFileResource("myRule.drl"),ResourceType.DRL);
KnowledgeBaseConfiguration kBaseConfig = KnowledgeBaseFactory
.newKnowledgeBaseConfiguration();
KnowledgeBase kBase = KnowledgeBaseFactory.newKnowledgeBase(kBaseConfig);
kBase.addKnowledgePackages(kBuilder.getKnowledgePackages());
StatefulKnowledgeSession session = kBase.newStatefulKnowledgeSession();
session.fireAllRules();
And I have also the following object (in Json) that I would like to insert
as a fact just before firing the rules:
{"object":{" FlatData ":{"param1":"value1","param2":”value2”}}}}
How can I achieve that?
Many thanks in advance for your help
Ihab
--
View this message in context: http://drools.46999.n3.nabble.com/Inserting-Facts-from-Json-Format-tp3570...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 5 months
Performance issue
by Ini
Hi All,
I have written a code to check the properties of a bean using drools based
rules.
I have created the different rules file where different properties of the
bean will be checked.
The code i have written is a as below:
public static void check(Object details,String rule){
long methodStartTime=System.currentTimeMillis();
Resource resource = new ClassPathResource(RULE_CLASSPATH+rule);
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
long startTime=System.currentTimeMillis();
kbuilder.add(resource, ResourceType.DRL );
long endTime=System.currentTimeMillis();
System.out.println("Time taken in add resource in milli seconds
is::"+(endTime-startTime));
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
KnowledgeBuilderErrors errors = kbuilder.getErrors();
if (errors.size() > 0) {
for (KnowledgeBuilderError error: errors) {
System.err.println(error);
}
}
StatelessKnowledgeSession ksession =
kbase.newStatelessKnowledgeSession();
ksession.execute(details);
long methodEndTime=System.currentTimeMillis();
System.out.println("Time taken in Method check in milli seconds
is::"+(methodEndTime-methodStartTime));
}
Here in the check method we have three parameters details this is the bean
whose properties need to be checked in rules file, rule this is the name of
rules file which contains all the rules.
Here the issue is that it takes around 4 seconds for the first time and 1
second for all consecutive requests, and 4 second looks too much time for
validating the rules file that has only 10 rules.
Please let me know we have some better way of doing it in drools
--
View this message in context: http://drools.46999.n3.nabble.com/Performance-issue-tp4017688.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 5 months