2014-02-25 60 views
3

收到此錯誤:滴料:無法在Drools的嘗試加載我pom.properties加載pom.properties

2014-02-25 11:14:06,251 ERROR  org.springframework.web.context.ContextLoader.initWebApplicationContext(318): - Context initialization failed 
java.lang.NullPointerException 
at java.io.File.<init>(Unknown Source) 
at  org.drools.compiler.kie.builder.impl.ClasspathKieProject.getPomProperties(ClasspathKieProject.java:228) 
at org.kie.spring.KModuleBeanFactoryPostProcessor.postProcessBeanFactory(KModuleBeanFactoryPostProcessor.java:93) 
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:265) 
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:177) 
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:609) 
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) 
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:381) 
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:293) 
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) 
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4765) 
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5260) 
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1525) 
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1515) 
at java.util.concurrent.FutureTask.run(Unknown Source) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
at java.lang.Thread.run(Unknown Source) 

具體地說,它會嘗試遞歸查找pom.properties文件,但是當它調用file.isDirectly ()它有一個問題,確定它的目錄和NPE被拋出。我已經驗證,事實上,目錄存在的權限是正確的......

public static File recurseToPomProperties(File file) { 
    if(file.isDirectory()) { 
     for (java.io.File child : file.listFiles()) { 
      if (child.isDirectory()) { 
       File returnedFile = recurseToPomProperties(child); 
       if (returnedFile != null) { 
        return returnedFile; 
       } 
      } else if (child.getName().endsWith("pom.properties")) { 
       return child; 
      } 
     } 
    } 
    return null; 
} 

回答

2

對我來說,這個錯誤與Drools的相關項目在Windows默認驅動器上運行並非如說明這裏:https://issues.jboss.org/browse/DROOLS-354

我的tomcat服務器在驅動器「D:」上運行,而我的工作空間位於「C:」上。當我把它全部移到「C:」時,完美地工作。也許它有幫助。

+0

爲我工作!謝謝 – fullstack

相關問題