JetBrains / Exposed

Kotlin SQL Framework
http://jetbrains.github.io/Exposed/
Apache License 2.0
8.37k stars 695 forks source link

NoSuchMethod error : long kotlin.time.TimeSource$Monotonic.markNow #1556

Closed ubarua123 closed 2 years ago

ubarua123 commented 2 years ago

Why am i getting this error? Has exposed moved to kotlin-time? That means I can't upgrade the library as I'll have to move everything to kotlin time instead of java time library?

Exposed version : 0.39.2

Tapac commented 2 years ago

What kotlin version do you use in your project?

ubarua123 commented 2 years ago

I am using 1.6.21

Tapac commented 2 years ago

That strange as 0.39.2 built with 1.6 target. I'll check.

lifestreamy commented 2 years ago

The same happens for me.

Exception in thread "main" java.lang.NoSuchMethodError: 'long kotlin.time.TimeSource$Monotonic.markNow-z9LOYto()'
    at org.jetbrains.exposed.sql.Transaction.exec(Transaction.kt:233)
    at org.jetbrains.exposed.sql.Transaction.exec(Transaction.kt:128)
    at org.jetbrains.exposed.sql.statements.Statement.execute(Statement.kt:28)
    at org.jetbrains.exposed.sql.QueriesKt.insert(Queries.kt:73)
    at DataBaseConnectivity.DataBaseConnectivity$Companion$main$insertedNamesId$1.invoke(DataBaseConnectivity.kt:25)
    at DataBaseConnectivity.DataBaseConnectivity$Companion$main$insertedNamesId$1.invoke(DataBaseConnectivity.kt:24)
    at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.inTopLevelTransaction$run(ThreadLocalTransactionManager.kt:189)
    at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.access$inTopLevelTransaction$run(ThreadLocalTransactionManager.kt:1)
    at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt$inTopLevelTransaction$1.invoke(ThreadLocalTransactionManager.kt:215)
    at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.keepAndRestoreTransactionRefAfterRun(ThreadLocalTransactionManager.kt:223)
    at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.inTopLevelTransaction(ThreadLocalTransactionManager.kt:214)
    at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt$transaction$1.invoke(ThreadLocalTransactionManager.kt:165)
    at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.keepAndRestoreTransactionRefAfterRun(ThreadLocalTransactionManager.kt:223)
    at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.transaction(ThreadLocalTransactionManager.kt:135)
    at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.transaction(ThreadLocalTransactionManager.kt:132)
    at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.transaction$default(ThreadLocalTransactionManager.kt:131)
    at DataBaseConnectivity.DataBaseConnectivity$Companion.main(DataBaseConnectivity.kt:24)
    at DataBaseConnectivity.DataBaseConnectivity.main(DataBaseConnectivity.kt)

Build.gradle :


plugins {
    id 'org.jetbrains.kotlin.jvm' version '1.7.10'
}
group = 'org.example'
version = '1.0-SNAPSHOT'

allprojects {
    repositories {
        mavenCentral()
        maven { url "https://jitpack.io" }
    }
}

dependencies {
    testImplementation 'org.jetbrains.kotlin:kotlin-test'
    testImplementation 'org.slf4j:slf4j-api:2.0.2'
    implementation 'org.slf4j:slf4j-log4j12:1.7.29'
    implementation 'com.github.kotlin-telegram-bot.kotlin-telegram-bot:dispatcher:6.0.7'
    implementation 'org.jetbrains.exposed:exposed-core:0.39.2'
    implementation 'org.jetbrains.exposed:exposed-dao:0.39.2'
    implementation 'org.jetbrains.exposed:exposed-jdbc:0.39.2'
    implementation 'org.postgresql:postgresql:42.2.2'
}

test {
    useJUnitPlatform()
}

compileKotlin {
    kotlinOptions.jvmTarget = '16'
}

compileTestKotlin {
    kotlinOptions.jvmTarget = '16'
}
lifestreamy commented 2 years ago

When setting JVM target to 1.6:

e: JVM target 1.6 is no longer supported. Please migrate to JVM target 1.8 or above

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

And with 1.8 and above I get the same error with markNow()

bandrefilipe commented 2 years ago

Hi @Tapac! When should we expect a new release with this fix to be out?

lifestreamy commented 2 years ago

@bandrefilipe until it is fixed I'd suggest using Exposed version 38.2. Works for me without errors.

lifestreamy commented 2 years ago

https://github.com/JetBrains/Exposed/issues/1600#event-7466442875 Here I posted a duplicate of this to get some attention to the issue.

They commented 7 days ago: "Fix will be available in a week"

We'll see

Tapac commented 2 years ago

Sorry for a delay with release, there were few issues required attention before it. Will be released today.

chexov commented 2 years ago

I am running multiplatform example project and hitting this issue with

    kotlin("multiplatform") version "1.7.20"
    application
}

kotlin {
    jvm {
        compilations.all {
            kotlinOptions.jvmTarget = "1.8"
        }
...
Tapac commented 2 years ago

@chexov , what Exposed version do you use?