[FIXED HUDSON-4820] Fallback gracefully if JNA is not available.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@24103 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2009-11-25 23:21:17 +00:00
1 parent 49b47dc41e
commit cf22345820
4 files changed
+54 -34

No files matched your search

+30 -29
View File
@@ -130,35 +130,36 @@ public final class WebAppMain implements ServletContextListener {
return;
}
// make sure JNA works. this can fail if
// - platform is unsupported
// - JNA is already loaded in another classloader
// see http://wiki.hudson-ci.org/display/HUDSON/JNA+is+already+loaded
// TODO: or shall we instead modify Hudson to work gracefully without JNA?
try {
/*
java.lang.UnsatisfiedLinkError: Native Library /builds/apps/glassfish/domains/hudson-domain/generated/jsp/j2ee-modules/hudson-1.309/loader/com/sun/jna/sunos-sparc/libjnidispatch.so already loaded in another classloader
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1743)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1674)
at java.lang.Runtime.load0(Runtime.java:770)
at java.lang.System.load(System.java:1005)
at com.sun.jna.Native.loadNativeLibraryFromJar(Native.java:746)
at com.sun.jna.Native.loadNativeLibrary(Native.java:680)
at com.sun.jna.Native.<clinit>(Native.java:108)
at hudson.util.jna.GNUCLibrary.<clinit>(GNUCLibrary.java:86)
at hudson.Util.createSymlink(Util.java:970)
at hudson.model.Run.run(Run.java:1174)
at hudson.matrix.MatrixBuild.run(MatrixBuild.java:149)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:123)
*/
String.valueOf(Native.POINTER_SIZE); // this meaningless operation forces the classloading and initialization
} catch (LinkageError e) {
if (e.getMessage().contains("another classloader"))
context.setAttribute(APP,new JNADoublyLoaded(e));
else
context.setAttribute(APP,new HudsonFailedToLoad(e));
}
// JNA is no longer a hard requirement. It's just nice to have. See HUDSON-4820 for more context.
// // make sure JNA works. this can fail if
// // - platform is unsupported
// // - JNA is already loaded in another classloader
// // see http://wiki.hudson-ci.org/display/HUDSON/JNA+is+already+loaded
// // TODO: or shall we instead modify Hudson to work gracefully without JNA?
// try {
// /*
// java.lang.UnsatisfiedLinkError: Native Library /builds/apps/glassfish/domains/hudson-domain/generated/jsp/j2ee-modules/hudson-1.309/loader/com/sun/jna/sunos-sparc/libjnidispatch.so already loaded in another classloader
// at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1743)
// at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1674)
// at java.lang.Runtime.load0(Runtime.java:770)
// at java.lang.System.load(System.java:1005)
// at com.sun.jna.Native.loadNativeLibraryFromJar(Native.java:746)
// at com.sun.jna.Native.loadNativeLibrary(Native.java:680)
// at com.sun.jna.Native.<clinit>(Native.java:108)
// at hudson.util.jna.GNUCLibrary.<clinit>(GNUCLibrary.java:86)
// at hudson.Util.createSymlink(Util.java:970)
// at hudson.model.Run.run(Run.java:1174)
// at hudson.matrix.MatrixBuild.run(MatrixBuild.java:149)
// at hudson.model.ResourceController.execute(ResourceController.java:88)
// at hudson.model.Executor.run(Executor.java:123)
// */
// String.valueOf(Native.POINTER_SIZE); // this meaningless operation forces the classloading and initialization
// } catch (LinkageError e) {
// if (e.getMessage().contains("another classloader"))
// context.setAttribute(APP,new JNADoublyLoaded(e));
// else
// context.setAttribute(APP,new HudsonFailedToLoad(e));
// }
// make sure this is servlet 2.4 container or above
try {