After some debugging the issue is a litte bit clearer:
While searching for persistence units the factory tries to load the jar file containing persistence.xml as HttpInputStream.
I think this requires a special treatment when JNLPs DownloadEngine is at work. Here is my workaround:
public static File getLocalCachedFile(URL url) {
Class<?> downloadEngineClass = null;
Method downloadEngineMethod = null;
try {
downloadEngineClass = Class.forName("com.sun.deploy.net.DownloadEngine");
downloadEngineMethod = downloadEngineClass.getMethod("getCachedFile", URL.class, String.class, boolean.class, boolean.class, String.class);
} catch (Throwable e) {
logger.error("getLocalCachedFile dynamic", e);
return null;
}
File f = null;
try {
return (File)downloadEngineMethod.invoke(null, url, null, Boolean.FALSE, Boolean.FALSE, null);
// orig: f = DownloadEngine.getCachedFile(url, null, false, false, null);
} catch (Exception e) {
logger.error("getLocalCachedFile", e);
}
return f;
}
public static boolean isDownloadServiceURL(URL url) {
if (url.getProtocol().startsWith("http")
&& getLocalCachedFile(url) != null)
return true;
return false;
}
The EL code in org.eclipse.persistence.internal.jpa.deployment.ArchiveFacto ryImpl is patched like this:
} else if (JpaTools.isDownloadServiceURL(url)) {
File f = JpaTools.getLocalCachedFile(url);
if (f != null)
result = new JarFileArchive(new JarFile(f));
else
return new URLArchive(url);
} else if (isJarInputStream(url)){
How to deal with this in a clean way?