Search code examples
repositorydroolsartifactwagon

Drools 6 No Connector available to access repository


We just started with Drools 6 and are trying to use Rules Artifacts from our internal Nexus repository.

When the artifact exists in the local repository everything is working fine.

However, when trying to retrieve an artifact from the repository we get the following exception:

WARN  MavenRepository - Unable to resolve artifact: foo.bar.rules.callflow.res:rules-callflow-res:1.0.0-SNAPSHOT
org.sonatype.aether.resolution.ArtifactResolutionException: Could not transfer artifact foo.bar.rules.callflow.res:rules-callflow-res:jar:1.0.0-SNAPSHOT from/to nexus (http://nexus:8081/nexus/content/groups/public): No connector available to access repository nexus (http://nexus:8081/nexus/content/groups/public) of type  using the available factories FileRepositoryConnectorFactory, WagonRepositoryConnectorFactory
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193)
at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:286)
at org.kie.scanner.MavenRepository.resolveArtifact(MavenRepository.java:205)
at org.kie.scanner.MavenRepository.resolveArtifact(MavenRepository.java:194)
at org.kie.scanner.ArtifactResolver.resolveArtifact(ArtifactResolver.java:51)
at org.kie.scanner.KieRepositoryScannerImpl.loadArtifact(KieRepositoryScannerImpl.java:100)
at org.kie.scanner.KieRepositoryScannerImpl.loadArtifact(KieRepositoryScannerImpl.java:93)
at org.drools.compiler.kie.builder.impl.KieRepositoryImpl.loadKieModuleFromMavenRepo(KieRepositoryImpl.java:114)
at org.drools.compiler.kie.builder.impl.KieRepositoryImpl.getKieModule(KieRepositoryImpl.java:100)
at org.drools.compiler.kie.builder.impl.KieRepositoryImpl.getKieModule(KieRepositoryImpl.java:77)
at org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieContainer(KieServicesImpl.java:97)
at foo.bar.rules.callflow.res.CallflowRESTests.test0800800800(CallflowRESTests.java:36)

Here's our test class:

public class CallflowRESTests
{

        private KieServices ks;
    private KieContainer kContainer;

    @Before
    public void setup() {
        ks = KieServices.Factory.get();
    }

    @Test
    public void test0800800800() {
        try
        {
            ReleaseId releaseId = ks.newReleaseId("foo.bar.rules.callflow.res","rules-callflow-res","1.0.0-SNAPSHOT");
            KieContainer kContainer = ks.newKieContainer(releaseId);
            // Extra code removed since problem occurs in the line above
        } catch (Exception e)
        {
            e.printStackTrace();
        }

    }
}

The artifact exists in our internal Nexus repository but when I run the test class it never tries to connect to it (checked with Wireshark).

What part am I missing here?


Solution

  • After many hours of investigation I seem to have the found the cause for our problem of not being able to retrieve Rules artifacts from a remote Maven repository. The root cause was a section in our settings.xml in the Maven configuration. Once I removed this section our rules implementation was able to retrieve Rules artifacts from our remote Nexus repository. However, it seems that before trying to connect to our configured repository (in the settings.xml) it tries to contact an external IP address but this seems to be a maven issue rather than a rules issue.

    Edit 27.03.2015: With Drools 6.1.0.Final when using in the Maven settings.xml you have to add the line

    <layout>default</layout> 
    

    to the mirror configuration. After that it should work.