首页 \ 问答 \ SimpleThreadPool的Quartz ClassNotFoundException(Quartz ClassNotFoundException for SimpleThreadPool)

SimpleThreadPool的Quartz ClassNotFoundException(Quartz ClassNotFoundException for SimpleThreadPool)

我正在尝试配置一个只能在一个节点上运行的石英调度程序( https://github.com/spinscale/dropwizard-jobs#using-dropwizard-jobs-in-a-clustered-environment )。 每当我设置石英spinscale/dropwizard-jobs ,它告诉我无法找到SimpleThreadPool ,即使它是通过spinscale/dropwizard-jobs加载到我的项目中。 加载的版本是quartz-2.2.3

我正在使用https://github.com/spinscale/dropwizard-jobs将quartz连接到dropwizard项目中。 我正在使用dropwizard 1.0.5,dropwizard-guicey 4.0.1( https://github.com/xvik/dropwizard-guicey ),spinscale quartz implementation 3.0.0。

我通过这个例子连接了依赖注入: https//github.com/xvik/dropwizard-guicey-examples/tree/master/dropwizard-jobs

我已将以下文件添加到我的项目quartz.properties

org.quartz.scheduler.instanceName: "scheduler"
org.quartz.scheduler.instanceId: "AUTO"
org.quartz.scheduler.skipUpdateCheck: "true"
org.quartz.threadPool.class: "org.quartz.simpl.SimpleThreadPool"
org.quartz.threadPool.threadCount: "10"
org.quartz.threadPool.threadPriority: "5"
org.quartz.jobStore.misfireThreshold: "60000"
org.quartz.jobStore.class: "org.quartz.impl.jdbcjobstore.JobStoreTX"
org.quartz.jobStore.driverDelegateClass: "org.quartz.impl.jdbcjobstore.StdJDBCDelegate"
org.quartz.jobStore.useProperties: "false"
org.quartz.jobStore.dataSource: "myDS"
org.quartz.jobStore.tablePrefix: "QRTZ_"
org.quartz.jobStore.isClustered: "true"
org.quartz.dataSource.myDS.driver: "org.postgresql.Driver"
org.quartz.dataSource.myDS.URL: "jdbc:mysql://localhost:3306/quartz"
org.quartz.dataSource.myDS.user: user
org.quartz.dataSource.myDS.password: pass
org.quartz.dataSource.myDS.maxConnections: "5"
org.quartz.dataSource.myDS.validationQuery: "select 1"

这是我看到的例外

ERROR [2018-03-12 04:38:29,755] io.dropwizard.cli.ServerCommand: Unable to start server, shutting down
! java.lang.ClassNotFoundException: "org.quartz.simpl.SimpleThreadPool"
! at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
! at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
! at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
! at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
! at org.quartz.simpl.InitThreadContextClassLoadHelper.loadClass(InitThreadContextClassLoadHelper.java:72)
! at org.quartz.simpl.CascadingClassLoadHelper.loadClass(CascadingClassLoadHelper.java:114)
! at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:822)
! ... 17 common frames omitted
! Causing: org.quartz.SchedulerException: ThreadPool class '"org.quartz.simpl.SimpleThreadPool"' could not be instantiated.
! at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:824)
! at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1525)
! at org.quartz.impl.StdSchedulerFactory.getDefaultScheduler(StdSchedulerFactory.java:1541)
! at de.spinscale.dropwizard.jobs.JobManager.start(JobManager.java:50)
! at io.dropwizard.lifecycle.JettyManaged.doStart(JettyManaged.java:27)
! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
! at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
! at org.eclipse.jetty.server.Server.start(Server.java:411)
! at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
! at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
! at org.eclipse.jetty.server.Server.doStart(Server.java:378)
! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
! at io.dropwizard.cli.ServerCommand.run(ServerCommand.java:53)
! at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:44)
! at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:85)
! at io.dropwizard.cli.Cli.run(Cli.java:75)
! at io.dropwizard.Application.run(Application.java:79)

I'm trying to configure a quartz scheduler that will only run on one node (https://github.com/spinscale/dropwizard-jobs#using-dropwizard-jobs-in-a-clustered-environment). Whenever I setup the quartz threadpool, it tells me that SimpleThreadPool cannot be found, even though it's loaded in my project via spinscale/dropwizard-jobs. The version loaded in is quartz-2.2.3

