hi Chris, some more details, I'd left out a line in my code snippet this
morning,
On 01/24/2013 05:33 PM, Christopher Schultz wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
Peter,
On 1/24/13 4:27 AM, Peter Lavin wrote:
After calling:
ClassLoader contextClassLoader =
Thread.currentThread().getContextClassLoader(); Class<?> spClass
= cl.arrayToClass(null, byArray, True);
You are fetching the current context ClassLoader and then using "cl"
to define your Class. Where do you instantiate your FileClassLoader?
Do you ever set it as the context ClassLoader? If not, it's never
going to work.
// I left out a line of code this morning when writing this, this is the
sequence of the code...
ClassLoader contextClassLoader =
Thread.currentThread().getContextClassLoader();
// this line was missing in earlier note
//this calls the class below
FileClassLoader cl = new FileClassLoader(contextClassLoader);
Class<?> spClass = cl.arrayToClass(null, byArray, True);
// my custom class loader code...
public class FileClassLoader extends java.lang.ClassLoader {
public FileClassLoader(ClassLoader contextClassLoader) {
super(contextClassLoader);
}
public synchronized Class<?> arrayToClass(String name, byte[] ct,
boolean resolve) {
Class<?> c = defineClass(name, ct, 0, ct.length);
try {
this.loadClass(c.getName(), resolve);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
return c;
}
}
What do you get back? Does the Class have the right name, etc?
Yes, this loads the class ok, with the correct name.
I think you can do this without the CustomObjectInputStream class
(as long as you don't need to run under a SecurityManager).
Ok, that's interesting, I won't be using SecuritManager as this is
research software,
regards
Peter
- -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17
(Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG
with Thunderbird - http://www.enigmail.net/
iEYEAREIAAYFAlEBcF0ACgkQ9CaO5/Lv0PDENgCghLaRu7LdIfbIrzR3Ubi8n3TX
HLsAmgJPcEpMkW+knGuVxeh7WsnZyKhW =+pi2 -----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org
--
with best regards,
Peter Lavin,
PhD Candidate,
CAG - Computer Architecture & Grid Research Group,
Lloyd Institute, 005,
Trinity College Dublin, Ireland.
+353 1 8961536
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org