[rules-users] encounter NullPointerException when adding ruleflow
Hi all, I tried to run Drools in a webapp, it runs smoothly when I only load simple rules. The spec I have: AP server -- WASCE2.1 (or geronimo 2.1) Spring -- 3.0.5 Drools -- 5.2 Fianl JVM -- IBM SDK 1.6 When I tried to use ruleflow -- execute drl in rf, I got NullPointerException with the following trace: exception org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:656) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549) javax.servlet.http.HttpServlet.service(HttpServlet.java:693) javax.servlet.http.HttpServlet.service(HttpServlet.java:806) root cause java.lang.NullPointerException org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:516) org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:556) org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28) net.viralpatel.drools.core.DroolsCore.createKnowledgeBase(DroolsCore.java:17) net.viralpatel.contact.controller.ContactController.listContacts(ContactController.java:41) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:59) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:39) java.lang.reflect.Method.invoke(Method.java:612) org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176) org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426) org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549) javax.servlet.http.HttpServlet.service(HttpServlet.java:693) javax.servlet.http.HttpServlet.service(HttpServlet.java:806) net.viralpatel.drools.core.DroolsCore.createKnowledgeBase(DroolsCore.java:17) is the following line: builder.add(ResourceFactory.newClassPathResource(basicFlow.rf), ResourceType.DRF); Any advise is appreciated. This is a UTF-8 formatted mail --- James C.-C.Yu ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] encounter NullPointerException when adding ruleflow
Are you sure that basicFlow.rf is in your classpath correctly? From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of James Yu Sent: 06 September 2011 10:08 To: rules-users@lists.jboss.org Subject: [rules-users] encounter NullPointerException when adding ruleflow Hi all, I tried to run Drools in a webapp, it runs smoothly when I only load simple rules. The spec I have: AP server -- WASCE2.1 (or geronimo 2.1) Spring -- 3.0.5 Drools -- 5.2 Fianl JVM -- IBM SDK 1.6 When I tried to use ruleflow -- execute drl in rf, I got NullPointerException with the following trace: exception org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:656) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549) javax.servlet.http.HttpServlet.service(HttpServlet.java:693) javax.servlet.http.HttpServlet.service(HttpServlet.java:806) root cause java.lang.NullPointerException org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:516) org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:556) org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28) net.viralpatel.drools.core.DroolsCore.createKnowledgeBase(DroolsCore.java:17) net.viralpatel.contact.controller.ContactController.listContacts(ContactController.java:41) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:59) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:39) java.lang.reflect.Method.invoke(Method.java:612) org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176) org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426) org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549) javax.servlet.http.HttpServlet.service(HttpServlet.java:693) javax.servlet.http.HttpServlet.service(HttpServlet.java:806) net.viralpatel.drools.core.DroolsCore.createKnowledgeBase(DroolsCore.java:17) is the following line: builder.add(ResourceFactory.newClassPathResource(basicFlow.rf), ResourceType.DRF); Any advise is appreciated. This is a UTF-8 formatted mail --- James C.-C.Yu ** This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmas...@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary. NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00 ** ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] encounter NullPointerException when adding ruleflow
2011/9/6 Swindells, Thomas tswinde...@nds.com Are you sure that basicFlow.rf is in your classpath correctly? The NPE does happen when the file is missing. One can't test the returned org.drools.io.Resource object - an object is returned from ResourceFactory.newClassPathResource(no such filef) So I think that either the ResourceFactory or the Builder should produce a decent error message. NPE is phooey. -W ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] encounter NullPointerException when adding ruleflow
Indeed. The NPE is caused by the PackageBuilder not having a ProcessBuilder. It tries to create one, but this fails silently. You need this class org.jbpm.process.builder.ProcessBuilderFactoryServiceImpl -W On 6 September 2011 12:55, James cyu...@gmail.com wrote: I am sure that I have basicRule.drl and basicFlow.rf in classpath as they are located in WEB-INF\classes -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-encounter-NullPointerException-when-adding-ruleflow-tp3312967p3313177.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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] encounter NullPointerException when adding ruleflow
I am sure that I have basicRule.drl and basicFlow.rf in classpath as they are located in WEB-INF\classes -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-encounter-NullPointerException-when-adding-ruleflow-tp3312967p3313177.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