2013-02-23 53 views
2

我在写一些Quartz作业。石英属性文件和石英作业xml保存在src/main/resources/quartz /文件夹下。无法从web.xml中的Maven资源文件夹中提到属性文件作为上下文参数值

我提供路径石英属性文件是这样的:

<!-- Quartz schedular context parameters --> 
<context-param> 
    <param-name>quartz:config-file</param-name> 
    <param-value>classpath*:quartz.properties</param-value> 
</context-param> 

我得到异常: org.quartz.SchedulerException:属性文件:“类路径*:quartz.properties”无法读取。 [见嵌套异常:java.io.FileNotFoundException:类路径*:quartz.properties(没有这样的文件或目录)]

我尝试添加在/ WEB-INF /石英夹石英属性文件并给路径

<param-value>classpath*:quartz.properties</param-value> 

in web xml。

请建议我是否做错了什么。

UPDATE:

appFolder - WEB-INF 
      |_ classes 
        |_ quartz (with properties file in it) 
        |_ com (all class files in it) 
      |_ lib 
      |_ spring (spring-servlet.xml in it) 
      |_ view (jsp files in it) 
      |_ web.xml 
+0

你可以在文章中的战争中的WEB-INF文件夹中包含文件和文件夹结构吗? – Sudhakar 2013-02-23 07:51:10

+0

@Sudhakar请参阅更新。 – 2013-02-23 08:03:04

回答

2

的问题得到了解决。 Quartz在classpath中搜索名为quartz.properties的属性文件。我把我的属性文件和xml文件直接放在src/main/resources文件夹中。 部署之后,这些资源被添加到类路径中。

而且在web.xml中的标签是这样的:

<context-param> 
    <param-name>quartz:config-file</param-name> 
    <param-value>quartz.properties</param-value> 
</context-param> 

无需后缀的文件夹名称或在那里提供的classpath *关键字。

谢谢大家的建议。

0

你可以试试这个

classpath:**/quartz.properties 
+0

仍然收到同样的错误。 属性文件:'classpath:**/quartz.properties'无法读取。 – 2013-02-23 08:18:56

0

也可以尝试改变

<param-name>quartz:config-file</param-name> 

:爆炸war文件夹的 文件夹结构

和param值

<param-value>classpath:quartz/quartz.properties</param-value> 
+0

也试过这个。不工作。 – 2013-02-23 09:43:08

+0

尝试 classpath:quartz/quartz.properties Kris 2013-02-23 09:47:17

+0

这也行不通。 – 2013-02-23 10:02:16

相关问题