0

I'm using Shedlock with oracle DB,i followed this documentation https://github.com/lukas-krecan/ShedLock I also added the 5th column " now TIMESTAMP(3) NULL," to the table after the exception. Its the only instance running currently.

this is my configuration

@Scheduled(fixedRateString = "${schedules}" )
@SchedulerLock(name = "Milmes08",lockAtLeastForString  = "PT70S", lockAtMostForString = "PT70S")
@GetMapping
public TransferAllOut transferAll() throws Exception {
//code      
}

This is the configured bean

@Bean
public LockProvider lockProvider(@Qualifier("oracleDataSource") DataSource dataSource) {
    return new JdbcTemplateLockProvider(dataSource);
}

this is the Table

CREATE TABLE shedlock(
name VARCHAR(64), 
lock_until TIMESTAMP(3) NULL, 
locked_at TIMESTAMP(3) NULL, 
locked_by  VARCHAR(255), 
now TIMESTAMP(3) NULL,
PRIMARY KEY (name)

)

and the enabling of the scheduling

@EnableScheduling
@SpringBootApplication
@EnableSchedulerLock(defaultLockAtMostFor = "PT5M")
public class JswMilme08ApiApplication {

public static void main(String[] args) {
    SpringApplication.run(JswMilme08ApiApplication.class, args);

}

this is the exception

scheduling-1] o.s.s.s.TaskUtils$LoggingErrorHandler 2021-03-03 13:52:29 - Unexpected error occurred 
in scheduled task
java.lang.NoClassDefFoundError: net/javacrumbs/shedlock/core/ClockProvider
at 
net.javacrumbs.shedlock.provider.jdbctemplate.SqlStatementsSource.params(SqlStatementsSource.java:86)
at net.javacrumbs.shedlock.provider.jdbctemplate.JdbcTemplateStorageAccessor.params(JdbcTemplateStorageAccessor.java:117)
at net.javacrumbs.shedlock.provider.jdbctemplate.JdbcTemplateStorageAccessor.lambda$insertRecord$0(JdbcTemplateStorageAccessor.java:65)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
at net.javacrumbs.shedlock.provider.jdbctemplate.JdbcTemplateStorageAccessor.insertRecord(JdbcTemplateStorageAccessor.java:64)
at net.javacrumbs.shedlock.support.StorageBasedLockProvider.doLock(StorageBasedLockProvider.java:77)
at net.javacrumbs.shedlock.support.StorageBasedLockProvider.lock(StorageBasedLockProvider.java:61)
at net.javacrumbs.shedlock.core.DefaultLockingTaskExecutor.executeWithLock(DefaultLockingTaskExecutor.java:50)
at net.javacrumbs.shedlock.core.DefaultLockingTaskExecutor.executeWithLock(DefaultLockingTaskExecutor.java:39)
at net.javacrumbs.shedlock.core.DefaultLockManager.executeWithLock(DefaultLockManager.java:51)
at net.javacrumbs.shedlock.core.LockableRunnable.run(LockableRunnable.java:35)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ClassNotFoundException: net.javacrumbs.shedlock.core.ClockProvider
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 18 common frames omitted
Tai Levi
  • 1
  • 1

1 Answers1

0

NoClassDefFoundError is usually caused by some problem with your dependencies. In this case I would guess that you have old version of shedlock-core in your class-path.

Lukas
  • 13,606
  • 9
  • 31
  • 40