Quartz.net - “Job的密钥不能为null”

时间:2011-06-24 09:08:08

标签: quartz.net

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

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的键不能为null     来源= mscorlib程序     堆栈跟踪:       服务器堆栈跟踪:       在[0]处重新抛出异常:          在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)          在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData,Int32 type)          在Quartz.Simpl.IRemotableQuartzScheduler.ScheduleJob(IJobDetail jobDetail,ITrigger触发器)          在Quartus.Impl.RemoteScheduler.ScheduleJob(IJobDetail jobDetail,ITrigger触发器)中的D:\ Data \ ben \ Projects \ Utils \ lahma-quartznet-b8cfbde \ lahma-quartznet-b8cfbde \ src \ Quartz \ Impl \ RemoteScheduler.cs:line 424          在QuartusDemo.Program.Main(String [] args)中的D:\ Data \ ben \ Projects \ demos \ QuartzDemo \ QuartzDemo \ Program.cs:第54行          在System.AppDomain._nExecuteAssembly(RuntimeAssembly程序集,String [] args)          在System.AppDomain.ExecuteAssembly(String assemblyFile,Evidence assemblySecurity,String [] args)          在Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()          在System.Threading.ThreadHelper.ThreadStart_Context(对象状态)          at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,Object state,Boolean ignoreSyncCtx)          在System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback回调,对象状态)          在System.Threading.ThreadHelper.ThreadStart()     InnerException:

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

这是使用latest quartz.net code from github

2 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:0)

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

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