eclipse-jdt / eclipse.jdt.debug

Eclipse Public License 2.0
16 stars 46 forks source link

Source Lookup: java.lang.IllegalArgumentException: URI is not hierarchical #330

Closed Horcrux7 closed 10 months ago

Horcrux7 commented 10 months ago

After updating from Eclipse 2023-06 to 2023-09 I was not able to lookup sources from other projects. In the error log you can see the follow stacktrace:

!ENTRY org.eclipse.debug.core 4 2 2023-10-24 13:21:49.059
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.debug.core".
!STACK 0
java.lang.IllegalArgumentException: URI is not hierarchical
    at java.base/java.io.File.<init>(File.java:420)
    at org.eclipse.jdt.internal.launching.sourcelookup.advanced.JDIHelpers.getClassesLocation(JDIHelpers.java:74)
    at org.eclipse.jdt.launching.sourcelookup.advanced.AdvancedSourceLookupParticipant.getSourceContainer(AdvancedSourceLookupParticipant.java:88)
    at org.eclipse.jdt.launching.sourcelookup.advanced.AdvancedSourceLookupParticipant.findSourceElements(AdvancedSourceLookupParticipant.java:72)
    at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector$SourceLookupQuery.run(AbstractSourceLookupDirector.java:138)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector.doSourceLookup(AbstractSourceLookupDirector.java:473)
    at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector.getSourceElement_aroundBody0(AbstractSourceLookupDirector.java:714)
    at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector$AjcClosure1.run(AbstractSourceLookupDirector.java:1)
    at org.jetbrains.kotlin.aspects.debug.core.KotlinSourceLookupAspect.ajc$around$org_jetbrains_kotlin_aspects_debug_core_KotlinSourceLookupAspect$1$7ab8b34dproceed(KotlinSourceLookupAspect.aj:16)
    at org.jetbrains.kotlin.aspects.debug.core.KotlinSourceLookupAspect.ajc$around$org_jetbrains_kotlin_aspects_debug_core_KotlinSourceLookupAspect$1$7ab8b34d(KotlinSourceLookupAspect.aj:17)
    at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector.getSourceElement(AbstractSourceLookupDirector.java:714)
    at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility.lookup(SourceLookupFacility.java:303)
    at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility$SourceLookupTask.run(SourceLookupFacility.java:752)
    at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility$SourceLookupJob.run(SourceLookupFacility.java:690)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

!ENTRY org.eclipse.debug.core 4 125 2023-10-24 13:21:49.059
!MESSAGE Error logged from Debug Core: 
!STACK 0
java.lang.IllegalArgumentException: URI is not hierarchical
    at java.base/java.io.File.<init>(File.java:420)
    at org.eclipse.jdt.internal.launching.sourcelookup.advanced.JDIHelpers.getClassesLocation(JDIHelpers.java:74)
    at org.eclipse.jdt.launching.sourcelookup.advanced.AdvancedSourceLookupParticipant.getSourceContainer(AdvancedSourceLookupParticipant.java:88)
    at org.eclipse.jdt.launching.sourcelookup.advanced.AdvancedSourceLookupParticipant.findSourceElements(AdvancedSourceLookupParticipant.java:72)
    at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector$SourceLookupQuery.run(AbstractSourceLookupDirector.java:138)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector.doSourceLookup(AbstractSourceLookupDirector.java:473)
    at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector.getSourceElement_aroundBody0(AbstractSourceLookupDirector.java:714)
    at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector$AjcClosure1.run(AbstractSourceLookupDirector.java:1)
    at org.jetbrains.kotlin.aspects.debug.core.KotlinSourceLookupAspect.ajc$around$org_jetbrains_kotlin_aspects_debug_core_KotlinSourceLookupAspect$1$7ab8b34dproceed(KotlinSourceLookupAspect.aj:16)
    at org.jetbrains.kotlin.aspects.debug.core.KotlinSourceLookupAspect.ajc$around$org_jetbrains_kotlin_aspects_debug_core_KotlinSourceLookupAspect$1$7ab8b34d(KotlinSourceLookupAspect.aj:17)
    at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector.getSourceElement(AbstractSourceLookupDirector.java:714)
    at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility.lookup(SourceLookupFacility.java:303)
    at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility$SourceLookupTask.run(SourceLookupFacility.java:752)
    at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility$SourceLookupJob.run(SourceLookupFacility.java:690)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

The classes are loaded via custom classloader. The sources contains only the "Default" and other projects.

The problem was reproduced on two system from two developers. One on Windows 10 the other on Windows 11.

I have attched the complet log from Eclipse start until the erorr occur eclipse.log

iloveeclipse commented 10 months ago

Must be a regression from 535f18949761fae5f0bc194802ec0c603d3ddb27, @jukzi : FYI.

@Horcrux7: I see there is org.jetbrains.kotlin.aspects.debug.core.KotlinSourceLookupAspect in the stack, so you probably have some kotlin project there? Please consider to report this issue also to jetbrains, not sure what exactly they are trying to supply to the source lookup.

jukzi commented 10 months ago

can you please report (debug?) which URI is used?

iloveeclipse commented 10 months ago

can you please report (debug?) which URI is used?

I would propose we log that so we don't need to guess in the future, I will push a PR.

Horcrux7 commented 10 months ago

can you please report (debug?) which URI is used?

How can I do this?

Horcrux7 commented 10 months ago

@iloveeclipse After I uninstall the Kotlin plugin the stack look like follow. Sounds not like a problem of Kotlin.

