Skip to main content

webstart nativelib problems

6 replies [Last post]
rantfoil
Offline
Joined: 2005-10-17

I'm having trouble getting webstart to work with JDIC. I'm trying to use the nativelibs resource function of jnlp to load JDIC, but it keeps returning this error:

org.jdesktop.jdic.init.JdicInitException: java.lang.NullPointerException
at org.jdesktop.jdic.init.JdicManager.initShareNative(Unknown Source)
at org.jdesktop.jdic.desktop.internal.ServiceManager.(Unknown Source)
at org.jdesktop.jdic.desktop.Desktop.mail(Unknown Source)
at com.palantir.hedgehog.ui.UIFunctions.jdicEmailFeedback(UIFunctions.java:1801)
at com.palantir.hedgehog.ui.UIFunctions$11.run(UIFunctions.java:1986)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at java.io.File.(Unknown Source)
at org.jdesktop.jdic.init.JdicManager.caculateNativeLibPathBySunJWS(Unknown Source)
... 6 more
Exception in thread "Thread-145" java.lang.NoClassDefFoundError: org/jdesktop/jdic/desktop/internal/impl/ServiceManagerStub
at org.jdesktop.jdic.desktop.internal.ServiceManager.getService(Unknown Source)
at org.jdesktop.jdic.desktop.Desktop.mail(Unknown Source)
at com.palantir.hedgehog.ui.UIFunctions.jdicEmailFeedback(UIFunctions.java:1801)
at com.palantir.hedgehog.ui.UIFunctions$11.run(UIFunctions.java:1986)
at java.lang.Thread.run(Unknown Source)

Basically it seems like it can't find windows\jdic_stub.jar

My jnlp file has the following relevant sections regarding the native libs. I create tray.dll.jar and jdic.dll.jar and sign them with my cert.

Anyone else have problems with this? I have verified the paths and they do point to the correct locations. I'm kind of at a loss for what a next step would be.

Thanks!
-g

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
npomfret
Offline
Joined: 2006-11-30

Having the problems as you.

Can you tell me, should the stub be referenced as a native lib or just a normal jar?

And do you need to put the urls into the manifest as described on that page? this seems very odd as it would prevent you from deploying that jar to more than one server.

madroadie
Offline
Joined: 2006-04-20

I've seen problems with the new Java6 JRE's 1.6.0_10 and up. Sun has changed the method access to JNLPClassLoader.findLibrary(String) to protected. I have fixed this issue by using introspection. Here is the code, you will need to rebuild the jdic.jar

private String caculateNativeLibPathBySunJWS() throws IOException, JdicInitException
{
String jdicLibFolder = null;
ClassLoader cl = this.getClass().getClassLoader();
if (cl instanceof JNLPClassLoader)
{
JNLPClassLoader jnlpCl = (JNLPClassLoader) cl;
try
{
// Needed to Support JRE 1.6_10 and Up because the changed the class signature for JNLPClassLoader
Method findLibraryMethod = jnlpCl.getClass().getDeclaredMethod("findLibrary", new Class[] { String.class });

// Remove the protected accesss checking
findLibraryMethod.setAccessible(true);

Object[] paramters = new Object[]{new String("jdic")};
String jdicLibURL = (String)findLibraryMethod.invoke(jnlpCl, paramters);
//String jdicLibURL = jnlpCl.findLibrary("jdic");// get lib
// path by
// classloder
jdicLibFolder = (new File(jdicLibURL)).getParentFile().getCanonicalPath();
WebBrowserUtil.trace("running path " + nativeLibPath);
isShareNativeInitialized = true;
}
catch (IllegalArgumentException e)
{
throw new JdicInitException(e);
}
catch (IllegalAccessException e)
{
throw new JdicInitException(e);
}
catch (InvocationTargetException e)
{
throw new JdicInitException(e);
}
catch (NoSuchMethodException e)
{
throw new JdicInitException(e);
}
}
else
{
// only run well for sun jre
throw new JdicInitException(

"Unexpected ClassLoader for webstart, only com.sun.jnlp.JNLPClassLoader is supported.");
}
return jdicLibFolder;
}

dhennig
Offline
Joined: 2006-08-24

I search the whole jdic-0.9.5-src directory but found no methode called "caculateNativeLibPathBySunJWS".

Can you please tell me, where do I have to change this?

davidson1
Offline
Joined: 2003-06-25

I filed JDIC issue #537 and committed a fix to JdicManager (setAccessible(true)):

RCS file: /cvs/jdic/src/jdic/src/share/classes/org/jdesktop/jdic/init/JdicManager.java,v
retrieving revision 1.30
diff -r1.30 JdicManager.java
295a296
> findLibMethod.setAccessible(true);

rantfoil
Offline
Joined: 2005-10-17

ended up upgrading to the latest version of JDIC that now only has jdic.jar. created a jdic_native.jar as per instructions https://jdic.dev.java.net/documentation/deployment.html.

Then I just drop jdic.jar and jdic_native.jar in as a native lib in my jnlp file, and everything works. suh-weeet.

rantfoil
Offline
Joined: 2005-10-17

hmm.. no takers huh?

I think the broken code is in here:

private String caculateNativeLibPathBySunJWS() throws IOException,
JdicInitException
{
String jdicLibFolder = null;
ClassLoader cl = this.getClass().getClassLoader();
if (cl instanceof JNLPClassLoader) {
JNLPClassLoader jnlpCl = (JNLPClassLoader) cl;
String jdicLibURL = jnlpCl.findLibrary("jdic");//get lib path by classloder
[b] jdicLibFolder = (new File(jdicLibURL)).getParentFile().getCanonicalPath();
WebBrowserUtil.trace("running path " + nativeLibPath);
[/b] isShareNativeInitialized = true;
} else {
// only run well for sun jre
throw new JdicInitException(
"Unexpected ClassLoader for webstart, only com.sun.jnlp.JNLPClassLoader is supported.");
}
return jdicLibFolder;
}

I think jdicLibURL is being returned from the findLibrary(...) call as null, which results in a null string being passed into the File constructor.

How exactly does findLibrary("jdic") work? Does it try to find jdic.jar? Or is it something to do with the manifest?