1 Reply Latest reply on Jan 22, 2012 9:20 PM by Stephen Coy

    Classloading from folder under WEB-INF/classes

    Edem Morny Novice

      Hi,

       

      I have a number of JBPM workflows defined for my application, under the folder WEB-INF/classes/processes. I've created a bean with @Singleton  and @Startup to load these processes at application startup.  Whenever I execute the ff code snippet in my bean, I get a file which is not a directory, and as a result I can't scan the content of that folder and load them into my knowledge base as i wanted.

       

       

       

      File directory = new File(Thread.currentThread().getContextClassLoader().getResource("/processes").getFile());
              System.out.println("Directory found is "+directory.getName());
              if(directory.isDirectory()){
                  System.out.println("Directory found is "+directory.getAbsolutePath());
              }else{
                  System.out.println("File found is "+directory.getAbsolutePath());
              }
      

       

      The path returned seems to be something like H:\Servers\jboss-as-7.0.2.Final\bin\content\hims-web\WEB-INF\classes\process.

       

      I'd be glad if anyone could explain what this path structure means? And in addition, is there any way that I can load up my files from the folder aside of the normal way of getting it through the classLoader?

       

      Note: I've also tried using @Inject @Resource("WEB-INF/classes/processes") Collection<URL> processes  from Seam Solder, but I get an injection point failure for that as well.