java.lang.IllegalArgumentException: URI is not hierarchical
    at java.base/java.io.File.<init>(File.java:420)
    at org.eclipse.jdt.internal.launching.sourcelookup.advanced.JDIHelpers.getClassesLocation(JDIHelpers.java:74)
    at org.eclipse.jdt.launching.sourcelookup.advanced.AdvancedSourceLookupParticipant.getSourceContainer(AdvancedSourceLookupParticipant.java:88)
    at org.eclipse.jdt.launching.sourcelookup.advanced.AdvancedSourceLookupParticipant.findSourceElements(AdvancedSourceLookupParticipant.java:72)
    at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector$SourceLookupQuery.run(AbstractSourceLookupDirector.java:138)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector.doSourceLookup(AbstractSourceLookupDirector.java:473)
    at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector.getSourceElement(AbstractSourceLookupDirector.java:714)
    at org.eclipse.jdt.internal.debug.core.JavaDebugUtils.doSourceLookup(JavaDebugUtils.java:399)
    at org.eclipse.jdt.internal.debug.core.JavaDebugUtils.resolveSourceElement(JavaDebugUtils.java:393)
    at org.eclipse.jdt.internal.debug.core.JavaDebugUtils.resolveSourceElement(JavaDebugUtils.java:360)
    at org.eclipse.jdt.internal.debug.core.JavaDebugUtils.resolveJavaProject(JavaDebugUtils.java:415)
    at org.eclipse.jdt.internal.debug.ui.JavaWatchExpressionDelegate$EvaluationRunnable.run(JavaWatchExpressionDelegate.java:117)
    at org.eclipse.jdt.internal.debug.core.model.JDIThread$ThreadJob.run(JDIThread.java:3481)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
jukzi commented 10 months ago

How can I do this?

hopefully you get an I-Build next days which logs more info

iloveeclipse commented 10 months ago

After I uninstall the Kotlin plugin the stack look like follow. Sounds not like a problem of Kotlin.

Thanks. We will have tomorrow a nightly build that would add logging which URL makes trouble here. It would be nice if you could try with it. The build will be available tomorrow at https://download.eclipse.org/eclipse/downloads/

iloveeclipse commented 10 months ago

Just wondering if any of the related projects is located on some Windows NFS share? I vaguely remember we had troubles with Windows NFS URLs in the past.

Horcrux7 commented 10 months ago

Just wondering if any of the related projects is located on some Windows NFS share? I vaguely remember we had troubles with Windows NFS URLs in the past.

No, I think this are only projects in the workspace. Also parallel folders. I will look tomorrow with the new build.

Horcrux7 commented 10 months ago

After an Update to https://download.eclipse.org/eclipse/updates/4.30-I-builds/I20231024-1800/ it is working now. In the log i can see:

!ENTRY org.eclipse.jdt.launching 4 0 2023-10-25 07:53:41.757
!MESSAGE Unable to resolve class location from: 'file:C:/workspace_trunk/Security/bin/main/'
!STACK 0
java.lang.IllegalArgumentException: URI is not hierarchical
    at java.base/java.io.File.<init>(File.java:420)
    at org.eclipse.jdt.internal.launching.sourcelookup.advanced.JDIHelpers.getClassesLocation(JDIHelpers.java:78)
    at org.eclipse.jdt.launching.sourcelookup.advanced.AdvancedSourceLookupParticipant.getSourceContainer(AdvancedSourceLookupParticipant.java:88)
    at org.eclipse.jdt.launching.sourcelookup.advanced.AdvancedSourceLookupParticipant.findSourceElements(AdvancedSourceLookupParticipant.java:72)
    at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector$SourceLookupQuery.run(AbstractSourceLookupDirector.java:138)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector.doSourceLookup(AbstractSourceLookupDirector.java:473)
    at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector.getSourceElement(AbstractSourceLookupDirector.java:714)
    at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility.lookup(SourceLookupFacility.java:303)
    at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility$SourceLookupTask.run(SourceLookupFacility.java:752)
    at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility$SourceLookupJob.run(SourceLookupFacility.java:690)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

Where C:/workspace_trunk is my workspace directory and Security is the project in which I have set the breakpoint. bin/mainis the correct output directory set from Gradle for the src folder. I hope this help.

jukzi commented 10 months ago

An accepted URI would be file:/C:/workspace_trunk/Security/bin/main/ instead of file:C:/workspace_trunk/Security/bin/main/ i.e. slash behind "file:" is missing.

i'll find a solution.

jukzi commented 10 months ago

which JDK is used for runnning Eclipse, and which for launching the debugee?

Horcrux7 commented 10 months ago

which JDK is used for runnning Eclipse, and which for launching the debugee?

Eclipse is running with the bundled Java VM. From the eclipse.ini

-vm
C:\eclipse\eclipse\\plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.8.v20230831-1047/jre/bin\server\jvm.dll
eclipse.vm=C:\eclipse\eclipse\\plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.8.v20230831-1047/jre/bin\server\jvm.dll

The launcher run with a Java 11 VM:

openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)

If I use Java 17 then it is the same:

openjdk version "17.0.2" 2022-01-18
OpenJDK Runtime Environment Temurin-17.0.2+8 (build 17.0.2+8)
OpenJDK 64-Bit Server VM Temurin-17.0.2+8 (build 17.0.2+8, mixed mode, sharing)
Horcrux7 commented 10 months ago

The bad path without the slash before the drive letter come form our custom classloader. This is a URLClassLoader and the URLs that we pass does not have the slash. If I add this then the exception in the log does not occur. I will fix this in our code.