lucee.commons.io.res.type.compress.CompressResource cannot be cast to java.lang.Comparable
Description
Environment
Docker image, x64, jre8
Activity
Pothys - MitrahSoft 15 June 2021 at 14:01Edited
I replicated the issue in lucee latest version 5.3.8.184-SNAPSHOT also. While using archive lar mapping, which has an application.cfc with relatively loaded a jar by using javaSettings and try to create java object for any class by using createObject() throws an error like lucee.commons.io.res.type.compress.CompressResource cannot be cast to java.lang.Comparable.
Seems Using relative path for javaSettings throws error.
this.javaSettings = { loadpaths : "/lib" }
and using full path works fine
this.javaSettings = { loadpaths : "D:/test/...../.../lib"}
In archive lar, using a relative path for loadpaths returns path like zip://D:\test........\archive-lar.lar!/lib. Its cause to throws an error.
Stack trace:
lucee.runtime.exp.NativeException: lucee.commons.io.res.type.compress.CompressResource cannot be cast to java.lang.Comparable
at java.util.ComparableTimSort.countRunAndMakeAscending(Unknown Source)
at java.util.ComparableTimSort.sort(Unknown Source)
at java.util.Arrays.sort(Unknown Source)
at lucee.commons.io.res.util.ResourceClassLoader.hash(ResourceClassLoader.java:138)
at lucee.commons.io.res.util.ResourceClassLoader.getCustomResourceClassLoader(ResourceClassLoader.java:109)
at lucee.runtime.PageContextImpl.getResourceClassLoader(PageContextImpl.java:3482)
at lucee.runtime.PageContextImpl.getClassLoader(PageContextImpl.java:3467)
at lucee.runtime.functions.other.JavaProxy.loadClassByPath(JavaProxy.java:126)
at lucee.runtime.functions.other.JavaProxy.loadClass(JavaProxy.java:65)
at lucee.runtime.functions.other.JavaProxy.call(JavaProxy.java:60)
at lucee.runtime.functions.other.CreateObject.doJava(CreateObject.java:140)
at lucee.runtime.functions.other.CreateObject.call(CreateObject.java:62)
at lucee.runtime.functions.other.CreateObject.call(CreateObject.java:49)
at test_cfm$cf.call(/lar/test.cfm:5)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:1031)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:923)
at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:217)
at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:44)
If lib folder has no jar files means its throws error like below:
lucee.runtime.exp.NativeException: resource [zip://D:\test\....\....\archive-lar.lar!/lib] must be a local file
at lucee.commons.io.res.util.ResourceClassLoader.doURL(ResourceClassLoader.java:92)
at lucee.commons.io.res.util.ResourceClassLoader.doURLs(ResourceClassLoader.java:85)
at lucee.commons.io.res.util.ResourceClassLoader.<init>(ResourceClassLoader.java:54)
at lucee.commons.io.res.util.ResourceClassLoader.getCustomResourceClassLoader(ResourceClassLoader.java:116)
at lucee.runtime.PageContextImpl.getResourceClassLoader(PageContextImpl.java:3482)
at lucee.runtime.PageContextImpl.getClassLoader(PageContextImpl.java:3467)
at lucee.runtime.functions.other.JavaProxy.loadClassByPath(JavaProxy.java:126)
at lucee.runtime.functions.other.JavaProxy.loadClass(JavaProxy.java:65)
at lucee.runtime.functions.other.JavaProxy.call(JavaProxy.java:60)
at lucee.runtime.functions.other.CreateObject.doJava(CreateObject.java:140)
at lucee.runtime.functions.other.CreateObject.call(CreateObject.java:62)
at lucee.runtime.functions.other.CreateObject.call(CreateObject.java:49)
at test_cfm$cf.call(/lar/test.cfm:5)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:1031)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:923)
at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:217)
at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:44)
Zac Spitzer 26 February 2021 at 10:59
can you include the top of any stack traces, that always helps
Xavier De Cock 26 February 2021 at 10:48
Hello, I'll try to do a minimal test, had the issue in an app once
packaged, Haven't worked on it more, I'll try to take some time next week
to move on that.
Pothys - MitrahSoft 26 February 2021 at 08:14
@Xavier De Cock, If you've any update on this one means, please share it here. Or otherwise, shall we close this ticket?
Pothys - MitrahSoft 27 July 2020 at 12:25
@Xavier De Cock, Any update on this issue? If YES means, let here know. It'll more helpful to improve the status of the ticket.
Details
Assignee
Michael OffnerMichael OffnerReporter
Xavier De CockXavier De CockPriority
NewNew Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Affects versions
Details
Details
Assignee
Reporter
Priority
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Basically, doing this : in a lucee archive
CreateObject("java", "java.util.Properties");
seems to trigger
RessourceClassLoader.hash();
And here the Arrays.sort(resources); seems to trigger the main bug as it requires all resources to be comparable.
on a side note, i'm not certain what the Array.sort() purpose is.