Skip to content

Dependencies are working only with jdk8 #239

Description

@neworld

Using >8 JDK everything is working except dependency resolution:

[kscript] Resolving dependencies...
[kscript]     Resolving "org.openjsse:openjsse:1.1.0"...Exception in thread "main" java.lang.NoClassDefFoundError: org/ietf/jgss/GSSException
	at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.<clinit>(NettyAsyncHttpProvider.java:177)
	at org.sonatype.aether.connector.async.AsyncRepositoryConnector.getDefaultProvider(AsyncRepositoryConnector.java:246)
	at org.sonatype.aether.connector.async.AsyncRepositoryConnector.getProvider(AsyncRepositoryConnector.java:241)
	at org.sonatype.aether.connector.async.AsyncRepositoryConnector.<init>(AsyncRepositoryConnector.java:154)
	at org.sonatype.aether.connector.async.AsyncRepositoryConnectorFactory.newInstance(AsyncRepositoryConnectorFactory.java:106)
	at org.sonatype.aether.impl.internal.DefaultRemoteRepositoryManager.getRepositoryConnector(DefaultRemoteRepositoryManager.java:346)
	at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:453)
	at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
	at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193)
	at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:281)
	at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186)
	at org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:191)
	at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:333)
	at com.jcabi.aether.Aether.fetch(Aether.java:228)
	at com.jcabi.aether.Aether.resolve_aroundBody2(Aether.java:180)
	at com.jcabi.aether.Aether$AjcClosure3.run(Aether.java:1)
	at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
	at com.jcabi.aspects.aj.MethodLogger.wrap(MethodLogger.java:208)
	at com.jcabi.aspects.aj.MethodLogger.ajc$inlineAccessMethod$com_jcabi_aspects_aj_MethodLogger$com_jcabi_aspects_aj_MethodLogger$wrap(MethodLogger.java:1)
	at com.jcabi.aspects.aj.MethodLogger.wrapClass(MethodLogger.java:136)
	at com.jcabi.aether.Aether.resolve(Aether.java:177)
	at com.jcabi.aether.Aether.resolve_aroundBody0(Aether.java:163)
	at com.jcabi.aether.Aether$AjcClosure1.run(Aether.java:1)
	at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
	at com.jcabi.aspects.aj.MethodLogger.wrap(MethodLogger.java:208)
	at com.jcabi.aspects.aj.MethodLogger.ajc$inlineAccessMethod$com_jcabi_aspects_aj_MethodLogger$com_jcabi_aspects_aj_MethodLogger$wrap(MethodLogger.java:1)
	at com.jcabi.aspects.aj.MethodLogger.wrapClass(MethodLogger.java:136)
	at com.jcabi.aether.Aether.resolve(Aether.java:156)
	at kscript.app.DependencyUtilKt.resolveDependenciesViaAether(DependencyUtil.kt:86)
	at kscript.app.DependencyUtilKt.resolveDependencies(DependencyUtil.kt:53)
	at kscript.app.KscriptKt.main(Kscript.kt:158)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at org.jetbrains.kotlin.runner.AbstractRunner.run(runners.kt:61)
	at org.jetbrains.kotlin.runner.Main.run(Main.kt:110)
	at org.jetbrains.kotlin.runner.Main.main(Main.kt:120)
Caused by: java.lang.ClassNotFoundException: org.ietf.jgss.GSSException
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:436)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	... 38 more

A first bug was reported #233

jdk8 is 5 years old and some people prefer to use newer versions of jdk.

