Drools Kie Scanner 6.3.0最终抛出ProvisionException(未找到RepositorySystem)

时间:2016-04-28 03:31:13

标签: java drools spark-streaming

我刚开始使用Drools并尝试将其与我的Spark Streaming作业集成。我正在使用Drools 6.3.0.Final和kie-ci所以我可以从我的火花作业中远程拉出我的kJar并使用kie扫描仪更新是否有更新的版本。但是我遇到了以下异常:

016-04-27 10:22:32,360 WARN  [streaming-job-executor-0] Sisu (Logs.java:warn(394)) - Error injecting: org.apache.maven.execution.DefaultMavenExecutionRequestPopulator
com.google.inject.ProvisionException: Guice provision errors:

1) No implementation for org.apache.maven.repository.RepositorySystem was bound.
while locating org.apache.maven.execution.DefaultMavenExecutionRequestPopulator

1 error
at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:974)
at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1000)
at org.eclipse.sisu.space.AbstractDeferredClass.get(AbstractDeferredClass.java:48)
at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:84)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:52)
at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:70)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:100)
at org.eclipse.sisu.plexus.PlexusLifecycleManager.onProvision(PlexusLifecycleManager.java:133)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:108)
at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:55)
at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:68)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1018)
at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.Scopes$1$1.get(Scopes.java:59)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:965)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1011)
at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:961)
at org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:82)
at org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:260)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:252)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:246)
at org.kie.scanner.embedder.PlexusComponentProvider.lookup(PlexusComponentProvider.java:42)
at org.kie.scanner.embedder.MavenEmbedder.buildMavenExecutionRequest(MavenEmbedder.java:111)
at org.kie.scanner.embedder.MavenEmbedder.<init>(MavenEmbedder.java:84)
at org.kie.scanner.embedder.MavenEmbedder.<init>(MavenEmbedder.java:75)
at org.kie.scanner.embedder.MavenEmbedder.<init>(MavenEmbedder.java:69)
at org.kie.scanner.embedder.MavenProjectLoader.parseMavenPom(MavenProjectLoader.java:55)
at org.kie.scanner.embedder.MavenProjectLoader.parseMavenPom(MavenProjectLoader.java:49)
at org.kie.scanner.ArtifactResolver.getResolverFor(ArtifactResolver.java:127)
at org.kie.scanner.ArtifactResolver.getResolverFor(ArtifactResolver.java:90)
at org.kie.scanner.KieRepositoryScannerImpl.setKieContainer(KieRepositoryScannerImpl.java:88)
at org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieScanner(KieServicesImpl.java:139)

我已经在我的settings.xml中设置了我的远程存储库,我正在正确运行spark,因为它在正确创建KieContainer时会拉出最新的jar。只有在我出于某种原因包含KieScanner时才会失败。

我的代码如下所示:

KieServices ks = KieServices.Factory.get();
ReleaseId releaseId = ks.newReleaseId("test", "test", "LATEST");
KieContainer kieContainer = ks.newKieContainer(releaseId);
KieSession kSession = kieContainer.newKieSession();

KieScanner kScanner = ks.newKieScanner(kieContainer);
kScanner.scanNow();
kSession.fireAllRules();
kSession.dispose();

我正在使用hadoop 1运行Spark 1.6.1,如果我使用其他具有更高hadoop的打包Spark版本,它将失败并出现异常

  

(java.lang.NoSuchMethodError:com.google.inject.Binder.bindListener)

有人知道为什么或如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

我有一个类似的问题,为Flink生成一个超级罐。之所以这是因为我的maven shade配置不完整而且来自各个jar的魔法META-INF / **配置文件被覆盖了。通过在Maven阴影配置中添加以下变换器来解决这个问题:

<transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
    <resource>META-INF/sisu/javax.inject.Named</resource>
</transformer>