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

BUG: java.util.logging.Logger #377

Closed
mitch3ls opened this issue Feb 12, 2021 · 6 comments
Closed

BUG: java.util.logging.Logger #377

mitch3ls opened this issue Feb 12, 2021 · 6 comments
Assignees

Comments

@mitch3ls
Copy link

Summary:
java.lang.ClassNotFoundException is thrown for java.util.logging.Logger if Logger is used in packaged application. This behavior does not occur with gradle run without packaging

Environment:
OS: Windows 10 Pro 1901 18363.900

Steps to Reproduce:

  1. IntelliJ -> create new projekt -> Kotlin -> Java Compose for Desktop
  2. Add TargetFormat.AppImage in build.gradle.kt
  3. Add Remote JVM Debug running configuration to IntelliJ
  4. Enable remote debugging in the compose app with
compose.desktop {
    application {
        mainClass = "MainKt"
        nativeDistributions {
            targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb, TargetFormat.AppImage)

            jvmArgs += "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005"
  1. gradle packageAppImage
  2. run packaged app and set breakpoint in the button's onClick callback
  3. start debugging the Remote JVM Debugging configuration
  4. press the button
  5. evaluate java.util.logging.Logger("foo") in IntelliJ's debugging panel
  6. see the thrown ClassNotFoundException

Expected Results:
I would expect to receive a Logger object, as it would happen before packaging (with only gradle run)

Actual Results:
ClassNotFoundException is thrown, which crashes the app outside of this debugging evaluation call

Notes:
I found this bug when I tried to use squareup's okio library in a compose project (https://square.github.io/okio/)

@jimgoog
Copy link
Collaborator

jimgoog commented Feb 12, 2021

Can you please provide a minimal repro so we can debug locally?

@mitch3ls
Copy link
Author

mitch3ls commented Feb 13, 2021

I created a sample project on my private profile: https://github.com/mitch3ls/jb-compose-issue-377-demo

All the necessary steps are described in main.kt

edit:
I also added a branch named "crashes" to demonstrate the impact on real apps using java.util.logging.Logger

@mitch3ls
Copy link
Author

I tried the solution from #381 with both modules("java.util.logging") and modules("java.util"), but I get jlink failed with: Error: Module java.util.logging not found for both cases during gradle packageAppImage

@olonho
Copy link
Contributor

olonho commented Feb 15, 2021

https://docs.oracle.com/javase/9/docs/api/module-overview-frame.html module name is java.logging.

@mitch3ls
Copy link
Author

Thank you so much, that worked! It would be great if that could be incorporated into the documentation somehow 👍

mitch3ls added a commit to mitch3ls/jb-compose-issue-394-demo that referenced this issue Feb 16, 2021
MatkovIvan pushed a commit to MatkovIvan/compose-multiplatform that referenced this issue May 10, 2023
@okushnikov
Copy link
Collaborator

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

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

No branches or pull requests

5 participants