[kaffe] jBoss & Kaffe
Ronald Aigner
ra3@os.inf.tu-dresden.de
Wed May 14 04:41:01 2003
Hi Dalibor,
On Wednesday 14 May 2003 09:53, Dalibor Topic wrote:
> argh, I wasn't finished with the code ...
> in libraries/javalib/java/lang/Class.java:
>
> public ClassLoader getClassLoader() {
> ClassLoader loader = getClassLoader0();
>
> if (loader == null) {
> loader = ClassLoader.getSystemClassLoader();
> }
>
> return loader;
> }
Tried this. Now jBoss exits in the line "String path = loc.getFile();", which
means that there is no URL for the code-source, which in turn means that it
should be set. This is only done by the URLClassLoader. Does JDK specify,
whether this has to be done by the other ClassLoaders as well?
/**
* Boot up JBoss.
*
* @param args The command line arguments.
*
* @throws Exception Failed to boot.
*/
public void boot(final String[] args) throws Exception
{
// Auto set HOME_DIR to ../bin/run.jar if not set
String homeDir = System.getProperty(ServerConfig.HOME_DIR);
if (homeDir == null)
{
ProtectionDomain pd = Main.class.getProtectionDomain();
CodeSource cs = pd.getCodeSource();
URL loc = cs.getLocation();
String path = loc.getFile();
/* The 1.4 JDK munges the code source file with URL encoding so run
* this path through the decoder so that is JBoss starts in a path
with
* spaces we don't come crashing down.
*/
path = java.net.URLDecoder.decode(path);
File file = new File(path).getParentFile().getParentFile();
homeDir = file.getCanonicalPath();
}
props.setProperty(ServerConfig.HOME_DIR, homeDir);
<code continues>
Greetings, Ron.
--
Mit freundlichen Gruessen/With regards
ra3 @ os.inf.tu-dresden.de
http://os.inf.tu-dresden.de/~ra3/