【问题标题】:Quartz.net - "Job's key cannot be null"Quartz.net - “作业的密钥不能为空”
【发布时间】:2011-07-21 10:59:33
【问题描述】:

我正在尝试使用以下代码在远程调度程序上安排作业:

NameValueCollection properties = new NameValueCollection();
properties["quartz.scheduler.instanceName"] = "RemoteClient";

// set thread pool info
properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz";
properties["quartz.threadPool.threadCount"] = "5";
properties["quartz.threadPool.threadPriority"] = "Normal";

// set remoting expoter
properties["quartz.scheduler.proxy"] = "true";
properties["quartz.scheduler.proxy.address"] = "tcp://127.0.0.1:555/QuartzScheduler";

// First we must get a reference to a scheduler
ISchedulerFactory sf = new StdSchedulerFactory(properties);
IScheduler sched = sf.GetScheduler();

// define the job and ask it to run
IJobDetail job = JobBuilder.NewJob<TestJob>()
    .WithIdentity("remotelyAddedJob", "test")
    .Build();

ITrigger trigger = TriggerBuilder.Create()
    .WithIdentity("remotelyAddedTrigger", "test")
    .ForJob(job)
    .WithSchedule(CalendarIntervalScheduleBuilder.Create().WithIntervalInMinutes(1))
    .Build();

// schedule the job
sched.ScheduleJob(job, trigger);

当我执行代码时,会抛出以下异常:

Quartz.SchedulerException 未处理 Message=Job 的 key 不能为空 源=mscorlib 堆栈跟踪: 服务器堆栈跟踪: 在 [0] 处重新抛出异常: 在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg) 在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData,Int32 类型) 在 Quartz.Simpl.IRemotableQuartzScheduler.ScheduleJob(IJobDetail jobDetail, ITrigger 触发器) 在 D:\Data\ben\Projects\Utils\lahma-quartznet-b8cfbde\lahma-quartznet-b8cfbde\src\Quartz\Impl\RemoteScheduler.cs:line 中的 Quartz.Impl.RemoteScheduler.ScheduleJob(IJobDetail jobDetail, ITrigger trigger) 424 在 D:\Data\ben\Projects\demos\QuartzDemo\QuartzDemo\Program.cs:line 54 中的 QuartzDemo.Program.Main(String[] args) 在 System.AppDomain._nExecuteAssembly(RuntimeAssembly 程序集,字符串 [] 参数) 在 System.AppDomain.ExecuteAssembly(字符串 assemblyFile,证据 assemblySecurity,String [] args) 在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() 在 System.Threading.ThreadHelper.ThreadStart_Context(对象状态) 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback 回调,对象状态,布尔 ignoreSyncCtx) 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback 回调,对象状态) 在 System.Threading.ThreadHelper.ThreadStart() 内部异常:

使用本地调度程序时一切正常。 Quartz 服务器作为服务运行并侦听 tcp 端口 555。

这是使用latest quartz.net code from github

【问题讨论】:

    标签: quartz.net


    【解决方案1】:

    这确实是一个错误,但已修复。做一个新的拉动,你会很高兴的。

    【讨论】:

      【解决方案2】:

      Quartz 邮件列表上有关于 2.0 版本中数据库访问问题的 cmets。

      从语法看来,您使用的是 2.0 代码库。它甚至还没有作为测试版发布。我希望这不是您正在组装的生产系统。

      【讨论】:

        猜你喜欢
        • 2020-10-13
        • 1970-01-01
        • 1970-01-01
        • 2020-06-02
        • 2021-10-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多