我正在尝试为Quartzdesk创建SchedulerFactoryBean。当我使用JVM args启动应用程序时:出现以下错误。
Caused by: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.accessException: Cannot modify this registry
Caused by: java.rmi.accessException: Cannot modify this registry
这是我的Sping bean配置
@Bean
public SchedulerFactoryBean scheduler(@Autowired DynamicPropUtil dynamicPropUtil,@Autowired @Qualifier("quartzDatasource") DataSource quartzDataSource) throws IOException {
SchedulerFactoryBean schedulerFactory = new SchedulerFactoryBean();
Resource policyFile = new ClasspathResource("quartz.properties");
System.setProperty("java.security.policy","file:///" + policyFile.getFile().getabsolutePath());
System.setSecurityManager(new SpringSecurityManager());
schedulerFactory.setConfigLocation(new ClasspathResource("quartz.properties"));
String schedulerName = dynamicPropUtil.getStr("org.quartz.scheduler.instanceName","census-loader-scheduler");
schedulerFactory.setSchedulerName(schedulerName);
schedulerFactory.setDataSource(quartzDataSource);
schedulerFactory.setTransactionmanager(new DataSourceTransactionmanager(quartzDataSource));
schedulerFactory.setapplicationContextSchedulerContextKey("applicationContext");
AutowiringSpringBeanJobFactory jobFactory = new AutowiringSpringBeanJobFactory();
jobFactory.setapplicationContext(this.applicationContext);
schedulerFactory.setJobFactory(jobFactory);
schedulerFactory.setOverwriteExistingJobs(dynamicPropUtil.getBool("quartz.schedular.overwrite.jobs",false));
schedulerFactory.setautoStartup(dynamicPropUtil.getBool("quartz.scheduler.auto.start",true));
schedulerFactory.setStartupDelay(dynamicPropUtil.getInt("quartz.scheduler.startup.delay",30));
schedulerFactory.setWaitForJobsToCompleteonShutdown(dynamicPropUtil.getBool("quartz.scheduler.waitfor.shutdown",true));
log.info("SchedulerFactoryBean : Created with name {}",schedulerName);
return schedulerFactory;
}
JVM ARGS:
-Dapp.environment=dev
-Djava.rmi.server.hostname=localhost
-Djavax.management.builder.initial=
-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=1099
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false