I'm using https://github.com/spinscale/dropwizard-jobs to integrate quartz into a dropwizard project. I'm using dropwizard 1.0.5, dropwizard-guicey 4.0.1 (https://github.com/xvik/dropwizard-guicey), spinscale quartz implementation 3.0.0.

I've hooked up dependency injection via this example here: https://github.com/xvik/dropwizard-guicey-examples/tree/master/dropwizard-jobs

And I've added the following file to my project quartz.properties

org.quartz.scheduler.instanceName: "scheduler"
org.quartz.scheduler.instanceId: "AUTO"
org.quartz.scheduler.skipUpdateCheck: "true"
org.quartz.threadPool.class: "org.quartz.simpl.SimpleThreadPool"
org.quartz.threadPool.threadCount: "10"
org.quartz.threadPool.threadPriority: "5"
org.quartz.jobStore.misfireThreshold: "60000"
org.quartz.jobStore.class: "org.quartz.impl.jdbcjobstore.JobStoreTX"
org.quartz.jobStore.driverDelegateClass: "org.quartz.impl.jdbcjobstore.StdJDBCDelegate"
org.quartz.jobStore.useProperties: "false"
org.quartz.jobStore.dataSource: "myDS"
org.quartz.jobStore.tablePrefix: "QRTZ_"
org.quartz.jobStore.isClustered: "true"
org.quartz.dataSource.myDS.driver: "org.postgresql.Driver"
org.quartz.dataSource.myDS.URL: "jdbc:mysql://localhost:3306/quartz"
org.quartz.dataSource.myDS.user: user
org.quartz.dataSource.myDS.password: pass
org.quartz.dataSource.myDS.maxConnections: "5"
org.quartz.dataSource.myDS.validationQuery: "select 1"

This is the exception I'm seeing

ERROR [2018-03-12 04:38:29,755] io.dropwizard.cli.ServerCommand: Unable to start server, shutting down
! java.lang.ClassNotFoundException: "org.quartz.simpl.SimpleThreadPool"
! at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
! at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
! at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
! at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
! at org.quartz.simpl.InitThreadContextClassLoadHelper.loadClass(InitThreadContextClassLoadHelper.java:72)
! at org.quartz.simpl.CascadingClassLoadHelper.loadClass(CascadingClassLoadHelper.java:114)
! at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:822)
! ... 17 common frames omitted
! Causing: org.quartz.SchedulerException: ThreadPool class '"org.quartz.simpl.SimpleThreadPool"' could not be instantiated.
! at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:824)
! at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1525)
! at org.quartz.impl.StdSchedulerFactory.getDefaultScheduler(StdSchedulerFactory.java:1541)
! at de.spinscale.dropwizard.jobs.JobManager.start(JobManager.java:50)
! at io.dropwizard.lifecycle.JettyManaged.doStart(JettyManaged.java:27)
! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
! at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
! at org.eclipse.jetty.server.Server.start(Server.java:411)
! at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
! at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
! at org.eclipse.jetty.server.Server.doStart(Server.java:378)
! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
! at io.dropwizard.cli.ServerCommand.run(ServerCommand.java:53)
! at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:44)
! at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:85)
! at io.dropwizard.cli.Cli.run(Cli.java:75)
! at io.dropwizard.Application.run(Application.java:79)

原文:https://stackoverflow.com/questions/49228289
更新时间:2022-11-19 17:11

最满意答案

如果你想制作全height边栏,那么侧边栏将是fixed position ,其余内容将是relative position 。 请检查以下代码段

html{
  box-sizing: border-box;
  height: 100%;
  width: 100%;
}
*,
*:after,
*:before{
  box-sizing: inherit;
}
body{
  margin: 0;
  padding: 0;
}
.full_height{
  background-color: white;
  display: flex;
  flex-direction: column;
}
@media (min-width: 992px){
  .full_height{
    padding-left: 330px;
  }
}
.sidebar{
  background-color: #5c5c5c;
  color: white;
  display: flex;
  flex-direction: column;
  margin-bottom: 30px;
  padding: 20px;
  width: 100%;
}
@media (min-width: 992px){
  .sidebar{
    height: 100%;
    left: 0;
    overflow-x: hidden;
    overflow-y: auto;
    position: fixed;
    top: 0;
    width: 310px;
    z-index: 1030;
  }
}
.main{
  background-color: #009688;
  color: white;
  font-size: 20px;
  margin-bottom: 30px;
  padding: 20px;
  width: 100%;
}
<div class="full_height">
  <div class="sidebar">Some content</div>
  <div class="main">Some dynamic content</div>
</div>

Snippet two这个相对内容

