Skip to main content

[JDIC] ClassNotFoundException when loqading service

1 reply [Last post]
Anonymous

Hi all,

I am trying to use jdic-0.9.5 (on windows, currently) to open documents
using Desktop.open(File).
The problem I have, is that as soon as I call that method in our
application started from webstart, I get a ClassNotFoundException. The
stacktrace is:

java.lang.ClassNotFoundException:
org.jdesktop.jdic.desktop.internal.impl.ServiceManagerStub_windows
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.jdesktop.jdic.desktop.internal.ServiceManager.getService(Unknown
Source)
at org.jdesktop.jdic.desktop.Desktop.open(Unknown Source)
[...]

When starting the application as a "normal" java-application I do not
run into this problem.

I made some investigations on this and found that
ClassLoader.getSystemClassLoader().loadClass(String) fails. Currently I
need an explanation for this.

I added some testing code for this:

ClassLoader cl = ClassLoader.getSystemClassLoader();
LOG.error("classloader-class: " + cl.getClass());
LOG.error("direct: " +
org.jdesktop.jdic.desktop.internal.impl.ServiceManagerStub_windows.class);
try
{
Class indirectClass =
ClassLoader.getSystemClassLoader().loadClass("org.jdesktop.jdic.desktop.internal.impl.ServiceManagerStub_windows");
LOG.error("indirect : " + indirectClass.getClass());
}
catch (ClassNotFoundException e)
{
LOG.error("indirect fails", e);
}

which results in the following output:

classloader-class: class sun.misc.Launcher$AppClassLoader
direkt: class
org.jdesktop.jdic.desktop.internal.impl.ServiceManagerStub_windows
indirect fails:
java.lang.ClassNotFoundException:
org.jdesktop.jdic.desktop.internal.impl.ServiceManagerStub_windows
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at de.ebcot.bsctool.Lisa.main(Lisa.java:203)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

So obviously the required class is available, but
ClassLoader.getSystemClassLoader().loadClass(String) is not able to find it.

Is there anybody who can help me on this issue?
Probably it would be easy to write a workaround in ServiceManager like
for example

Class platformClass = null;
if ("windows".equals(JdicManager.getPlatformSuffix()){
platformClass =
org.jdesktop.jdic.desktop.internal.impl.ServiceManagerStub_windows.class;
}else if ...
[...]

but I also am interested in understanding why this is happening when
running in webstart.

thanks in advance,
Philipp

---------------------------------------------------------------------
To unsubscribe, e-mail: jdic-unsubscribe@jdic.dev.java.net
For additional commands, e-mail: jdic-help@jdic.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
stackey83
Offline
Joined: 2009-11-06

Hi

Its been a while since this post but did you ever resolve the issue?

Mark