title: Drools DRL file on a package can't read
body: <p>I'm new to drools, and I can't access my DRL file inside a package. That is what I thought. My hierarchy of the rules of my project is like this</p>
  
  <p><img src="https://i.stack.imgur.com/N9fug.png" alt="enter image description here"></p>
  
  <p>I tried to access the DRL file with this code:</p>
  
  <pre><code>KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
          kbuilder.add( ResourceFactory.newClassPathResource( "neu/als/KnowledgeLevel", getClass() ), ResourceType.DRL );
          KnowledgeBuilderErrors errors = kbuilder.getErrors();
  
          if( errors.size() &gt; 0 )
          {
              for( KnowledgeBuilderError error : errors )
              {
                  System.err.println( error );
              }
              throw new IllegalArgumentException( "Could not parse knowledge." );
          }
  
          KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
          kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
          return kbase;
  </code></pre>
  
  <p>Which is resulting to an error:</p>
  
  <pre><code>java.lang.RuntimeException: Unable to get LastModified for ClasspathResource
      at org.drools.io.impl.ClassPathResource.getLastModified(ClassPathResource.java:204)
      at org.drools.io.impl.ClassPathResource.getInputStream(ClassPathResource.java:141)
      at org.drools.compiler.DrlParser.parse(DrlParser.java:145)
      at org.drools.compiler.DrlParser.parse(DrlParser.java:139)
      at org.drools.compiler.PackageBuilder.drlToPackageDescr(PackageBuilder.java:477)
      at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:466)
      at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:694)
      at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:51)
      at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:40)
      at com.neu.als.thesis.units.InferenceEngine.readKnowledgeBase(InferenceEngine.java:52)
      at com.neu.als.thesis.web.controllers.FLTController.evaluateFLT(FLTController.java:124)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
      at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:444)
      at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:432)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:946)
      at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:848)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:822)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
  Caused by: java.io.FileNotFoundException: 'neu/als/KnowledgeLevel.drl' cannot be opened because it does not exist
      at org.drools.io.impl.ClassPathResource.getURL(ClassPathResource.java:165)
      at org.drools.io.impl.ClassPathResource.getLastModified(ClassPathResource.java:177)
      ... 40 more
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p><b>UPDATE: </b></p>
  
  <p>Here is my web.xml</p>
  
  <pre><code>&lt;servlet&gt;
        &lt;servlet-name&gt;ThesisProject&lt;/servlet-name&gt;
        &lt;servlet-class&gt;
           org.springframework.web.servlet.DispatcherServlet
        &lt;/servlet-class&gt;
        &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
        &lt;servlet-name&gt;ThesisProject&lt;/servlet-name&gt;
        &lt;url-pattern&gt;*.do&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  
    &lt;context-param&gt;
       &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
       &lt;param-value&gt;/WEB-INF/ThesisProject-servlet.xml&lt;/param-value&gt;
    &lt;/context-param&gt;
  
    &lt;listener&gt;
       &lt;listener-class&gt;
          org.springframework.web.context.ContextLoaderListener
       &lt;/listener-class&gt;
    &lt;/listener&gt;
  </code></pre>
  
  <p>and my bean config</p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:context="http://www.springframework.org/schema/context"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="
     http://www.springframework.org/schema/beans     
     http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
     http://www.springframework.org/schema/context 
     http://www.springframework.org/schema/context/spring-context-3.0.xsd"&gt;
  
    &lt;context:component-scan base-package="com.neu.als.thesis.web.controllers" /&gt;
  
    &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
      &lt;property name="prefix" value="/WEB-INF/" /&gt;
      &lt;property name="suffix" value=".jsp" /&gt;
    &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>Added some configuration</p>