Activity

  1. holgerbrandl commented on Sep 2, 2019

    @holgerbrandl
    Collaborator

    Duplicate of #239

  2. neworld commented on Sep 2, 2019

    @neworld
    Author

    Recursive duplicated issue :). @holgerbrandl, could you specify duplicated issue, please? I can find nothing similar by myself and I would like to follow it.

  3. holgerbrandl commented on Sep 2, 2019

    @holgerbrandl
    Collaborator

    Let's blame the early Monday morning. :-)

  4. holgerbrandl commented on Sep 11, 2019

    @holgerbrandl
    Collaborator

    Let's test this with the recent dev builds from here - https://bintray.com/kotlin/kotlin-dev/kotlin because it seems related to https://youtrack.jetbrains.com/issue/KT-26624

  5. cnusp commented on Jan 20, 2020

    @cnusp

    Any news on that problem? It still does not work (Java 11).

  6. holgerbrandl commented on Jan 20, 2020

    @holgerbrandl
    Collaborator

    This week is super packed on my end, but I'll try to look into at the weekend. It goes without saying that PRs are welcome.

  7. qmg-dhamilton commented on Jan 20, 2020

    @qmg-dhamilton

    I wanted to retest it on 1.3.61 to see if KT-26624 fixes it, however for some reason KScript reports using Kotlin 1.2.41 (via KotlinVersion.CURRENT) even though that version is not (AFAICS) installed on my computer.

    Is that version set at compile-time for KScript and immutable for anyone running it?

  8. qmg-dhamilton commented on Jan 21, 2020

    @qmg-dhamilton

    Sorry - pls ignore. Ironically one of the (already resolved) script dependencies was pulling in the old version of kotlin-stdlib. (So, unsurprisingly I guess KotlinVersion.CURRENT is defined in kotlin-stdlib).

    At the moment, it doesn't appear that 1.3.61 resolves the issue.

    Is there any way of confirming which version of kotlinc is being used by kscript?

  9. holgerbrandl commented on Jan 21, 2020

    @holgerbrandl
    Collaborator

    Sure, which kotlinc. Under the hood, it's just creating a subprocess which is inferring the kotlinc to be used from your PATH. Afaik the only way to overrule this behaviour is declaring a KOTLIN_HOME variable in the shell environment where kscript is launched.

    We were discussing if we should rather use the compiler API (see #102), but there were pros and cons but imho no major functional advantage, so the PR is still unresolved.

  10. qmg-dhamilton commented on Jan 22, 2020

    @qmg-dhamilton

    Thanks. Yes, I can confirm that Java 11 still causes the NoClassDefFoundError for org/ietf/jgss/GSSException on Kotlin 1.3.61

    As an alternative approach, I attempted to include the java.security.jgss module via the approaches included in https://github.com/holgerbrandl/kscript/blob/master/examples/java_module_example.kts but none of them solved the issue.

  11. geoand commented on Jan 25, 2020

    @geoand

    Hi,

    I am also seeing the exact same issue (java.lang.NoClassDefFoundError: org/ietf/jgss/GSSException) when using kscript with dependencies in a Github Actions pipeline that runs with Java 11 (the Java 8 version of the pipeline works just fine).

  12. holgerbrandl commented on Jan 29, 2020

    @holgerbrandl
    Collaborator

    @qmg-dhamilton I think the problem is that somehow the GSSException class is needed by kscript itself when resolving dependencies via jcabi. Dependencies in a user script such as the java_module_example are unrelated to that issues.

    I've filed a ticket in jcabi-aether to narrow down the root cause of the problem. See jcabi/jcabi-aether#105

    Feel welcome if you have ideas about how to fix this annoying issue.

  13. 30 remaining items

  14. jakubgwozdz commented on Aug 18, 2020

    @jakubgwozdz

    glad to hear this issue may soon be resolved now that 1.4 is out. I'm itching to run kscript as primary scripting language to perform db calls. And for that I need it to be able to fetch say mysql:mysql-connector-java:8.0.19, and to finally be able to run with jdk9+ modules like -Xadd-modules=java.sql

  15. eschlenz commented on Aug 20, 2020

    @eschlenz

    @holgerbrandl With 1.4 being officially released, any updates on this?

  16. holgerbrandl commented on Aug 25, 2020

    @holgerbrandl
    Collaborator

    @ligee Are there examples and/or documentation about how to use the new resolver API?

  17. CLOVIS-AI commented on Oct 5, 2020

    @CLOVIS-AI

    Those official examples are a bit of a pain to use, we need to download a JAR with the annotations, etc. It'd be nice if this project could fix these issues and make this convenient :)

  18. ligee commented on Oct 6, 2020

    @ligee

    @CLOVIS-AI if you mean examples in the https://github.com/Kotlin/kotlin-script-examples repo - I'm not sure I understand what you mean. If you have some particular issues, please report them on the project page.

  19. CLOVIS-AI commented on Oct 6, 2020

    @CLOVIS-AI

    Sorry, I meant that the official Kotlin way of using scripts is a bit weird to implement and undocumented, and I really like kscript's system since it's much more straightforward, but it also doesn't work currently :/

  20. added a commit that references this issue on Nov 8, 2020
  21. holgerbrandl commented on Nov 8, 2020

    @holgerbrandl
    Collaborator

    I've changed the dependency resolver to use the provided api in kotlin 1.4 instead of aether in branch https://github.com/holgerbrandl/kscript/tree/fix239

    There are 2 failing tests, which I'd love to address before rolling out a new release:

    1. It does not seem to resolve pom dependencies, see test https://github.com/holgerbrandl/kscript/blob/master/test/resources/depends_on_with_type.kts

    @ligee are these types of dependencies covered by the current implementation?

    @ligee How is authentification supported? There don't seem to be any user/pw arguments in RepositoryCoordinates nor could I find an example for authentification yet.

  22. ligee commented on Nov 10, 2020

    @ligee

    @holgerbrandl, here is a test for a pom dependency that seems working to me - https://github.com/JetBrains/kotlin/blob/master/libraries/scripting/dependencies-maven/test/kotlin/script/experimental/test/MavenResolverTest.kt#L74, and test for the version range is around too. There is no specific test for the dynamic version, but the coordinates are parsed by aether lib, so I suppose it should work the same way as for cli mvn tool.

    As of authentication - you can try to use a subclass of RepositoryCoordinates - MavenRepositoryCoordinates (https://github.com/JetBrains/kotlin/blob/master/libraries/scripting/dependencies-maven/src/kotlin/script/experimental/dependencies/maven/MavenDependenciesResolver.kt#L27) which have auth fields (only plain text creds are supported at the moment). There is no corresponding test in the kotlin repo, but I have been told that it works for the https://github.com/Kotlin/kotlin-jupyter project, please have a look.

  23. holgerbrandl commented on Nov 10, 2020

    @holgerbrandl
    Collaborator

    Finally fixed in v3.0 :-)

    Thank you all for your support and patience. Special thanks to @ligee for your continued great help and guidance.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions