I am working on an application server that uses worker JVMs to do various things.
The worker jvms are started using -cp switch and specify JAR files that contain vendor libraries and other important functionality.
I have a really interesting problem where the jar files CLASSES load and execute code properly but any time they attempt to access a RESOURCE within the jar file (specifically with getResourceAsStream() method) then it blows up claiming it can't find it. I have verified that these resources are definitely there in the JARs that are being loaded and in fact if I manipulate the JAR to locate the resource externally, it works. The problem is these are all proprietary libraries and don't come with source so I'm crippled in that I have to do everything through decompiling and method entry breakpoints.
Perhaps the strangest part is these libraries have been unchanged for many months and have been working in other (including production) app servers.
They are on JRE 1.6.0_17
So my question is
- Why would a JVM with -cp entries be able to load CLASSES from the jar but not RESOURCES
- Does anything in this realm change from JRE 1.6.0_06 to 1.6.0_17 (this has changed recently)
To clarify, in the JAR structure these resources are on the root of the jar ie:
resource.prop
META-INF/Manifest
package/package/class.class
the JAR itself is clearly on the classpath as it is loaded. However all of the following resolve to NULL (yes this is driving me nuts so I did actually try all 3):
Jarclass.getClassLoader().getResourceAsStream("./resource.prop");
Jarclass.getClassLoader().getResourceAsStream("/resource.prop");
Jarclass.getClassLoader().getResourceAsStream("resource.prop");
This looks similar to Can't access resource in a JAR on all computers but there is no resolution to that question.