Replacing default FileSystemProvider
Michael Hall
mik3hall at gmail.com
Sun Mar 28 04:02:16 UTC 2021
> On Mar 25, 2021, at 9:25 PM, Michael Hall <mik3hall at gmail.com> wrote:
>
> Caused by: java.lang.ClassCastException: class us.hall.trz.osx.MacPath cannot be cast to class sun.nio.fs.UnixPath (us.hall.trz.osx.MacPath is in unnamed module of loader 'app'; sun.nio.fs.UnixPath is in module java.base of loader 'bootstrap')
> at java.base/sun.nio.fs.UnixPath.compareTo(Unknown Source)
Maybe understand this a little bit.
My application REST API’s using Apache HttpClient are not working.
ava.lang.NoClassDefFoundError: Could not initialize class sun.security.ssl.SSLContextImpl$CustomizedTLSContext
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Unknown Source)
at java.base/java.security.Provider$Service.getImplClass(Unknown Source)
at java.base/java.security.Provider$Service.newInstance(Unknown Source)
Debugging messages show…
2021-03-27 22:34:16.849 HalfPipe[5244:239243] MacPath: unlimited
2021-03-27 22:34:16.849 HalfPipe[5244:239243] MacPath: /Users/mjh/HalfPipe/HalfPipe_jpkg/outputdir/HalfPipe.app/Contents/runtime/Contents/Home/conf/security/policy
2021-03-27 22:34:16.849 HalfPipe[5244:239243] MacPath: /Users/mjh/HalfPipe/HalfPipe_jpkg/outputdir/HalfPipe.app/Contents/runtime/Contents/Home/conf/security/policy
2021-03-27 22:34:16.850 HalfPipe[5244:239243] MacPath: /Users/mjh/HalfPipe/HalfPipe_jpkg/outputdir/HalfPipe.app/Contents/runtime/Contents/Home/conf/security/policy/unlimited
2021-03-27 22:34:16.850 HalfPipe[5244:239243] MacPath: /Users/mjh/HalfPipe/HalfPipe_jpkg/outputdir/HalfPipe.app/Contents/runtime/Contents/Home/conf/security/policy/unlimited
2021-03-27 22:34:16.854 HalfPipe[5244:239243] java.lang.Exception: UnixPath
…that I am trying to access security files in the runtime conf directory just before the error.
This is very similar to this StackOverflow I found…
Apache HttpClient failing with Java 11 on macOS
https://stackoverflow.com/questions/61185934/apache-httpclient-failing-with-java-11-on-macos <https://stackoverflow.com/questions/61185934/apache-httpclient-failing-with-java-11-on-macos>
Getting a nearly identical error when these files couldn’t be found.
They are there for me but I think with my FileSystemProvider I instead get the ClassCastException from the Unix provider. I don’t get enough of the stack trace to know why I end up with a Unix provider. Maybe I could come up with a simple test case where I’d get the full error.
UnixPath for the source I have does…
@Override
public int compareTo(Path other) {
int len1 = path.length;
int len2 = ((UnixPath) other).path.length;
int n = Math.min(len1, len2);
byte v1[] = path;
byte v2[] = ((UnixPath) other).path;
Code that casts like this if it is reached will never work with an overridden DefaultFileSystemProvider instance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20210327/4d4cda0e/attachment-0001.htm>
More information about the nio-dev
mailing list