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

[KSP2] NoClassDefFoundError for LZ4Factory when trying KSP2 #1713

Closed
Tracked by #811
ZacSweers opened this issue Feb 3, 2024 · 10 comments
Closed
Tracked by #811

[KSP2] NoClassDefFoundError for LZ4Factory when trying KSP2 #1713

ZacSweers opened this issue Feb 3, 2024 · 10 comments
Assignees
Labels
bug Something isn't working P1 major features or blocking bugs
Milestone

Comments

@ZacSweers
Copy link
Contributor

Repro

Checkout this PR: slackhq/kotlin-cli-util#111

Run ./gradlew check -Pksp.useKSP2=true

This is using 2.0.0-Beta3-1.0.17

Trace

Caused by: java.lang.NoClassDefFoundError: net/jpountz/lz4/LZ4Factory
        at com.intellij.util.CompressionUtil.compressor(CompressionUtil.java:81)
        at com.intellij.util.CompressionUtil.writeCompressedWithoutOriginalBufferLength(CompressionUtil.java:60)
        at com.intellij.util.io.CompressedAppendableFile.compress(CompressedAppendableFile.java:349)
        at com.intellij.util.io.CompressedAppendableFile.saveNextChunkIfNeeded(CompressedAppendableFile.java:314)
        at com.intellij.util.io.CompressedAppendableFile.append(CompressedAppendableFile.java:272)
        at com.intellij.util.io.PersistentHashMapValueStorage$4.write(PersistentHashMapValueStorage.java:222)
        at com.intellij.util.io.DataOutputStream.write(DataOutputStream.java:35)
        at com.intellij.util.io.PersistentHashMapValueStorage.doAppendBytes(PersistentHashMapValueStorage.java:238)
        at com.intellij.util.io.PersistentHashMapValueStorage.appendBytes(PersistentHashMapValueStorage.java:205)
        at com.intellij.util.io.PersistentHashMapValueStorage.appendBytes(PersistentHashMapValueStorage.java:175)
        at com.intellij.util.io.PersistentMapImpl.doPut(PersistentMapImpl.java:380)
        at com.intellij.util.io.PersistentMapImpl.put(PersistentMapImpl.java:360)
        at com.intellij.util.io.PersistentHashMap.put(PersistentHashMap.java:102)
        at com.google.devtools.ksp.PersistentMap.set(PersistentMap.kt:26)
        at com.google.devtools.ksp.IncrementalContextBase.updateCaches$update(IncrementalContextBase.kt:371)
        at com.google.devtools.ksp.IncrementalContextBase.updateCaches(IncrementalContextBase.kt:390)
        at com.google.devtools.ksp.IncrementalContextBase.updateCachesAndOutputs(IncrementalContextBase.kt:473)
        at com.google.devtools.ksp.impl.KotlinSymbolProcessing.execute(KotlinSymbolProcessing.kt:567)
        at com.google.devtools.ksp.impl.KSPLoader$Companion.loadAndRunKSP(KSPLoader.kt:36)
        at com.google.devtools.ksp.impl.KSPLoader.loadAndRunKSP(KSPLoader.kt)

@eygraber
Copy link

eygraber commented Feb 4, 2024

@ZacSweers were you able to find a workaround for this?

@eygraber
Copy link

eygraber commented Feb 4, 2024

Also not sure if you're experiencing this, but I'm only getting this error for Apple targets (ios, watchos, tvos, macos, etc...) even though I'm running on a Linux host.

Update: removing the Apple targets makes the error go away.

@ZacSweers
Copy link
Contributor Author

Not worked around it so far

@eygraber
Copy link

eygraber commented Feb 8, 2024

And now it happens for me even without the Apple targets ☹️

@ting-yuan ting-yuan self-assigned this Feb 8, 2024
@ting-yuan ting-yuan added bug Something isn't working P1 major features or blocking bugs labels Feb 8, 2024
@ting-yuan ting-yuan assigned neetopia and unassigned ting-yuan Feb 17, 2024
@ting-yuan ting-yuan added this to the 2.0 milestone Feb 17, 2024
@ting-yuan
Copy link
Collaborator

Similar to #1665, where some dependencies of KSP2 are not packed properly.

@ting-yuan ting-yuan assigned ting-yuan and unassigned neetopia Feb 26, 2024
@ting-yuan
Copy link
Collaborator

Fixed in #1749 which is available in the nightly build, and will be included in the future 1.0.18 release.

@aftabahmadTW
Copy link

aftabahmadTW commented Mar 8, 2024

@ting-yuan Not sure if this is related but on the latest 1.0.19 for Kotlin Beta04 and with KSP2=true, I get:

[ksp] java.lang.AssertionError: java.lang.ClassNotFoundException: net.jpountz.lz4.LZ4JavaSafeCompressor
Caused by: java.lang.AssertionError: java.lang.ClassNotFoundException: net.jpountz.lz4.LZ4JavaSafeCompressor
	at net.jpountz.lz4.LZ4Factory.instance(LZ4Factory.java:53)
	at net.jpountz.lz4.LZ4Factory.safeInstance(LZ4Factory.java:105)
	at net.jpountz.lz4.LZ4Factory.fastestJavaInstance(LZ4Factory.java:141)
	at com.intellij.util.CompressionUtil.compressor(CompressionUtil.java:81)
	at com.intellij.util.CompressionUtil.writeCompressedWithoutOriginalBufferLength(CompressionUtil.java:60)

@ZacSweers
Copy link
Contributor Author

ZacSweers commented Mar 8, 2024

@li-fcb1899
Copy link

li-fcb1899 commented Mar 20, 2024

@ting-yuan Not sure if this is related but on the latest 1.0.19 for Kotlin Beta04 and with KSP2=true, I get:

[ksp] java.lang.AssertionError: java.lang.ClassNotFoundException: net.jpountz.lz4.LZ4JavaSafeCompressor
Caused by: java.lang.AssertionError: java.lang.ClassNotFoundException: net.jpountz.lz4.LZ4JavaSafeCompressor
	at net.jpountz.lz4.LZ4Factory.instance(LZ4Factory.java:53)
	at net.jpountz.lz4.LZ4Factory.safeInstance(LZ4Factory.java:105)
	at net.jpountz.lz4.LZ4Factory.fastestJavaInstance(LZ4Factory.java:141)
	at com.intellij.util.CompressionUtil.compressor(CompressionUtil.java:81)
	at com.intellij.util.CompressionUtil.writeCompressedWithoutOriginalBufferLength(CompressionUtil.java:60)

also
image

@ting-yuan
Copy link
Collaborator

Should be fixed in #1816.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P1 major features or blocking bugs
Projects
None yet
Development

No branches or pull requests

6 participants