Why does Java application fail to run on Windows if jar file has L-attribute/reparse point
I'm really hoping that the following rings a bell with someone as we're running out of ideas. Answers or suggestions on how to further diagnose would be much appreciated.
We have a Java app that has been running with no problems for 18 months. It is now moving to a new platform running Windows Server 2019 Standard as a VM. On first install everything runs correctly, but periodically the application fails to start and can then only be fixed by re-copying all the jar files. This is temporary as eventually it fails again.
After a lot of monitoring we noticed that there is a Windows process that periodically sets the "L" file attribute on all the files and also creates reparse data. This should not be an issue but once this has happened, the JVM is unable to start the application. (any Windows-whizzes have an idea on what does this?)
A key point is that the app is started by specifying JPMS parameters such as:
java -p MyApp.jar;MyApp_mods -m mymodule/mypackage.StartGUI
This runs well unit the "L" attribute is set on the jar files and then fails with message:
Error occurred during initialization of boot layer
java.lang.module.FindException: Module format not recognized: MyApp.jar
Renaming MyApp.jar to something else and then copying it back to MyApp.jar fixes the problem as it creates a file without the L attribute and the reparse data (until the process re-applies it)
This behaviour does not just apply to this one operation, but to any where the module system is used such as:
java --list-modules any-jar-in-the-app.jar
Interestingly(!) if we try a simpler, non-modular app and run as:
java -jar MySimpleApp.jar
then the app runs correctly even with the L attribute set.
Clearly we don't fully understand, but it looks as if running via the module system somehow means that files with the L attribute/reparse data cannot be read (?)
We've tried both the OpenJDK hotspot and OpenJ9 JVMs in various versions but with the same result. Any ideas?
fsutil reparsePoint query MyApp.jar
? A reparse point is a filesystem object similar to a symbolic link, but more generally supports filesystem extension. Something is clearly changing the attribute, and the first step to debugging is to figure out what kind of RP is being created. – Jim Garrison Apr 14 at 16:50Reparse Tag Value : 0x9000601a Tag value: Microsoft Tag value: Directory ...followed by 0x172 bytes of binary data that doesn't include any useful text.
I'd assumed this was some kind of file system management. My client (a charity) uses a hosting company and I've asked what this process is and whether it can be selectively disabled. – Grayman Apr 15 at 10:01if (attrs.isRegularFile()) {
. Once the reparse data has been added, isRegularFile() returns false so there is no match and the exception is thrown. For interest, isSymbolicLink() also returns false and isOther() returns true. Under Windows, Files.readAttributes returns an instance of a class that contains a method isReparsePoint() which can be run via reflection and returns true. I'll do some more experiments and report the behaviour. – Grayman Apr 15 at 10:30