title: why does loading Drools 6 KIE JAR into code fail?
body: <p>I'm using JBoss AS 7.1.1.Final with KIE Workbench/Drools 6.0.1., Java and Eclipse (Kepler). </p>
  
  <p>I need KIE Workbench (formerly Drools Guvnor) to let people graphically create/edit jars with Facts and Rules and then store as jars in the local maven repository. These jars (formerly pkg's) i want then to access programatically and load them into my Drools application. The app could even (although not preferedly) be run on the same workstation, so access to the repository could be</p>
  
  <p>a) by URL:
   <code>http://localhost:8080/drools-wb-as7.0/maven2/com/myprojects/myProject/LATEST/myProject-LATEST.jar</code></p>
  
  <p>b) by filepath/classpath: 
  <code>/my/folder/jboss-as-7.1.1.Final/bin/repositories/kie/com/myprojects/myProject/LATEST/myProject-LATEST.jar</code> </p>
  
  <p>I do <strong>NOT</strong> want to <strong>create/compile</strong> rules etc in my code, neither dynamically load a single .drl file dynamically - the prepared jar is what i need to load, with
  e.g. com.myprojects:myProject:LATEST as identifier.</p>
  
  <p>I try this (according to documentation)</p>
  
  <pre><code>KieServices ks = KieServices.Factory.get();
  KieContainer kContainer = ks.newKieContainer(
  ks.newReleaseId("com.myprojects",   "myProject", "LATEST"));
  KieScanner kScanner = ks.newKieScanner( kContainer );
  kScanner.start( 10000L );
  
  KieSession kSession = kContainer.newKieSession("defaultKieSession");
  kSession.insert( fact );
  </code></pre>
  
  <p>[...]</p>
  
  <p>However, this fails with the Runtime Exception,</p>
  
  <pre><code>Exception in thread "main" java.lang.RuntimeException: Cannot find KieModule: com.myprojects:myProject:LATEST
          at org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieContainer(KieServicesImpl.java:86)
          at com.myprojects.myproject.KieDroolsWBOnlinePuller.code(KieDroolsWBOnlinePuller.java:118)
          at com.myprojects.myproject.KieDroolsWBOnlinePuller.main(KieDroolsWBOnlinePuller.java:40)
  </code></pre>
  
  <p><strong>My question is</strong>: Why is the jar from repo not found? Isn't the KieModule the representation of the jar and the jar automatically in the repo as I created it within KIE WB?
  Or must I change the default ReleaseID of the Maven Repo, which printed out with</p>
  
  <pre><code>KieRepository repo = ks.getRepository();
  repo.getDefaultReleaseId()
  </code></pre>
  
  <p>resolves to</p>
  
  <pre><code>org.default:artifact:1.0.0-SNAPSHOT ?
  </code></pre>
  
  <p>Is it a Maven problem? What am I getting wrong?</p>
  
  <p>Here the content of the jars pom.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;com.myprojects&lt;/groupId&gt;
    &lt;artifactId&gt;myProject&lt;/artifactId&gt;
    &lt;version&gt;LATEST&lt;/version&gt;
    &lt;name&gt;myProject&lt;/name&gt;
    &lt;repositories&gt;
      &lt;repository&gt;
        &lt;id&gt;guvnor-m2-repo&lt;/id&gt;
        &lt;name&gt;Guvnor M2 Repo&lt;/name&gt;
        &lt;url&gt;http://localhost:8080/drools-wb-as7.0/maven2/&lt;/url&gt;
      &lt;/repository&gt;
    &lt;/repositories&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>What I also tried was using this code to load the jar by URL:</p>
  
  <pre><code>KieServices ks = KieServices.Factory.get();
  ReleaseId releaseId = ks.newReleaseId("com.myprojects", "myProject", "LATEST");
  KieResources kres = ks.getResources();
  
  String url = "http://127.0.0.1:8080/drools-wb-as7.0/maven2/com/myprojects/myProject/LATEST/myProject-LATEST.jar";
  kres.newUrlResource( url );
  KieContainer kContainer = ks.newKieContainer(releaseId);
  KieSession kSession = kContainer.newKieSession("statelessDefautlKnowledgeSession");
  [...]
  </code></pre>
  
  <p>This failed with the same exception....
  Any ideas?</p>
  
  <p>Some Resources I read so far (can't post the other 6):</p>
  
  <p><a href="http://www.skills421.com/tutorials-drools-components.jsp" rel="nofollow">add drls etc. dynamically</a></p>
  
  <p><a href="http://blog.athico.com/2013/12/deployment-with-drools-60.html?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3a%20DroolsRSS%20%28Drools%20-%20RSS%29" rel="nofollow">load drls dynamically</a></p>