class loading with "ftp" protocol fails

i can load a class using thefile protocol.

i cannot load the same class withftp

protocol.

this code works correctly:

String path ="/home/ftp/a.jar";

File dir =new File(path);

URL url = dir.toURL();

URL[] url_path =new URL[]{url};

URLClassLoader loader =new URLClassLoader(url_path);

Class c = loader.loadClass("hello");

now, if i change:

URL url = dir.toURL();

to

URL url =new URL("ftp://10.36.0.2/a.jar");

i getClassNotFoundException.

yet, to test the validity of theURL, i type:

ftp://10.36.0.2/a.jar

into a browser. and the file is found correctly.

myguess is that this is some kind of

security issue?

i have no security policy, so how can i disable it

if this is the problem?

thanks

[1144 byte] By [suppona] at [2007-11-27 4:22:32]
# 1
No need to guess, the reason will be there in the stack trace.
ejpa at 2007-7-12 9:29:53 > top of Java-index,Core,Core APIs...
# 2

i found it.

on the Linux machine i'm testing on, it seems that

the search path leads to using:

/usr/kerberos/bin/ftp

i am sorry for not checking this.

and this seems to make

URL url = new URL("ftp://10.32.0.5/a.jar");

fail because of some

encryption that kerberos ftp tries.

so, i wonder if there is any way Java can force the

use of a simple (ie. non-kerberos) ftp binary in a

platform independent way?

does not seem possible.

suppona at 2007-7-12 9:29:53 > top of Java-index,Core,Core APIs...
# 3
It's not up to Java, it's up to the FTP host. You can probably control all that at the Linux end by reconfiguring FTP, don't ask me how. I would try using more of a path than just /a.jar, for a start.
ejpa at 2007-7-12 9:29:53 > top of Java-index,Core,Core APIs...
# 4

> It's not up to Java, it's up to the FTP host. You can

> probably control all that at the Linux end by

> reconfiguring FTP, don't ask me how. I would try

> using more of a path than just /a.jar, for a start.

i don't know what "using more of a path than just /a.jar" means.

if this is what you mean:

ftp://10.36.0.42/good_jars/a.jar

why is that better than:

ftp://10.36.0.42/a.jar

suppona at 2007-7-12 9:29:53 > top of Java-index,Core,Core APIs...
# 5

I don't know, why don't you try it? Maybe a path-less FTP request is routed through this Kerberos thing and using a path gives you a way to bypass it. I can't think of any other mechanism that would do it, except of course finding where this Kerberos thing is configured and turning it off altogether if that is possible. Do some investigation.

ejpa at 2007-7-12 9:29:53 > top of Java-index,Core,Core APIs...
# 6

can someone please post code that shows how to do

ClassLoading without using the

http

file

ftp

protocols?

why can't i do network class loading without running an

http or ftp server?

i need my system to be "self-contained" and not

rely on 3rd party servers (especially ones that

run on priviledged ports).

what am i missing.

suppona at 2007-7-12 9:29:53 > top of Java-index,Core,Core APIs...