问题
I am using Kie-CI api to scan the latest ruleset in local maven repository. Kie-CI is not working after upgrading to version 7.5.0. Below is the code I am using. Exception says artifact does not exists but actually artifact exists in repository. KJAR artifact is created using Kie-CI api. Any insights on this would be helpful.
Code:
@Async
@Transactional
public void scanLatestRuleset(String version){
log.info("Request received to activate new ruleset version: [ " + version + " ]");
KieServices kieServices = KieServices.Factory.get();
ReleaseId releaseId = kieServices.newReleaseId( "com.example", "sample-rules", version );
//Using Kie Scanner to activate
this.kieContainer = kieServices.newKieContainer( releaseId );
KieScanner kScanner = kieServices.newKieScanner( kieContainer );
kScanner.scanNow();
}
Logs:
2018-02-22 11:21:46.190 AM [ruleserviceTaskExecutor-2] INFO com.example.service.RuleService - Request received to activate new ruleset version: [ 0.0.3-SNAPSHOT ]
2018-02-22 11:21:49.607 AM [ruleserviceTaskExecutor-2] WARN o.a.m.integration.MavenRepository - Unable to resolve artifact: xerces:xercesImpl:2.11.0.SP5
2018-02-22 11:21:49.610 AM [ruleserviceTaskExecutor-2] ERROR o.s.a.i.SimpleAsyncUncaughtExceptionHandler - Unexpected error occurred invoking async method 'public void com.example.service.RuleService.scanLatestRuleset(java.lang.String)'.
java.lang.NullPointerException: null
at org.kie.scanner.KieRepositoryScannerImpl.indexArtifacts(KieRepositoryScannerImpl.java:409)
at org.kie.scanner.KieRepositoryScannerImpl.setKieContainer(KieRepositoryScannerImpl.java:117)
at org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieScanner(KieServicesImpl.java:227)
at com.example.service.RuleService.scanLatestRuleset(RuleService.java:814)
at com.example.service.RuleService$$FastClassBySpringCGLIB$$5b9ebbea.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.AsyncExecutionInterceptor$1.call(AsyncExecutionInterceptor.java:115)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
回答1:
Had the exact same problem.
This seems to be due the jar xerces:xercesImpl:2.11.0.SP5
not being in standard repositories.
As MvnRepository states here, this artifact needs to be picked up from the JBoss 3rd Party repository or some other repository.
来源:https://stackoverflow.com/questions/48933762/drools-kie-scanner-7-5-0-not-working