In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the knowledge about "how to solve the problem that the project can run in idea but the jar package can't run". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!
Problems encountered: the project in idea can run, but the jar package can not run
Error reason: class in timed task class cannot get some beans from context, or Netty class cannot get some beans from context; delay in scheduleConfig configuration class is 10000, and it can be run by packaging method in 2 and 3.
ScheduleConfig configuration file
package com.bst.framework.config;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;import org.springframework.scheduling.quartz.SchedulerFactoryBean;import javax.sql.DataSource;import java.util.Properties;/** * Scheduled Task Configuration * * @author ruoyi */@Configurationpublic class ScheduleConfig{@Bean public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource) { SchedulerFactoryBean factory = new SchedulerFactoryBean(); factory.setDataSource(dataSource); // quartz parameter Properties prop = new Properties(); prop.put("org.quartz.scheduler.instanceName", "RuoyiScheduler"); prop.put("org.quartz.scheduler.instanceId", "AUTO"); //thread pool configuration prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool"); prop.put("org.quartz.threadPool.threadCount", "20"); prop.put("org.quartz.threadPool.threadPriority", "5"); // JobStore configuration prop.put("org.quartz.jobStore.class", "org.quartz.impl.jdbcjobstore.JobStoreTX"); //Cluster Configuration prop.put("org.quartz.jobStore.isClustered", "true"); prop.put("org.quartz.jobStore.clusterCheckinInterval", "15000"); prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "1"); prop.put("org.quartz.jobStore.txIsolationLevelSerializable", "true"); // sqlserver enabled // prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ? "); prop.put("org.quartz.jobStore.misfireThreshold", "12000"); prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_"); factory.setQuartzProperties(prop); factory.setSchedulerName("RuoyiScheduler"); //delayed start factory.setStartupDelay(10000); //This one has a pit and needs to be studied carefully factory.setApplicationContextSchedulerContextKey("applicationContextKey"); //Optional, QuartzScheduler //Update existing jobs when starting, so that you don't have to delete qrtz_job_details table corresponding records every time you modify targetObject factory.setOverwriteExistingJobs(true); //Set autostart, default is true factory.setAutoStartup(true); return factory; }}
1. Idea plug-in packaging, this form of packaging is easy to encounter bugs, all kinds of beans can not be created.
2. Mvn Packaging:
https://blog.csdn.net/qq_36159851/article/details/79699193
mvn command not recognized: www.cnblogs.com/rgever/p/9824992.html
3. build Artifacts package this reliable number of specified main classes
https://blog.csdn.net/qq_43619459/article/details/108014917
"How to solve the problem that the project in idea can run, but the jar package can't run" is introduced here. Thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.