Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weblogic - java.lang.NoClassDefFoundError: mu/KotlinLogging #70

Closed
m-horejsi opened this issue Mar 21, 2019 · 6 comments
Closed

Weblogic - java.lang.NoClassDefFoundError: mu/KotlinLogging #70

m-horejsi opened this issue Mar 21, 2019 · 6 comments

Comments

@m-horejsi
Copy link

m-horejsi commented Mar 21, 2019

Hi,
I tried to use this logging in application which I deployed to Weblogic (12.2.1.1.0) and I've got an java.lang.NoClassDefFoundError: mu/KotlinLogging. On embedded Tomcat the application is running well. When I remove KotlinLogging from service, application is running on Weblogic well too.
Application uses Spring Boot (2.1.3), Gradle and Kotlin. I'm Kotlin newbie so maybe I'm doing something wrong..

Given class:

private val logger = KotlinLogging.logger {}
@Service
internal class CockService(
        @Value("\${spring.datasource.url}")
        val db: String) {
    @Scheduled(fixedDelay = 10 * 1000, initialDelay = 10 * 1000)
    fun export() {
        logger.info("Database URL: $db")
    }
}

Exception:

java.lang.NoClassDefFoundError: mu/KotlinLogging
	at cz.homecredit.cock.service.CockServiceKt.<clinit>(CockService.kt:15) ~[_wl_cls_gen.jar:na]
	at cz.homecredit.cock.service.CockService.export(CockService.kt:27) ~[_wl_cls_gen.jar:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_144]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_144]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_144]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_144]
	at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_144]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_144]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_144]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_144]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_144]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_144]
	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_144]
Caused by: java.lang.ClassNotFoundException: mu.KotlinLogging
	at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:1025) ~[com.bea.core.utils.classloaders.jar:12.2.1.1]
	at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:986) ~[com.bea.core.utils.classloaders.jar:12.2.1.1]
	at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:83) ~[com.bea.core.utils.classloaders.jar:12.2.1.1]
	at weblogic.utils.classloaders.GenericClassLoader.doFindClass(GenericClassLoader.java:607) ~[com.bea.core.utils.classloaders.jar:12.2.1.1]
	at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:539) ~[com.bea.core.utils.classloaders.jar:12.2.1.1]
	at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:492) ~[com.bea.core.utils.classloaders.jar:12.2.1.1]
	at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:469) ~[com.bea.core.utils.classloaders.jar:12.2.1.1]
	at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:53) ~[com.bea.core.utils.classloaders.jar:12.2.1.1]
	... 15 common frames omitted
@oshai
Copy link
Owner

oshai commented Mar 21, 2019

Do you know what jars/artifacts are loaded by the class loader? I know in weblogic there is a class loader hierarchy so it might be related to that.

@oshai
Copy link
Owner

oshai commented Mar 31, 2019

@m-horejsi can I close the issue?

@oshai oshai closed this as completed Apr 2, 2019
@ltpquang
Copy link

ltpquang commented Oct 6, 2020

I'm having the same issue, any update on this @m-horejsi ?

@m-horejsi
Copy link
Author

@ltpquang Nope. I didn't have a time to look into this problem so I didn't use this lib..

@ltpquang
Copy link

ltpquang commented Oct 6, 2020

For later, I've just inspected this issue, in my case the kotlin-logging is fetched via jitpack.io, not maven central, which is an empty jar, causing such exception.

@oshai
Copy link
Owner

oshai commented Oct 6, 2020

Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants