[JBoss JIRA] (DROOLS-5358) Add a way to define ResourceType inside kiebase
by Mario Fusco (Jira)
[ https://issues.redhat.com/browse/DROOLS-5358?page=com.atlassian.jira.plug... ]
Mario Fusco resolved DROOLS-5358.
---------------------------------
Resolution: Won't Do
We discussed this and at the moment we couldn't find a better way other than doing a huge refactor which we cannot afford now.
> Add a way to define ResourceType inside kiebase
> -----------------------------------------------
>
> Key: DROOLS-5358
> URL: https://issues.redhat.com/browse/DROOLS-5358
> Project: Drools
> Issue Type: Task
> Reporter: Gabriele Cardosi
> Assignee: Mario Fusco
> Priority: Major
>
> Step to reproduce
> 1) create a project with multiple pmml files, each in its own package (eg. resources/package_name/file.pmml)
> 2) create a kmodule xml and define one kiebase for each package
> 3) compile the kjar
> 4) in the kjar the files/classes are all in the proper place (i.e. in the expected package)
> 5) add the kjar in a new project
> 6) in the new project invoke
> KieServices.get().newKieClasspathContainer().getKieBase(kbaseName);
> The jar packages are inside the kieBase.getPackages(), but they are not marked as "PMMLType" packages - so it is necessary to invoke the (PMML)AssemblerService to wrap the content of the (jar) packages inside correct PMMLType packages and put them in the knowledge base
> The following snippet is a temporary workaround (inside CanonicalKieModule.createKieBase(KieBaseModelImpl, KieProject, ResultsImpl, KieBaseConfiguration))
> {code:java}
> for (KiePackage pk : pkgs) {
> // Workaround to "mark" already compiled packages (as found inside the kjar and retrieved by createKiePackages(kieProject, kBaseModel, messages, kBaseConf))
> // as "PMML" packages
> boolean isInternalKnowldgePackage = pk instanceof InternalKnowledgePackage;
> final InternalKnowledgePackage originalPackage = kieBase.getPackage(pk.getName());
> if (originalPackage != null && isInternalKnowldgePackage && ((InternalKnowledgePackage) pk).getResourceTypePackages().get(ResourceType.PMML) != null) {
> originalPackage.getResourceTypePackages().put(ResourceType.PMML, ((InternalKnowledgePackage) pk).getResourceTypePackages().get(ResourceType.PMML));
> } else if (originalPackage == null) {
> kieBase.addPackages(pkgs);
> }
> }
> {code}
> The idea is to get the "type" information from newly compiled package and put it in the existing one (that also contains al the other compiled classes).
> Ideally, we should be able to completely skip the (PMML)AssemblerService invocation (that recreate new packages)
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
4 years, 7 months
[JBoss JIRA] (DROOLS-5362) Dependencies not necessarily loaded
by Mario Fusco (Jira)
[ https://issues.redhat.com/browse/DROOLS-5362?page=com.atlassian.jira.plug... ]
Mario Fusco resolved DROOLS-5362.
---------------------------------
Resolution: Explained
This works with maven, but doesn't with gradle (I don't know it well) and at the moment I don't see how to fix this.
When a kjar is downloaded from a maven repo and a KieContainer created from it, drools creates a specific ClassLoader containing all the project dependencies, see https://github.com/kiegroup/drools/blob/master/kie-ci/src/main/java/org/k...
This is done reading and parsing the pom.xml file that is included in the jar, see https://github.com/kiegroup/drools/blob/master/drools-compiler/src/main/j...
Unfortunately if you build a jar with gradle, it doesn't contain the pom file and I don't know why. Is there a way to tell gradle to also put the pom in the jar file? If there is this should solve your problem.
> Dependencies not necessarily loaded
> -----------------------------------
>
> Key: DROOLS-5362
> URL: https://issues.redhat.com/browse/DROOLS-5362
> Project: Drools
> Issue Type: Bug
> Components: kie server
> Affects Versions: 7.29.0.Final
> Reporter: Steve Davidson
> Assignee: Mario Fusco
> Priority: Major
> Labels: Kie-Server, kie-server
> Attachments: KieDependencyDemo.tbz
>
>
> When a Rule has a dependency on a class imported from a library jar in the local repository, the rule fails to compile/load:
> {code}
> May 22, 2020 3:35:05 PM org.drools.compiler.kie.builder.impl.AbstractKieProject buildKnowledgePackages
> SEVERE: Unable to build KieBaseModel:default-dependency-demo
> Unable to resolve ObjectType 'DemoData' : [Rule name='Inventory Item 001']
> Unable to resolve ObjectType 'DemoData' : [Rule name='Inventory Item 002']
> Rule Compilation error : [Rule name='Inventory Item 001']
> com/j2eeguys/demo/rules/Rule_Inventory_Item_0012002200180.java (2:40) : Only a type can be imported. com.j2eeguys.demo.data.DemoData resolves to a package
> com/j2eeguys/demo/rules/Rule_Inventory_Item_0012002200180.java (8:490) : jds cannot be resolved
> com/j2eeguys/demo/rules/Rule_Inventory_Item_0012002200180.java (9:543) : jds cannot be resolved
> Rule Compilation error : [Rule name='Inventory Item 002']
> com/j2eeguys/demo/rules/Rule_Inventory_Item_0021364978446.java (2:40) : Only a type can be imported. com.j2eeguys.demo.data.DemoData resolves to a package
> com/j2eeguys/demo/rules/Rule_Inventory_Item_0021364978446.java (8:490) : jds cannot be resolved
> com/j2eeguys/demo/rules/Rule_Inventory_Item_0021364978446.java (9:543) : jds cannot be resolved
> Error importing : 'com.j2eeguys.demo.data.DemoData'
> May 22, 2020 3:35:05 PM org.kie.server.services.impl.KieServerImpl createContainer
> SEVERE: Error creating container 'Kie Dependency Demo: kie-server' for module 'com.j2eeguys.demo:demo-dependency-rules:0.1.0-SNAPSHOT'
> java.lang.RuntimeException: Error while creating KieBase[Message [id=1, kieBase=default-dependency-demo, level=ERROR, path=com/j2eeguys/demo/rules/kieIssueDemo.drl, line=7, column=0
> text=Unable to resolve ObjectType 'DemoData'], Message [id=2, kieBase=default-dependency-demo, level=ERROR, path=com/j2eeguys/demo/rules/kieIssueDemo.drl, line=16, column=0
> text=Unable to resolve ObjectType 'DemoData'], Message [id=3, kieBase=default-dependency-demo, level=ERROR, path=com/j2eeguys/demo/rules/kieIssueDemo.drl, line=5, column=0
> text=Rule Compilation error Only a type can be imported. com.j2eeguys.demo.data.DemoData resolves to a package
> jds cannot be resolved
> jds cannot be resolved], Message [id=4, kieBase=default-dependency-demo, level=ERROR, path=com/j2eeguys/demo/rules/kieIssueDemo.drl, line=14, column=0
> text=Rule Compilation error Only a type can be imported. com.j2eeguys.demo.data.DemoData resolves to a package
> jds cannot be resolved
> jds cannot be resolved], Message [id=5, kieBase=default-dependency-demo, level=ERROR, path=com/j2eeguys/demo/rules/kieIssueDemo.drl, line=1, column=0
> text=Error importing : 'com.j2eeguys.demo.data.DemoData']]
> at org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:379)
> at org.kie.server.services.drools.DroolsKieServerExtension.createContainer(DroolsKieServerExtension.java:98)
> at org.kie.server.services.impl.KieServerImpl.createContainer(KieServerImpl.java:286)
> at org.kie.server.remote.rest.common.resource.KieServerRestImpl.createContainer(KieServerRestImpl.java:157)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140)
> at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:509)
> at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:399)
> at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$0(ResourceMethodInvoker.java:363)
> at org.jboss.resteasy.core.interception.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:358)
> at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:365)
> at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:337)
> at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:310)
> at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:443)
> at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:233)
> at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:139)
> at org.jboss.resteasy.core.interception.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:358)
> at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:142)
> at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:219)
> at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:227)
> at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
> at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
> at org.eclipse.jetty.servlet.ServletHolder$NotAsyncServlet.service(ServletHolder.java:1401)
> at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:760)
> at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1617)
> at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:226)
> at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
> at org.kie.server.services.impl.security.web.CaptureHttpRequestFilter.doFilter(CaptureHttpRequestFilter.java:42)
> at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1596)
> at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:545)
> at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
> at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:501)
> at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
> at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
> at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1592)
> at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
> at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1296)
> at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
> at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:485)
> at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1562)
> at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
> at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1211)
> at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
> at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:221)
> at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
> at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
> at org.eclipse.jetty.server.Server.handle(Server.java:500)
> at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:386)
> at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:562)
> at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:378)
> at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:270)
> at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
> at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
> at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
> at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
> at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
> at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
> at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)
> at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:388)
> at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
> at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
> at java.base/java.lang.Thread.run(Thread.java:834)
> {code}
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
4 years, 7 months
[JBoss JIRA] (JGRP-2481) Use IdentityHashmap in Util.TYPES and ClassConfigurator
by Bela Ban (Jira)
[ https://issues.redhat.com/browse/JGRP-2481?page=com.atlassian.jira.plugin... ]
Bela Ban resolved JGRP-2481.
----------------------------
Resolution: Done
> Use IdentityHashmap in Util.TYPES and ClassConfigurator
> -------------------------------------------------------
>
> Key: JGRP-2481
> URL: https://issues.redhat.com/browse/JGRP-2481
> Project: JGroups
> Issue Type: Enhancement
> Reporter: Bela Ban
> Assignee: Bela Ban
> Priority: Minor
> Fix For: 5.0.0.Beta2
>
>
> When we have lookup hashmaps, populated at startup, and not changed afterwards, we can use IdentityHashmaps, as a {{get()}} is constant.
> For keys with a contiguous range (e.g. {{[1 .. 20]}}), we might even use a simple array of keys and values, e.g. {{[K1,V1,K2,V2, ... Kn,Vn}}.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
4 years, 7 months