wrong cast of PluginURLConnection to JarURLConnection
Project: | JNode Core |
Component: | Code |
Category: | bug report |
Priority: | normal |
Assigned: | Unassigned |
Status: | won't fix |
Jump to:
While trying to run Hudson in jnode, I am getting a ClassCastException (see attached file).
The method whoAmI() in Main class of hudson.war expect that the class is loaded from a jar. The problem is that; in jnode, it's loaded by a PluginClassLoader (with the jnode plugin protocol).
A solution might be that PluginURLConnection inherits from JarURLConnection, if that's possible.
I think that such thing is expected by other third party applications (iirc, ant-launcher is trying to find the location of its jars on disk).
Here is the code of whoAmI from hudson :
public static File whoAmI() throws IOException, URISyntaxException {
URL classFile = Main.class.getClassLoader().getResource("Main.class");
// JNLP returns the URL where the jar was originally placed (like http://hudson.dev.java.net/...)
// not the local cached file. So we need a rather round about approach to get to
// the local file name.
return new File(((JarURLConnection)classFile.openConnection()).getJarFile().getName());
}
Attachment | Size |
---|---|
hudson_JarURLConnection_ClassCastException.png | 13.84 KB |
- Login to post comments
#1
Shoothing yourself in the foot?
Didn't you repackage Hudson into a JNode plugin? If Hudson depends on its own packaging model then such problems can happen when you repackage it as a JNode plugin. It seems that making everything a JNode plugin is not the solution.
Instead we should support the normal startup modesl of Java applications which are in use on other operating systems.
JNode plugins are mostly for the core components of JNode.
#2
you're right, I am marking that as "won't fix"