JetBrains / Exposed

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

java.lang.NoSuchMethodError: 'void kotlin.jvm.internal.PropertyReference1Impl.<init>(java.lang.Class, java.lang.String, java.lang.String, int)' #1152

Closed gutyerrez closed 3 years ago

gutyerrez commented 3 years ago

Java version: 15

Exposed version: latest

Kotlin version: 1.4.30-RC

My root build.gradle.kts

plugins {
    kotlin("jvm")version "1.4.30-RC"

    id("java")
    id("maven-publish")
    id("com.github.johnrengelman.shadow") version "6.1.0"
}

repositories {
    mavenCentral()

    jcenter()
}

subprojects {
    plugins.apply("com.github.johnrengelman.shadow")
    plugins.apply("org.jetbrains.kotlin.jvm")
    plugins.apply("maven-publish")
    plugins.apply("java")

    tasks {
        compileKotlin {
            kotlinOptions {
                jvmTarget = "15"
            }
        }
    }

    group = "com.redefantasy"
    version = "0.1-ALPHA"

    repositories {
        mavenCentral()

        mavenLocal()

        jcenter()
    }
}

Module gradle.build.kts

dependencies {
    // kotlin lib
    implementation(kotlin("stdlib"))
    api(kotlin("reflect"))

    // google
    implementation("com.google.guava:guava:29.0-jre")
    implementation("com.google.code.gson:gson:2.8.6")

    // commons-lang 3
    implementation("org.apache.commons:commons-lang3:3.11")

    // commons-io
    implementation("commons-io:commons-io:2.8.0")

    // hikari cp
    implementation("com.zaxxer:HikariCP:3.4.5")

    // exposed
    implementation("org.jetbrains.exposed:exposed-core:0.29.1")
    implementation("org.jetbrains.exposed:exposed-dao:0.29.1")
    implementation("org.jetbrains.exposed:exposed-jdbc:0.29.1")
    implementation("org.jetbrains.exposed:exposed-jodatime:0.29.1")

    // postgres
    implementation("org.postgresql:postgresql:42.2.16")

    // mongodb
    implementation("org.mongodb:mongo-java-driver:3.9.1")
    implementation("org.mongodb:mongodb-driver-sync:4.1.0")
    implementation("org.mongodb:bson:4.1.0")

    // jedis
    implementation("redis.clients:jedis:3.3.0")

    // influx db
    implementation("org.influxdb:influxdb-java:2.20")

    // jackson
    implementation("com.fasterxml.jackson.core:jackson-core:2.11.2")
    implementation("com.fasterxml.jackson.core:jackson-databind:2.11.2")
    implementation("com.fasterxml.jackson.core:jackson-annotations:2.11.2")
    implementation("com.fasterxml.jackson.datatype:jackson-datatype-guava:2.11.2")
    implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.11.2")

    // eventbus
    implementation("org.greenrobot:eventbus:3.2.0")

    // okhttp
    implementation("com.squareup.okhttp3:okhttp:4.8.1")
    implementation("com.squareup.okio:okio:2.8.0")

    // caffeine
    implementation("com.github.ben-manes.caffeine:caffeine:2.8.5")

    // waterfall-chat
    api("io.github.waterfallmc:waterfall-chat:1.16-R0.4-SNAPSHOT")
}

val sources by tasks.registering(Jar::class) {
    archiveBaseName.set(project.name)
    archiveClassifier.set("sources")
    archiveVersion.set(null as String?)

    from(sourceSets.main.get().allSource)
}

publishing {
    publications {
        create<MavenPublication>("maven") {
            from(components["kotlin"])
            artifact(sources.get())
        }
    }
}

My code:

package com.redefantasy.core.shared.applications.storage.repositories.implementations

import com.redefantasy.core.shared.applications.data.Application
import com.redefantasy.core.shared.applications.storage.dao.ApplicationDAO
import com.redefantasy.core.shared.applications.storage.dto.FetchApplicationByAddressAndPortDTO
import com.redefantasy.core.shared.applications.storage.dto.FetchApplicationByNameDTO
import com.redefantasy.core.shared.applications.storage.dto.FetchApplicationsByTypeAndServerDTO
import com.redefantasy.core.shared.applications.storage.dto.FetchApplicationsByTypeDTO
import com.redefantasy.core.shared.applications.storage.repositories.IApplicationsRepository
import com.redefantasy.core.shared.applications.storage.table.ApplicationsTable
import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.sql.transactions.transaction

/**
 * @author SrGutyerrez
 **/
class PostgresApplicationsRepository : IApplicationsRepository {

    override fun fetchAll(): Map<String, Application> {
        transaction {
            val applications = mutableMapOf<String, Application>()

            ApplicationDAO.all().forEach {
                applications[it.name.value] = it.asApplication()
            }

            return@transaction applications
        }

        return emptyMap()
    }