html{
  box-sizing: border-box;
  height: 100%;
  width: 100%;
}
*,
*:after,
*:before{
  box-sizing: inherit;
}
body{
  height: 100%;
  margin: 0;
  padding: 0;
  width: 100%;
}
.full_height{
  background-color: black;
  display: flex;
  flex-direction: column;
  padding: 20px;
}
@media (min-width: 992px){
  .full_height{
    align-items: stretch;
    flex-direction: row;
    flex-wrap: nowrap;
    height: 100%;
    width: 100%;
  }
}
.sidebar{
  background-color: #f5f5f5;
  color: #009688;
  flex-basis: 100%;
  flex-grow: 0;
  flex-shrink: 0;
  max-width: 100%;
  padding: 20px;
}
@media (min-width: 992px){
  .sidebar{
    flex-basis: 310px;
    max-width: 310px;
  }
}
.main{
  background-color: white;
  color: black;
  padding: 20px;
  width: 100%;
}
@media (min-width: 992px){
  .main{
    padding-left: 40px;
  }
}
<div class="full_height">
  <div class="sidebar">Sidebar content</div>
  <div class="main">Main Content</div>
</div>

检查全宽视图中的代码段 。 所有代码段都是响应式的。


If you want to make full height sidebar then sidebar will be fixed position and rest of the content will be relative position. Please check the below Snippet.

html{
  box-sizing: border-box;
  height: 100%;
  width: 100%;
}
*,
*:after,
*:before{
  box-sizing: inherit;
}
body{
  margin: 0;
  padding: 0;
}
.full_height{
  background-color: white;
  display: flex;
  flex-direction: column;
}
@media (min-width: 992px){
  .full_height{
    padding-left: 330px;
  }
}
.sidebar{
  background-color: #5c5c5c;
  color: white;
  display: flex;
  flex-direction: column;
  margin-bottom: 30px;
  padding: 20px;
  width: 100%;
}
@media (min-width: 992px){
  .sidebar{
    height: 100%;
    left: 0;
    overflow-x: hidden;
    overflow-y: auto;
    position: fixed;
    top: 0;
    width: 310px;
    z-index: 1030;
  }
}
.main{
  background-color: #009688;
  color: white;
  font-size: 20px;
  margin-bottom: 30px;
  padding: 20px;
  width: 100%;
}
<div class="full_height">
  <div class="sidebar">Some content</div>
  <div class="main">Some dynamic content</div>
</div>

Snippet two This relative content

html{
  box-sizing: border-box;
  height: 100%;
  width: 100%;
}
*,
*:after,
*:before{
  box-sizing: inherit;
}
body{
  height: 100%;
  margin: 0;
  padding: 0;
  width: 100%;
}
.full_height{
  background-color: black;
  display: flex;
  flex-direction: column;
  padding: 20px;
}
@media (min-width: 992px){
  .full_height{
    align-items: stretch;
    flex-direction: row;
    flex-wrap: nowrap;
    height: 100%;
    width: 100%;
  }
}
.sidebar{
  background-color: #f5f5f5;
  color: #009688;
  flex-basis: 100%;
  flex-grow: 0;
  flex-shrink: 0;
  max-width: 100%;
  padding: 20px;
}
@media (min-width: 992px){
  .sidebar{
    flex-basis: 310px;
    max-width: 310px;
  }
}
.main{
  background-color: white;
  color: black;
  padding: 20px;
  width: 100%;
}
@media (min-width: 992px){
  .main{
    padding-left: 40px;
  }
}
<div class="full_height">
  <div class="sidebar">Sidebar content</div>
  <div class="main">Main Content</div>
</div>

Check the Snippet in full width view. All snippet is responsive.

相关问答

更多
  • 更改 .container { height: 100%; } 至 .container { min-height: 100%; } Change .container { height: 100%; } to .container { min-height: 100%; }
  • 我想到的一个解决方案是,使用JavaScript(或JQuery)来获取主要内容的高度,并确定可以在侧面添加多少DIV。 编辑:这不是一种有效的方法,但在循环中假设将显示所有侧栏内容。 然后,在javascript中决定要显示多少个div。 I wound up doing this with jQuery. It's not a floating sidebar, it actually adds img tags as needed to whatever is there already, until ...
  • 如果你想制作全height边栏,那么侧边栏将是fixed position ,其余内容将是relative position 。 请检查以下代码段 。 html{ box-sizing: border-box; height: 100%; width: 100%; } *, *:after, *:before{ box-sizing: inherit; } body{ margin: 0; padding: 0; } .full_height{ ba ...
  • 只是为了让每个人都知道我找到了一个解决方案...有很多搞乱,但代码在下面。 我基本上在点击时必须将侧边栏高度设置回0,并创建一个函数,找到#main-container部分的新高度,然后将其作为css高度应用于侧边栏。 这改变了侧边栏的高度就好了,但是粘性侧边栏没有重新调整到新的高度,所以我只是粘贴了我的粘性侧边栏的代码(以$(“旁边”)开头的代码到函数中它刷新就好了。感谢那些有帮助的人。