Comments (10)
Thanks for raising this issue. There is a fix in place in the 0.8.1-SNAPSHOT release now that was tested with a Spring Boot packaged Jar. I'm planning on releasing v0.8.1 sometime this weekend.
from rulebook.
Here are some examples of how to add the snapshot repo to your project: https://github.com/rulebook-rules/rulebook/wiki/Download-and-Install
from rulebook.
After hours of digging and comparing my code to your example Spring Boot application, I finally found the problem!
It is related to the following in build.gradle:
springBoot { executable = true }
This is done as part of Spring Boot convention to enable Spring Boot applications run as Linux in systemd services, as detailed here:
https://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html
Once I removed that part, it worked!
This is actually a good news, since we will not use Spring Boot applications run as Linux in systemd, but as part of a Docker image. So it is redundant and can be deleted.
Thanks for all your help! Especially for the Spring Boot example application you posted.
Keep up the good work :-)
from rulebook.
From where can I take this fix? It is not in maven repository...
from rulebook.
It's in the sonatype snapshot maven repo: "https://oss.sonatype.org/content/repositories/snapshots"
from rulebook.
Succeeded to use sonatype snapshot maven repo.
However, with 0.8.1-SNAPSHOT , when trying to run standalone executable Spring-Boot jar,I get the following exception:
14-09-2017 07:12:26.350 [XNIO-2 task-1] ERROR c.d.r.model.runner.RuleBookRunner - Unable to find rule classes in package 'com.my.example' java.nio.file.InvalidPathException: com.my.example: 'com.my.example' is not a valid path at com.deliveredtechnologies.rulebook.model.runner.RuleBookRunner.findRuleClassesInPackage(RuleBookRunner.java:148) at com.deliveredtechnologies.rulebook.model.runner.RuleBookRunner.run(RuleBookRunner.java:73) at com.weissbeerger.recommendation.engine.controller.PortfolioPageRuleController.getRecommenations(PortfolioPageRuleController.java:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
In eclipse IDE it works flawlessly.
from rulebook.
Are you using a Spring Boot war deployed on Wildfly? Or a standalone Spring Boot jar w/Undertow? Or, could you attach your source?
I tested this with the Spring Boot example project under rulebook-examples.
But I'll validate the other scenarios listed above and add examples to validate this evening. And of course, if you can provide your specific example, I can ensure it works with that too.
from rulebook.
I use standalone Spring Boot jar w/Undertow
from rulebook.
Interesting. That's what I also use here in the helloworld-spring-web app in the Issue90_PojoResults branch (currently deployed as v0.8.1). And I didn't run into that issue; it worked as expected. The project can be seen here: https://github.com/rulebook-rules/rulebook/tree/Issue90_PojoResults/rulebook-examples
Would you mind attaching your example or providing a link so I can see what your specific issue is? Judging by your error, it appears as if RuleBook cannot find the package that contains the POJO rules to scan. However, since you said it is working in your IDE, I have to wonder what's specifically going on there - perhaps a corner case that wasn't accounted for.
from rulebook.
The fix for including POJO rules in a Spring Boot uber jar is in v0.8.1, now pushed to Maven Central.
from rulebook.
Related Issues (20)
- rule book runner incorrectly eats exceptions so buggy code is not caught. HOT 2
- Why withDefaultResult is mandatory? HOT 4
- How can i write dynamic rules to execute rather than writing in java program .like rules defined in JSON or Yaml? HOT 4
- Q: Rule as a singleton bean HOT 3
- Add the Supplier function to avoid the passage by reference for the default result HOT 2
- Should I fork? HOT 2
- using codegen to improving performance of rule execution HOT 1
- Rule name is dropping when build Rule withFactType. HOT 1
- How to write Unit Tests for a RuleBean? HOT 1
- Switch CI to GitHub Actions HOT 2
- Deprecated classes/methods and non-compiling examples in README.md HOT 1
- Auditor not set on rules when RuleBookBuilder.create(Class) is used HOT 2
- Futures/CompletionStage/Async HOT 2
- Fact checking before evaluating rules HOT 2
- Rulebook in Spring Boot - stop execution
- Project status HOT 2
- Lambdas stack error
- RuleBuilder doesn't create a Rule with action type RuleChainActionType.ERROR_ON_FAILURE HOT 2
- RuleBookRunner4PojoClasses does not run rules according to the order property
- Would need an update on how frequently this project is developed and actively supported HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rulebook.