title: Conflict with default classloader and PlayFramework custom classloader
body: <p>I am working on a project where we use play framework (play-1.2.5) together with a custom Google GUICE based application module. </p>
  
  <p>I am getting the current exception in my code:</p>
  
  <pre><code>play.exceptions.JavaExecutionException: loader constraint violation: when resolving method "mypackage.Runner.queueJob(Lmodels/Job;)V" the class loader (instance of play/classloading/ApplicationClassloader) of the current class, controllers/Jobs, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for resolved class, mypackage/Runner, have different Class objects for the type models/Job used in the signature
      at play.mvc.ActionInvoker.invoke(ActionInvoker.java:237)
      at Invocation.HTTP Request(Play!)
  Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "mypackage.Runner.queueJob(Lmodels/Job;)V" the class loader (instance of play/classloading/ApplicationClassloader) of the current class, controllers/Job, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for resolved class, mypackage/Runner, have different Class objects for the type models/Job used in the signature
      at controllers.Jobs.listJobs(Jobs.java:19)
      at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:557)
      at play.mvc.ActionInvoker.invoke(ActionInvoker.java:508)
      at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:484)
      at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:479)
      at play.mvc.ActionInvoker.invoke(ActionInvoker.java:161)
      ... 1 more
  </code></pre>
  
  <p>According to my current analysis it seems like the problem is related to the source folder structure and how the application is initialized.</p>
  
  <p>I have the following structure:</p>
  
  <p>project/app/{play controllers and models etc.}
  project/src/{my project specific classes implementing the business logic}</p>
  
  <p>When starting the play application I also start up jobs in my "src" folder (from outside of the play managed application classes). What seem to happen is that models and other classes accessed by these jobs gets loaded with the default class-loader at this time, and when I try to use these from the play application classes (the view etc.) I get this error telling me that the classes used are created with different class-loaders and therefore have different signatures.</p>
  
  <p>So in conclusion both the default class loader and the play class loader load the same classes and depending on how I invoke them I get errors for the miss-match.</p>
  
  <p>I have been able to solve this by simply moving all my source files into the project/app/ source folder but I would like to keep the src folder separate from the play application folder.</p>
  
  <ol>
  <li>Does anybody know if I am correct in my analysis? </li>
  <li>If "yes" on 1., is there a way to configure play to not only load classes from the app folder but also from my src folder?</li>
  </ol>
  
  <p>Any input is appreciated.</p>