    override fun fetchByType(fetchApplicationsByTypeDTO: FetchApplicationsByTypeDTO): Map<String, Application> {
        transaction {
            val applications = mutableMapOf<String, Application>()

            ApplicationDAO.find {
                ApplicationsTable.applicationType eq fetchApplicationsByTypeDTO.applicationType
            }.forEach {
                applications[it.name.value] = it.asApplication()
            }

            return@transaction applications
        }

        return emptyMap()
    }

    override fun fetchByTypeAndServer(fetchApplicationsByTypeAndServerDTO: FetchApplicationsByTypeAndServerDTO): Map<String, Application> {
        transaction {
            val applications = mutableMapOf<String, Application>()

            ApplicationDAO.find {
                ApplicationsTable.applicationType eq fetchApplicationsByTypeAndServerDTO.applicationType and (
                        ApplicationsTable.serverName eq fetchApplicationsByTypeAndServerDTO.server.name
                )
            }.forEach {
                applications[it.name.value] = it.asApplication()
            }

            return@transaction applications
        }

        return emptyMap()
    }

    override fun fetchByName(fetchApplicationByNameDTO: FetchApplicationByNameDTO): Application? {
        transaction {
            var application: Application? = null

            val result =  ApplicationDAO.find {
                ApplicationsTable.name eq fetchApplicationByNameDTO.applicationName
            }

            if (!result.empty()) application = result.first().asApplication()

            return@transaction application
        }

        return null
    }

    override fun fetchByAddressAndPort(fetchApplicationByAddressAndPortDTO: FetchApplicationByAddressAndPortDTO): Application? {
        transaction {
            var application: Application? = null

            val result = ApplicationDAO.find {
                ApplicationsTable.address eq fetchApplicationByAddressAndPortDTO.address and (
                        ApplicationsTable.port eq fetchApplicationByAddressAndPortDTO.port
                )
            }

            if (!result.empty()) application = result.first().asApplication()

            return@transaction application
        }

        return null
    }

}

Exception:

[21:47:04 WARN]: Exception encountered when loading plugin: Core
java.lang.NoSuchMethodError: 'void kotlin.jvm.internal.PropertyReference1Impl.<init>(java.lang.Class, java.lang.String, java.lang.String, int)'
        at org.jetbrains.exposed.dao.EntityCacheKt.<clinit>(EntityCache.kt) ~[?:?]
        at org.jetbrains.exposed.dao.EntityLifecycleInterceptor.beforeRollback(EntityLifecycleInterceptor.kt:47) ~[?:?]
        at org.jetbrains.exposed.sql.Transaction.rollback(Transaction.kt:72) ~[?:?]
        at org.jetbrains.exposed.sql.transactions.TransactionApiKt.rollbackLoggingException(TransactionApi.kt:116) ~[?:?]
        at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt$inTopLevelTransaction$1.invoke(ThreadLocalTransactionManager.kt:181) ~[?:?]
        at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt$inTopLevelTransaction$2.invoke(ThreadLocalTransactionManager.kt:191) ~[?:?]
        at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.keepAndRestoreTransactionRefAfterRun(ThreadLocalTransactionManager.kt:199) ~[?:?]
        at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.inTopLevelTransaction(ThreadLocalTransactionManager.kt:190) ~[?:?]
        at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt$transaction$1.invoke(ThreadLocalTransactionManager.kt:148) ~[?:?]
        at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.keepAndRestoreTransactionRefAfterRun(ThreadLocalTransactionManager.kt:199) ~[?:?]
        at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.transaction(ThreadLocalTransactionManager.kt:120) ~[?:?]
        at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.transaction(ThreadLocalTransactionManager.kt:118) ~[?:?]
        at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.transaction$default(ThreadLocalTransactionManager.kt:117) ~[?:?]
        at com.redefantasy.core.shared.applications.storage.repositories.implementations.PostgresApplicationsRepository.fetchByAddressAndPort(PostgresApplicationsRepository.kt:84) ~[?:?]
        at com.redefantasy.core.shared.CoreProvider.prepare(CoreProvider.kt:116) ~[?:?]
        at com.redefantasy.core.bungee.misc.plugin.CustomPlugin.onEnable(CustomPlugin.kt:18) ~[?:?]
        at com.redefantasy.core.bungee.CoreBungeePlugin.onEnable(CoreBungeePlugin.kt:15) ~[?:?]
        at net.md_5.bungee.api.plugin.PluginManager.enablePlugins(PluginManager.java:300) ~[Waterfall.jar:git:Waterfall-Bootstrap:1.16-R0.4-SNAPSHOT:a683c77:unknown]
        at net.md_5.bungee.BungeeCord.start(BungeeCord.java:251) ~[Waterfall.jar:git:Waterfall-Bootstrap:1.16-R0.4-SNAPSHOT:a683c77:unknown]
        at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:41) ~[Waterfall.jar:git:Waterfall-Bootstrap:1.16-R0.4-SNAPSHOT:a683c77:unknown]
        at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15) ~[Waterfall.jar:git:Waterfall-Bootstrap:1.16-R0.4-SNAPSHOT:a683c77:unknown]
Tapac commented 3 years ago

Can you please update to Kotlin 1.4.32 and Exposed 0.30.2 and check your case?