JBoss和Quartz [英] JBoss and Quartz

查看:322
本文介绍了JBoss和Quartz的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试查看Quartz是否可以为我解决问题.但是我无法使它正常工作.现在,我陷入了以下错误(相关部分)

I'm trying to see if Quartz can solve a problem for me. But I can't get it to work. Right now I'm stuck at the following error (relevant part)

    Caused by: org.quartz.SchedulerConfigException: Unable to instantiate class load helper class: org.quartz.simpl.CascadingClassLoadHelper cannot be cast to org.quartz.spi.ClassLoadHelper [See nested exception: java.lang.ClassCastException: org.quartz.simpl.CascadingClassLoadHelper cannot be cast to org.quartz.spi.ClassLoadHelper]
    at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:706)
    at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1484)
    at org.jboss.seam.async.QuartzDispatcher.initScheduler(QuartzDispatcher.java:69)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
    at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
    ... 73 more
Caused by: java.lang.ClassCastException: org.quartz.simpl.CascadingClassLoadHelper cannot be cast to org.quartz.spi.ClassLoadHelper
    at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:703)

我已经在Google上搜索过,这似乎是一个经常被问到的问题,但我没有找到任何答案.我的webapp和耳朵中都装有石英罐.

I have googled and it seems to be a question that is asked a lot but I don't find any answers. I have the quartz-jars in both my webapp and ear.

配置中是否存在任何可能导致此问题的内容?

Is there anything in my configuration that can cause this problem?

JBoss 5.1 Quartz JBoss 2.1.6

JBoss 5.1 Quartz JBoss 2.1.6

推荐答案

这是一个类加载问题. JBoss在其类路径中已经具有org.quartz.spi.ClassLoadHelper.class,因为JBoss将其用于内部计时器以执行不同的任务. JBoss提供的quartz.jar位于/jboss-as/common/lib/quartz.jar中.因此,您要为应用程序提供另一个quartz.jar,这会导致与JBoss随附的现有石英类产生冲突.

This is a class loading issue. JBoss already has the org.quartz.spi.ClassLoadHelper.class in its class path since JBoss uses it for internal timers for different tasks. The JBoss provided quartz.jar is located in /jboss-as/common/lib/quartz.jar . So you are providing another quartz.jar with your application which is causing conflict with the existing quartz classes that is provided with JBoss.

要解决此问题,您有两种选择:

To solve this issue you have two options:

  • 选项1 .从您的耳朵和战争中取出石英罐.在我看来,这是一个更好,更轻松的选择,除非出于某种原因,您需要与JBoss提供的石英版本不同的石英版本.

  • Option 1. Remove the quartz jars from your ear and war. This is the better and easier option in my opinion unless for some reason you need a different version of quartz for your application than the one JBoss provides.

选项2 .创建一个META-INF\jboss-classloading.xml文件并隔离您的耳朵(如果需要EAR类看不到WAR类,则可能是您的WAR WEB-INF\jboss-classloading.xml).此博客是一个解释jboss5或jboss6类加载的好方法,以及教程基于博客的博客也是很好的资源.

Option 2. Create a META-INF\jboss-classloading.xml file and isolate your ear (and may be your WAR WEB-INF\jboss-classloading.xml if there is a need for the EAR classes to not see WAR classes). This blog is one of the good ones at explaining the jboss5 or jboss6 class loading and this tutorial based blog is also a good resource.

这篇关于JBoss和Quartz的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