最近項目中采用開啟java線程來監聽文件目錄在本地測試正常啟動但是當采用maven中的mvn tomcat:deploy部署到tomcat中時就報如下錯誤
嚴重: Error listenerStart
:: orgreStandardContext start
嚴重: Context [/cms] startup failed due to previous errors
:: DEBUG (cmstempletTempletController:) – >>>>監聽停止了!!
:: orgreStandardContext listenerStop
嚴重: Exception sending context destroyed event to listener instance of class ut
iltoolsThemePicFileListenerTools
javalangNullPointerException
at utiltoolsThemePicFntextDestroyed(ThemePicFileLis
tenerToolsjava:)
at orgreStandardContextlistenerStop(StandardContext
java:)
at orgreStandardContextstop(StandardContextjava:
)
at orgreStandardContextstart(StandardContextjava:
)
at orgreContainerBasestart(ContainerBasejava:)
at orgreStandardHoststart(StandardHostjava:)
at orgreContainerBasestart(ContainerBasejava:)
at orgreStandardEnginestart(StandardEnginejava:
)
at orgapachecatalinastartupEmbeddedstart(Embeddedjava:)
at dehausmojotomcatAbstractRunMojostartContainer(AbstractRunMo
jojava:)
at dehausmojotomcatAbstractRunMojoexecute(AbstractRunMojojava
:)
at orgapachemavenpluginDefaultPluginManagerexecuteMojo(DefaultPlugi
nManagerjava:)
at orgapachemavenlifecycleDefaultLifecycleExecutorexecuteGoals(Defa
ultLifecycleExecutorjava:)
at orgapachemavenlifecycleDefaultLifecycleExecutorexecuteStandalone
Goal(DefaultLifecycleExecutorjava:)
at orgapachemavenlifecycleDefaultLifecycleExecutorexecuteGoal(Defau
ltLifecycleExecutorjava:)
at orgapachemavenlifecycleDefaultLifecycleExecutorexecuteGoalAndHan
dleFailures(DefaultLifecycleExecutorjava:)
at orgapachemavenlifecycleDefaultLifecycleExecutorexecuteTaskSegmen
ts(DefaultLifecycleExecutorjava:)
at orgapachemavenlifecycleDefaultLifecycleExecutorexecute(DefaultLi
fecycleExecutorjava:)
at orgapachemavenDefaultMavendoExecute(DefaultMavenjava:)
at orgapachemavenDefaultMavenexecute(DefaultMavenjava:)
at orgapachemavencliMavenClimain(MavenClijava:)
at sunreflectNativeMethodAccessorImplinvoke(Native Method)
at sunreflectNativeMethodAccessorImplinvoke(NativeMethodAccessorImpl
java:)
at sunreflectDelegatingMethodAccessorImplinvoke(DelegatingMethodAcces
sorImpljava:)
at javalangreflectMethodinvoke(Methodjava:)
at dehausclassworldsLauncherlaunchEnhanced(Launcherjava:)
at dehausclassworldsLauncherlaunch(Launcherjava:)
at dehausclassworldsLaunchermainWithExitCode(Launcherjava:)
at dehausclassworldsLaunchermain(Launcherjava:)
這個錯誤讓我郁悶了好久最後找到錯誤原因是因為監聽的文件夾下面沒有內容maven在發布項目的時候侯就不創建此文件夾當程序啟動的時候找不到此目錄此時監聽就會停止報以上錯誤
解決辦法把監聽的目錄下面加上相關的內容利用maven發布版本的時候就可以創建監聽文件夾或在tomcat的工程下面手工創建監聽文件即可
From:http://tw.wingwit.com/Article/program/Java/hx/201311/26397.html